internal void InstallEvents()
 {
     Dispatch.Install <HTML_BrowserReady_t>(x => OnBrowserReady?.Invoke(new Browser(x.UnBrowserHandle)));
     Dispatch.Install <HTML_StartRequest_t>(x => OnStartRequest?.Invoke(new Browser(x.UnBrowserHandle), x.PchURL, x.PchTarget, x.PchPostData, x.BIsRedirect));
     Dispatch.Install <HTML_JSAlert_t>(x => OnJSAlert?.Invoke(new Browser(x.UnBrowserHandle), x.PchMessage));
     Dispatch.Install <HTML_JSConfirm_t>(x => OnJSConfirm?.Invoke(new Browser(x.UnBrowserHandle), x.PchMessage));
     Dispatch.Install <HTML_FileOpenDialog_t>(x => OnFileOpenDialog?.Invoke(new Browser(x.UnBrowserHandle), x.PchTitle, x.PchInitialFile));
     Dispatch.Install <HTML_FinishedRequest_t>(x => OnFinishedLoading?.Invoke(new Browser(x.UnBrowserHandle), x.PchURL, x.PchPageTitle));
     Dispatch.Install <HTML_NeedsPaint_t>(x => OnNeedsPaint?.Invoke(new Browser(x.UnBrowserHandle), new BrowserPaint(x)));
     Dispatch.Install <HTML_NewWindow_t>(x => OnNewWindow?.Invoke(new Browser(x.UnBrowserHandle), new BrowserNewWindow(x)));
     Dispatch.Install <HTML_OpenLinkInNewTab_t>(x => OnNewTab?.Invoke(new Browser(x.UnBrowserHandle), x.PchURL));
     Dispatch.Install <HTML_StatusText_t>(x => OnStatusText?.Invoke(new Browser(x.UnBrowserHandle), x.PchMsg));
 }
예제 #2
0
        public void Mainloop(float deltatime)
        {
            OnMainLoopBegin?.Invoke(this, EventArgs.Empty);
            if (Closed)
            {
                return;
            }

            if (CreatedFrame)
            {
                CreatedFrame = false;
            }
            if (_browserReadyFrame)
            {
                OnBrowserReady?.Invoke(this, EventArgs.Empty);
                CreatedFrame       = true;
                _browserReadyFrame = false;
            }

            if (Browser == null)
            {
                return;
            }

            if (LoadedFrame)
            {
                LoadedFrame     = false;
                IsDocumentReady = true;
            }
            Loading = Browser.IsLoading;
            if (_loadedFrame)
            {
                LoadedFrame  = true;
                _loadedFrame = false;
            }

            if (_invalidateAccFrame)
            {
                _newAccFrameReady.Clear();
            }

            if (!TextureSettings.Equals(_prevTextureSettings))
            {
                UpdateSize();
            }

            //if (BrowserSettings.ZoomLevel != Browser.Host.ZoomLevel)
            //{
            //    Browser.Host.ZoomLevel = Math.Abs(BrowserSettings.ZoomLevel) <= 0.0001 ? 0.0001 : BrowserSettings.ZoomLevel;
            //    //Browser.Host.ZoomLevel = BrowserSettings.ZoomLevel;
            //}

            Browser.Host.ZoomLevel = BrowserSettings.ZoomLevel;

            if (DocumentSizeBaseSelector != null)
            {
                DocumentSizeBaseSelector.Selector = BrowserSettings.DocumentSizeElementSelector;
            }

            if (LivePageActive != BrowserSettings.UseLivePage)
            {
                ExecuteJavascript(BrowserSettings.UseLivePage ? Globals.LivePageLoader : Globals.LivePageUnloader);
                LivePageActive = BrowserSettings.UseLivePage;
            }

            SubmittedTouches.Clear();

            if (Enabled)
            {
                try
                {
                    Operations?.InvokeRecursive(this);
                }
                catch (Exception e)
                {
                    LogError(e);
                }

                if (InitSettings.FrameRequestFromVvvv && AllowFrameRequest)
                {
                    Browser.Host.SendExternalBeginFrame();
                }
            }

            ProcessTouches();

            _prevTextureSettings = TextureSettings;
            _prevBrowserSettings = BrowserSettings;

            OnMainLoopEnd?.Invoke((object)this, EventArgs.Empty);
        }