예제 #1
0
 private void OnFrameLoadEnd(object sender, FrameLoadEndEventArgs e)
 {
     if (e.Frame.IsMain)
     {
         ActionExtension.InvokeInMainThread(() => PageLoaded?.Invoke(this, new UrlEventArgs(AlterUrl(e.Url))));
     }
 }
 private void SubscribeToViewLoadedMessage()
 {
     MessagingCenter.Subscribe <ExtendedContentPage>(this, "PageLoaded", (sender) =>
     {
         PageLoaded?.Invoke(sender, EventArgs.Empty);
     });
 }
 //***********************
 //*** Build Page Area ***
 //***********************
 /// <summary>
 ///     Constructor that defines the driver for an instance of this page,
 ///     defines the elements for this page, and launches the application.
 /// </summary>
 /// <param name="testClass"></param>
 public LoginPage(BaseTestClass testClass)
 {
     driver = testClass.getDriver();
     addElements();
     pageLoaded = new PageLoaded(this.driver);
     launchApplication();
 }
예제 #4
0
        private bool LoadFailedCallback(IntPtr webview, WebKitLoadEvent type, IntPtr failingUrl, IntPtr error, IntPtr userdata)
        {
            // this event is called when there is an error, immediately afterwards the LoadCallback is called with state Finished.
            // to indicate that there was an error and the PageLoaded event has been invoked, the loadEventHandled variable is set to true.
            loadEventHandled = true;
            PageLoaded?.Invoke(this, PageLoadEventArgs.Failed);

            return(false);
        }
예제 #5
0
        private void Webview_NavigationCompleted(object?sender, CoreWebView2NavigationCompletedEventArgs e)
        {
            if (EnableDevTools)
            {
                webview.CoreWebView2.OpenDevToolsWindow();
            }

            PageLoaded?.Invoke(this, new PageLoadEventArgs(lastNavigatedUri !, e.IsSuccess));
        }
예제 #6
0
        private async void Webview_NavigationCompleted(object sender, WebViewControlNavigationCompletedEventArgs e)
        {
            if (e.IsSuccess && !supportsInitializeScript)
            {
                string initScript = Resources.GetInitScript("Windows");
                await ExecuteScriptAsync(initScript);
            }

            PageLoaded?.Invoke(this, new PageLoadEventArgs(e.Uri, e.IsSuccess));
        }
예제 #7
0
#pragma warning restore 0618

        public void LoadUrl(string url, string externalToken, PageLoaded loadedHandler)
        {
            PageLoadedHandler = loadedHandler;

            // if the url begins with this, we'll launch it in an external browser
            ExternalToken = externalToken;

            ProgressBar.Visibility = ViewStates.Visible;
            WebView.LoadUrl(url);
        }
예제 #8
0
        private async void Webview_NavigationCompleted(object sender, WebViewControlNavigationCompletedEventArgs e)
        {
            if (e.IsSuccess && config.EnableScriptInterface)
            {
                string initScript = Resources.GetInitScript("Windows");
                await ExecuteScriptAsync(initScript);
            }

            PageLoaded?.Invoke(this, PageLoadEventArgs.GetFor(e.IsSuccess));
        }
예제 #9
0
        private void OnNavigated(object sender, PageLoadedEventArgs e)
        {
            CommandManager.InvalidateRequerySuggested();
            UrlTextBox.Text = e.Url;
            PageLoaded?.Invoke(this, new PageLoadedEventArgs(_something.GetUrl()));

            if (SaveKey != null && e.Url.StartsWith(@"http", StringComparison.OrdinalIgnoreCase))
            {
                ValuesStorage.Set(SaveKey, e.Url);
            }
        }
        private async void Webview_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (config.EnableScriptInterface)
            {
                string initScript = Resources.GetInitScript("Windows");
                await ExecuteScriptAsync(initScript);
            }

            // TODO: figure out how to get success state
            PageLoaded?.Invoke(this, PageLoadEventArgs.Successful);
        }
예제 #11
0
        private async void Webview_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (webview.ReadyState == WebBrowserReadyState.Complete)
            {
                string initScript = Resources.GetInitScript("Windows");
                await ExecuteScriptAsync(initScript);

                // TODO: figure out how to get success state
                // it may require some ActiveX Voodoo: https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.webbrowser.createsink
                PageLoaded?.Invoke(this, new PageLoadEventArgs(e.Url, true));
            }
        }
예제 #12
0
 public void LoadPage(KPage page)
 {
     this.page?.OnHide();
     this.page?.BackgroundImage?.UnloadGPU();
     this.page?.RemoveSelectionChangedEventHandler();
     this.page = page;
     this.page.OnShow(this);
     //ResetTransformation(true);
     RefreshPage();
     this.page.SelectionChanged += Page_SelectionChanged;
     PageLoaded?.Invoke(this, page);
 }
예제 #13
0
        /// <summary>
        ///     Метод обрабатывающий загрузку страницы
        /// </summary>
        /// <param name="pageHtml">Код загруженной страницы</param>
        /// <param name="pageUrl">Адрес страницы</param>
        private void OnPageLoaded(string pageHtml, string pageUrl)
        {
            TotalPages  = GetPagesCount(pageHtml);
            CurrentPage = GetCurrentPage(pageHtml);
            var totalAnnonces = GetAnnonceCount(pageHtml);

            PageLoaded?.Invoke(this, new PageLoadedEventArgs(CurrentPage, TotalPages, totalAnnonces));
            if (CurrentPage < TotalPages)
            {
                LoadPage(GetNextPageUrl(pageUrl));
            }
        }
