Example #1
0
        void Browser_LoadingStateChanged(object Sender, CefSharp.LoadingStateChangedEventArgs E)
        {
            if (OAuthCodeSource == null)
            {
                return;
            }
            string CurrentAddress = E.Browser.FocusedFrame.Url;

            Match CodeMatch = Regex.Match(CurrentAddress, OAuthCodeDecoder);

            if (CodeMatch.Success)
            {
                Group CodeGroup = CodeMatch.Groups["OAuthCode"];
                if (CodeGroup.Success)
                {
                    OAuthCodeSource.TrySetResult(CodeGroup.Value);
                }
            }

            Dispatcher.Invoke(() => {
                string BrowserTitle = Browser.Title;
                if (!BrowserTitle.IsNullOrEmpty())
                {
                    Title = BrowserTitle;
                }
            }, System.Windows.Threading.DispatcherPriority.Normal);
        }
Example #2
0
 private void View_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (!e.IsLoading && ctabs[0].view.Address.Contains(URL_DASHBOARD))
     {
         Login();
     }
 }
 private void Browser2_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (!e.IsLoading)
     {
         //if ((ZoomLevel >= -4.0) && (ZoomLevel <= 4.0))
         this.Browser2.Dispatcher.Invoke(new Action(() => { this.Browser2.ZoomLevel = ZoomLevel; }));
     }
 }
Example #4
0
 private static void PageReady(object sender, CefSharp.LoadingStateChangedEventArgs args)
 {
     if (!args.IsLoading)
     {
         script = script.Replace("[USER]", Properties.Settings.Default.user);
         script = script.Replace("[PWD]", Properties.Settings.Default.password);
         overlay.Browser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(script);
     }
 }
Example #5
0
 private static void PageReady(object sender, CefSharp.LoadingStateChangedEventArgs args)
 {
     if (!args.IsLoading)
     {
         overlay.Browser.GetBrowser().MainFrame.ExecuteJavaScriptAsync(script);
         overlay.Browser.GetBrowser().MainFrame.ExecuteJavaScriptAsync("login_page_html = `" + popup_html + "`;");
         overlay.Browser.GetBrowser().MainFrame.ExecuteJavaScriptAsync("onPageLoaded();");
     }
 }
Example #6
0
 private void Browser1_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (!e.IsLoading)
     {
         if (AppSettings.Default.zoom_level > 0)
         {
             this.Browser1.Dispatcher.Invoke(new Action(() => { this.Browser1.ZoomLevel = AppSettings.Default.zoom_level; }));
         }
     }
 }
Example #7
0
 private void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (!e.IsLoading)
     {
         _splash?.Hide();
         _duplex.Client.Order(x => x.NotifyReady());
         _transparenter.MakeOpaque();
         _splash?.Close();
     }
 }
Example #8
0
 // Set the button states if the browser's loading state changed..
 private void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (this.IsHandleCreated)                    // an exception might occur: "Invoke or BeginInvoke cannot be called on a control until the window handle has been created."
     {
         this.Invoke(new MethodInvoker(delegate() // Set the button states with an invoke call as the browser runs in a different thread..
         {
             SetButtonStates();                   // sets the button states to enabled / disabled depending on the browser component's state..
         }
                                       ));
     }
 }
 private void LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (e.IsLoading)
     {
         TrySetLoadingIndicator(true);
     }
     else
     {
         TrySetLoadingIndicator(false);
     }
 }
Example #10
0
 private void ChromiumWebBrowser1_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (!e.IsLoading)
     {
         if (chromiumWebBrowser1.Address.ToLower().StartsWith("http://localhost"))
         {
             // Read info from the url
             string url = chromiumWebBrowser1.Address;
         }
     }
     BeginInvoke((MethodInvoker) delegate { textBox1.Text = chromiumWebBrowser1.Address; Refresh(); });
 }
Example #11
0
 /// <summary>
 /// Show ProgressRing and URL in Build-in WebBrowser
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (e.IsLoading)
     {
         this.Dispatcher.Invoke(() => {
             ProgressRing.Visibility = Visibility.Visible;
             StatusBarText.Content   = "Now Loading...";
         });
     }
     else
     {
         this.Dispatcher.Invoke(() => {
             ProgressRing.Visibility = Visibility.Hidden;
             StatusBarText.Content   = Browser.Address;
         });
     }
 }
 private void BrowerContent_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (!e.IsLoading)
     {
         this.Dispatcher.Invoke(() =>
         {
             loading.Visibility = Visibility.Hidden;
         });
     }
     else
     {
         Dispatcher.Invoke(() =>
         {
             loading.Visibility = Visibility.Visible;
         });
     }
 }
Example #13
0
        private async void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (e.IsLoading)
            {
                return;
            }

            if (_fakeLoaded)
            {
                _fakeLoaded = false;
                return;
            }

            if (!_rendered)
            {
                await this.RenderTablature();
            }
        }
