Example #1
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 _View_OnFirstLoad(object sender, EventArgs e)
 {
     OnFirstLoad?.Invoke(this, e);
 }
Example #4
0
 private void FirstLoad(object sender, FirstLoadEvent e)
 {
     IsHTMLLoaded = true;
     OnFirstLoad?.Invoke(this, e);
 }