예제 #14
0
        async Task Load()
        {
            OnBeginLoading();

            while (nextPage <= loadTo && !disposed)
            {
                await LoadNextPage().ConfigureAwait(false);

                PageLoaded?.Invoke(this, EventArgs.Empty);
            }

            OnEndLoading();
        }
예제 #15
0
 void OnDocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 {
     if (e.Url.AbsolutePath != Url.AbsolutePath)
     {
         return;
     }
     if (skip)
     {
         skip = false;
         return;
     }
     PageLoaded?.Invoke(this, e);
 }
예제 #16
0
        private async Task InitializePage()
        {
            //enables events.

            await internalSession.Page.Enable();

            await Task.Delay(100);

            internalSession.Page.SubscribeToLoadEventFiredEvent((evt) =>
            {
                //this should trigger when a page loads.
                PageLoaded?.Invoke(this, evt.Timestamp);
            });
        }
예제 #17
0
        /// <summary>
        ///     Verifies successful login
        /// </summary>
        /// <returns>Boolean true if successful, false otherwise</returns>
        private Boolean verifySucessfulLogin()
        {
            PageLoaded pl = new PageLoaded();

            pl.isDomComplete(driver);
            Boolean success = false;

            //If the page header contains "Welcome", then the application is deemed successfully logged into
            if (getText(elementDictionary["eleHomePageAllContentHeader"]).Contains("Welcome"))
            {
                success = true;
            }

            return(success);
        }
예제 #18
0
        /*private void OnLoadCompleted(object sender, NavigationEventArgs e) {
         *  Navigating?.Invoke(this, new PageLoadingEventArgs(AsyncProgressEntry.Ready, e.Uri.ToString()));
         * }*/

        private void OnNavigated(object sender, WebBrowserNavigatedEventArgs args)
        {
            if (_inner == null || _inner.Url != args.Url)
            {
                return;
            }

            var userCss = _styleProvider?.ToScript(args.Url.OriginalString, false);

            if (userCss != null)
            {
                Execute(userCss);
            }

            PageLoaded?.Invoke(this, new UrlEventArgs(args.Url.ToString()));
            LoadingStateChanged?.Invoke(this, new PageLoadingEventArgs(AsyncProgressEntry.Ready, args.Url.ToString()));
        }
예제 #19
0
        private async void LoadCallback(IntPtr webview, WebKitLoadEvent type, IntPtr userdata)
        {
            if (type == WebKitLoadEvent.Started)
            {
                loadEventHandled = false;
            }
            else if (type == WebKitLoadEvent.Finished && !loadEventHandled)
            {
                if (config.EnableScriptInterface)
                {
                    string initScript = Resources.GetInitScript("Linux");
                    await ExecuteScriptAsync(initScript);
                }

                loadEventHandled = true;
                PageLoaded?.Invoke(this, PageLoadEventArgs.Successful);
            }
        }
예제 #20
0
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
        public PunState()
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
        {
            WordNetEngine = new Lazy <WordNetEngine>(() => new WordNetEngine());

            PronunciationEngine = new Lazy <PronunciationEngine>(() => new PronunciationEngine());

            var tasks = new List <Task>()
            {
                Task.Factory.StartNew(() => WordNetEngine.Value),
                Task.Factory.StartNew(() => PronunciationEngine.Value)
            };

            _ = Task.WhenAll(tasks).ContinueWith(x =>
            {
                EnginesLoaded = true;
                PageLoaded?.Invoke(null, EventArgs.Empty);
            });
        }
예제 #21
0
        private async void LoadCallback(IntPtr webview, WebKitLoadEvent type, IntPtr userdata)
        {
            if (type == WebKitLoadEvent.Started)
            {
                loadEventHandled = false;
            }

            // this callback gets called in this order:
            // Started: initially defined URL
            // Redirected (optional, multiple): new URL to which the redirect points
            // Committed: final URL that gets loaded, either initial URL or same as last redirect URL
            // Finished: same URL as committed, page has fully loaded
            if (type == WebKitLoadEvent.Started || type == WebKitLoadEvent.Redirected)
            {
                string url  = GLibString.FromPointer(WebKit.GetCurrentUri(webview));
                var    args = new NavigatingEventArgs(new Uri(url));
                Navigating?.Invoke(this, args);
                if (args.Cancel)
                {
                    WebKit.StopLoading(webview);
                }
            }
            else if (type == WebKitLoadEvent.Finished && !loadEventHandled)
            {
                string initScript = Resources.GetInitScript("Linux");
                await ExecuteScriptAsync(initScript);

                if (EnableDevTools)
                {
                    ShowDevTools();
                }

                loadEventHandled = true;
                string url = GLibString.FromPointer(WebKit.GetCurrentUri(webview));
                PageLoaded?.Invoke(this, new PageLoadEventArgs(new Uri(url), true));
            }
        }
예제 #22
0
 //TODO: Make private if private callbacks are permitted https://github.com/aspnet/Blazor/issues/1218
 public static void OnPageLoaded()
 {
     PageLoaded?.Invoke(null, EventArgs.Empty);
 }
예제 #23
0
 private void LoadFailedCallback(IntPtr self, IntPtr op, IntPtr view, IntPtr navigation, IntPtr error)
 {
     PageLoaded?.Invoke(this, PageLoadEventArgs.Failed);
 }
예제 #24
0
 private void LoadCallback(IntPtr self, IntPtr op, IntPtr view, IntPtr navigation)
 {
     PageLoaded?.Invoke(this, PageLoadEventArgs.Successful);
 }
예제 #25
0
 public void _TriggerPageLoaded()
 {
     PageLoaded?.Invoke(this, EventArgs.Empty);
 }