Example #14
0
 private void EbayWebBrowser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     this.Dispatcher.Invoke(() =>
     {
         ebayAddress = EbayWebBrowser.Address;
     });
     if (!e.IsLoading)
     {
         if (!string.IsNullOrWhiteSpace(ebayAddress))
         {
             vm.GetEbayBrowserVisiblity(new Uri(ebayAddress));
         }
     }
     if (vm.HasEbayToken())
     {
         vm.GetEbayTransaction();
         Properties.Settings.Default.LastHitDateEbay = DateTime.Now;
         Properties.Settings.Default.Save();
     }
 }
Example #15
0
        private async void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (!e.IsLoading)
            {
                await Task.Delay(750);

                var html = await browser.GetBrowser().MainFrame.GetSourceAsync();

                doc.LoadHtml(html);
                if (doc.DocumentNode.Descendants("div").Where(o => o.GetAttributeValue("class", "").Contains("PartReader__content")).FirstOrDefault() != null)
                {
                    Status          = "Click Download button to save the currently open chapter.";
                    DownloadEnabled = true;
                }
                else
                {
                    Status          = "Open novel reader first.";
                    DownloadEnabled = false;
                }
            }
        }
Example #16
0
 private void M_Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     m_SyncCtx.Post(new SendOrPostCallback(isLoading => {
         IsBusy = (bool)isLoading;
     }), e.IsLoading);
 }
Example #17
0
 private void chromiumWebBrowser1_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
 }
Example #18
0
        private void WebBrowser_LoadingStatusChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (!e.IsLoading)
            {
                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    statustext.Text = String.Format("{0} {1} {2}", webBrowser.Address, status, subStatus);
                }));
                switch (status)
                {
                case dlStatus.zero:
                    break;

                case dlStatus.home:
                    sendLogon();
                    break;

                case dlStatus.logon:
                    searchTab();
                    break;

                case dlStatus.search:
                    searchInvoices();
                    break;

                case dlStatus.found:
                    switch (subStatus)
                    {
                    case dlStatus.zero:
                        collectInvoices();         // azután pegig új szálon letöltés
                        break;

                    case dlStatus.search:
                        clickOnJs("Letöltés");
                        subStatus = dlStatus.found;
                        subRow    = 0;
                        Application.Current.Dispatcher.Invoke(new Action(() =>
                        {
                            statustext.Text = String.Format("Letöltés alatt: {0}", invoiceIpc.invoices[rowNum].fileNameMask);
                        }));
                        break;

                    case dlStatus.found:
                        Application.Current.Dispatcher.Invoke(new Action(() =>
                        {
                            if (!invDownloadTabUrl.Equals(webBrowser.Address))
                            {
                                subStatus = dlStatus.search;
                                return;
                            }
                            webBrowser.GetBrowser().MainFrame.EvaluateScriptAsync(@"
                                    tdata = document.getElementById('content').children[2].children[1].children[0].children[0].children[1].children[0].children[0].children[0].children[0];
                                    if(row=tdata.rows[" + subRow++ + @"]) {
                                        if (row && row.children[1] && row.children[1].children[0] && row.children[1].children[0].href)
                                        {
                                            href = row.children[1].children[0].href;
                                            // Dwonload: szamla_pdf, szamla_teho_pdf, teho_all_pdf, szamla_hiteles
                                            if(href.indexOf('szamla_pdf') != -1 || href.indexOf('szamla_teho_pdf') != -1 || href.indexOf('teho_all_pdf') != -1 || href.indexOf('szamla_hiteles') != -1 ) 
                                            {
                                                row.children[1].children[0].click();
                                                console.info('row ' + " + subRow + @");
                                            }
                                            else // Skip: minden más
                                            {
                                                console.info('skip row ' + " + subRow + @");
                                                " + mkAnchorIteratorJs("Letöltés") + @"
                                            }
                                            //TODO: popup ablak kezelése és letöltés  if(row.children[1].children[0].href.indexOf('szamla_xml') != -1) {row.children[1].children[0].click(); alert('2');}
                                        } 
                                        else
                                        {
                                            // trigger the LoadingStatusChanged event from JS
                                            console.info('skip row ' + " + subRow + @");
                                            " + mkAnchorIteratorJs("Letöltés") + @"
                                        }
                                    }
                                    else
                                    {
                                        // trigger the LoadingStatusChanged event from JS
                                        console.info('skip row ' + " + subRow + @");
                                        " + mkAnchorIteratorJs("Letöltés") + @"
                                    }");
                            if (subRow > 9)
                            {
                                clickOnJs(" vissza a listához");
                                subStatus = dlStatus.download;
                                subRow    = 0;
                            }
                            Thread.Yield();
                        }));
                        Thread.Yield();
                        break;

                    case dlStatus.download:
                        Application.Current.Dispatcher.Invoke(new Action(() =>
                        {
                            if (invDownloadTabUrl.Equals(webBrowser.Address))
                            {
                                Thread.Yield();
                                Thread.Sleep(2000);
                                Thread.Yield();
                            }
                            else
                            {
                                subStatus = dlStatus.logoff;
                            }
                        }));
                        break;

                    case dlStatus.logoff:
                        break;
                    }
                    //collectInvoices();
                    break;
                }
            }
        }
Example #19
0
 private void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (!e.IsLoading)
     {
     }
 }