public void Dispose() { _Disposed = true; Binding = null; UseINavigable = false; CleanWebControl(ref _CurrentWebControl); CleanWebControl(ref _NextWebControl); }
private Exception Test_HTMLWindow_WebCoreShutDown_Base_Exception(IWebSessionWatcher iWatcher) { var a = new AA1(); Exception res = null; TestNavigation((wpfbuild, wpfnav, WindowTest) => { wpfnav.WebSessionWatcher.Should().NotBeNull(); if (iWatcher != null) { wpfnav.WebSessionWatcher = iWatcher; } SetUpRoute(wpfbuild); wpfnav.UseINavigable = true; IAwesomeBinding bind = null; var mre = new ManualResetEvent(false); WindowTest.RunOnUIThread(() => wpfnav.IsHTMLLoaded.Should().BeFalse()); WindowTest.RunOnUIThread( () => { wpfnav.NavigateAsync(a).ContinueWith(t => { var tt = t as Task <IAwesomeBinding>; bind = tt.Result; mre.Set(); }); }); mre.WaitOne(); WindowTest.RunOnUIThread(() => { wpfnav.IsHTMLLoaded.Should().BeTrue(); a.Navigation.Should().NotBeNull(); var js = bind.JSRootObject; JSObject mycommand = (JSObject)js.Invoke("Change"); mycommand.Invoke("Execute"); }); Thread.Sleep(1500); res = a.Exception; }); return(res); }
private void Switch(Task <IAwesomeBinding> iBinding, HTMLLogicWindow iwindow, TaskCompletionSource <IAwesomeBinding> tcs) { object oldvm = (Binding != null) ? Binding.Root : null; Binding = iBinding.Result; if (_CurrentWebControl != null) { _CurrentWebControl.ConsoleMessage -= ConsoleMessage; _IWebViewLifeCycleManager.Dispose(_CurrentWebControl); } else if (OnFirstLoad != null) { OnFirstLoad(this, EventArgs.Empty); } _CurrentWebControl = _NextWebControl; _NextWebControl = null; _CurrentWebControl.Crashed += Crashed; _IWebViewLifeCycleManager.Display(_CurrentWebControl); _Window = iwindow; _Window.State = WindowLogicalState.Opened; _Window.OpenAsync().ContinueWith(t => EndAnimation(Binding.Root)); _Navigating = false; var inav = _UseINavigable ? Binding.Root as INavigable : null; if (inav != null) { inav.Navigation = this; } FireNavigate(Binding.Root, oldvm); if (tcs != null) { tcs.SetResult(Binding); } }
private void Crashed(object sender, CrashedEventArgs e) { if ((WebCore.IsShuttingDown) || (!WebCore.IsInitialized) || (Application.Current == null)) { return; } var dest = _CurrentWebControl.Source; var vm = Binding.Root; LogCritical("WebView crashed trying recover"); _IWebViewLifeCycleManager.Dispose(_CurrentWebControl); _CurrentWebControl.ConsoleMessage -= ConsoleMessage; _CurrentWebControl.Crashed -= Crashed; _CurrentWebControl = null; Binding = null; WebCore.QueueWork(() => Navigate(dest, vm, JavascriptBindingMode.TwoWay)); }
private void Switch(Task<IAwesomeBinding> iBinding, HTMLLogicWindow iwindow, TaskCompletionSource<IAwesomeBinding> tcs) { object oldvm = (Binding != null) ? Binding.Root : null; Binding = iBinding.Result; if (_CurrentWebControl!=null) { _CurrentWebControl.ConsoleMessage -= ConsoleMessage; _IWebViewLifeCycleManager.Dispose(_CurrentWebControl); } else if (OnFirstLoad != null) OnFirstLoad(this, EventArgs.Empty); _CurrentWebControl = _NextWebControl; _NextWebControl = null; _CurrentWebControl.Crashed += Crashed; _IWebViewLifeCycleManager.Display(_CurrentWebControl); _Window = iwindow; _Window.State = WindowLogicalState.Opened; _Window.OpenAsync().ContinueWith(t => EndAnimation(Binding.Root)); _Navigating = false; var inav = _UseINavigable ? Binding.Root as INavigable : null; if (inav != null) inav.Navigation = this; FireNavigate(Binding.Root, oldvm); if (tcs != null) tcs.SetResult(Binding); }
public void Dispose() { _Disposed = true; Binding = null; UseINavigable = false; CleanWebControl(ref _CurrentWebControl); CleanWebControl(ref _NextWebControl); }
private void Crashed(object sender, CrashedEventArgs e) { if ((WebCore.IsShuttingDown) || (!WebCore.IsInitialized) || (Application.Current==null)) return; var dest = _CurrentWebControl.Source; var vm = Binding.Root; LogCritical("WebView crashed trying recover"); _IWebViewLifeCycleManager.Dispose(_CurrentWebControl); _CurrentWebControl.ConsoleMessage -= ConsoleMessage; _CurrentWebControl.Crashed -= Crashed; _CurrentWebControl = null; Binding = null; WebCore.QueueWork(() => Navigate(dest, vm, JavascriptBindingMode.TwoWay)); }