private void CleanWebControl(ref IWebBrowserWindowProvider iWebControl)
        {
            if (iWebControl == null)
            {
                return;
            }

            iWebControl.HTMLWindow.Crashed        -= Crashed;
            iWebControl.HTMLWindow.ConsoleMessage -= ConsoleMessage;
            iWebControl.Dispose();
            iWebControl = null;
        }
        private void CleanWebControl(ref IWebBrowserWindowProvider WebControl)
        {
            if (WebControl == null)
            {
                return;
            }

            WebControl.HtmlWindow.Crashed        -= Crashed;
            WebControl.HtmlWindow.ConsoleMessage -= ConsoleMessage;
            WebControl.Dispose();
            WebControl = null;
        }
Пример #3
0
        private void Switch(Task <IHtmlBinding> binding, HtmlLogicWindow window, TaskCompletionSource <IHtmlBinding> tcs)
        {
            var oldvm         = GetMainViewModel(Binding);
            var fireFirstLoad = false;

            Binding = binding.Result;

            if (_CurrentWebControl != null)
            {
                _CurrentWebControl.HtmlWindow.ConsoleMessage -= ConsoleMessage;
                _CurrentWebControl.Dispose();
            }
            else
            {
                fireFirstLoad = true;
            }

            _CurrentWebControl = _NextWebControl;
            _NextWebControl    = null;
            _CurrentWebControl.HtmlWindow.Crashed += Crashed;

            _CurrentWebControl.Show();

            _Window = window;

            var rootVm = GetMainViewModel(Binding);

            var inav = _UseINavigable ? rootVm as INavigable : null;

            if (inav != null)
            {
                inav.Navigation = this;
            }
            _Window.State = WindowLogicalState.Opened;

            _Window.OpenAsync().ContinueWith(t => EndAnimation(rootVm));

            _Navigating = false;

            FireNavigate(rootVm, oldvm);

            tcs?.SetResult(Binding);

            if (!fireFirstLoad)
            {
                return;
            }

            OnFirstLoad?.Invoke(this, new FirstLoadEvent(_CurrentWebControl.HtmlWindow));
        }
        private void Switch(Task <IHTMLBinding> binding, HTMLLogicWindow window, TaskCompletionSource <IHTMLBinding> tcs)
        {
            var oldvm         = Binding?.Root;
            var fireFirstLoad = false;

            Binding = binding.Result;

            if (_CurrentWebControl != null)
            {
                _CurrentWebControl.HTMLWindow.ConsoleMessage -= ConsoleMessage;
                _CurrentWebControl.Dispose();
            }
            else
            {
                fireFirstLoad = true;
            }

            _CurrentWebControl = _NextWebControl;
            _NextWebControl    = null;
            _CurrentWebControl.HTMLWindow.Crashed += Crashed;

            _CurrentWebControl.Show();

            _Window = window;

            var inav = _UseINavigable ? Binding.Root as INavigable : null;

            if (inav != null)
            {
                inav.Navigation = this;
            }
            _Window.State = WindowLogicalState.Opened;

            _Window.OpenAsync().ContinueWith(t => EndAnimation(Binding.Root));

            _Navigating = false;

            FireNavigate(Binding.Root, oldvm);

            tcs?.SetResult(Binding);

            if (fireFirstLoad)
            {
                OnFirstLoad?.Invoke(this, EventArgs.Empty);
            }
        }
        private void CleanWebControl(ref IWebBrowserWindowProvider iWebControl)
        {
            if (iWebControl == null)
                return;

            iWebControl.HTMLWindow.Crashed -= Crashed;
            iWebControl.HTMLWindow.ConsoleMessage -= ConsoleMessage;
            iWebControl.Dispose();
            iWebControl = null;
        }