mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 08:03:22 +00:00
e8cf336bf3
- Make Wpf/WinForms/OffScreen projects target AnyCPU Only the VC++ projects are platform specific now. - Remove BrowserSubProcess project reference Not needed as we now have a standalone exe - Add OffScreen example - Add WPF Example project - Fix some compile errors for main solution - Add BrowserSubProcess executable - JavascriptObjectRepository remove isAsync param Rather than throw exception remove the option - BrowserSubprocess Exclude the WCF specific code from the netCore project - Add some ifdef/ifndef to exclude the WCF specific implementation - Move WCF implementation into separate namespace
54 lines
1.7 KiB
C#
54 lines
1.7 KiB
C#
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using CefSharp.Example.JavascriptBinding;
|
|
|
|
namespace CefSharp.Wpf.Example
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for JavascriptCallbackMainWindow.xaml
|
|
/// </summary>
|
|
public partial class JavascriptCallbackMainWindow : Window
|
|
{
|
|
private JavascriptCallbackBoundObject boundObjectOne;
|
|
private JavascriptCallbackBoundObject boundObjectTwo;
|
|
|
|
public JavascriptCallbackMainWindow()
|
|
{
|
|
InitializeComponent();
|
|
|
|
boundObjectOne = new JavascriptCallbackBoundObject(BrowserOne);
|
|
boundObjectTwo = new JavascriptCallbackBoundObject(BrowserTwo);
|
|
|
|
#if NETCOREAPP
|
|
BrowserOne.JavascriptObjectRepository.Register("boundObject", boundObjectOne);
|
|
BrowserTwo.JavascriptObjectRepository.Register("boundObject", boundObjectTwo);
|
|
#else
|
|
BrowserOne.JavascriptObjectRepository.Register("boundObject", boundObjectOne, false);
|
|
BrowserTwo.JavascriptObjectRepository.Register("boundObject", boundObjectTwo, false);
|
|
#endif
|
|
}
|
|
|
|
private void ExecuteCallbackImmediatelyClick(object sender, RoutedEventArgs e)
|
|
{
|
|
boundObjectOne.RunCallback();
|
|
boundObjectTwo.RunCallback();
|
|
|
|
BrowserOne.Reload();
|
|
BrowserTwo.Reload();
|
|
}
|
|
|
|
private void ExecuteCallbackInThreeSeconds(object sender, RoutedEventArgs e)
|
|
{
|
|
BrowserOne.Address = "custom://cefsharp/SchemeTest.html";
|
|
BrowserTwo.Address = "custom://cefsharp/SchemeTest.html";
|
|
|
|
Task.Delay(3000).ContinueWith(t =>
|
|
{
|
|
boundObjectOne.RunCallback();
|
|
boundObjectTwo.RunCallback();
|
|
});
|
|
|
|
}
|
|
}
|
|
}
|