private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
        {
            // This looks really ugly, but it's easier than implementing steam's steammobile:// protocol using CefSharp
            // We override the page's GetValueFromLocalURL() to pass in the keys for sending ajax requests
            Debug.WriteLine("IsLoading: " + e.IsLoading);
            if (e.IsLoading == false)
            {
                // Generate url for details
                string urlParams = steamAccount.GenerateConfirmationQueryParams("details" + tradeID);

                var script = string.Format(@"window.GetValueFromLocalURL = 
                function(url, timeout, success, error, fatal) {{            
                    console.log(url);
                    if(url.indexOf('steammobile://steamguard?op=conftag&arg1=allow') !== -1) {{
                        // send confirmation (allow)
                        success('{0}');
                    }} else if(url.indexOf('steammobile://steamguard?op=conftag&arg1=cancel') !== -1) {{
                        // send confirmation (cancel)
                        success('{1}');
                    }} else if(url.indexOf('steammobile://steamguard?op=conftag&arg1=details') !== -1) {{
                        // get details
                        success('{2}');
                    }}
                }}", steamAccount.GenerateConfirmationQueryParams("allow"), steamAccount.GenerateConfirmationQueryParams("allow"), urlParams);
                browser.ExecuteScriptAsync(script);
            }
        }
Example #2
0
 private void Display_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (e.IsLoading == false)
     {
         display.GetBrowser().MainFrame.ExecuteJavaScriptAsync("internationalize(\"" + EscapeJS(LanguageManager.language.phrases.favorites) + "\", \"" + EscapeJS(LanguageManager.language.phrases.internet) + "\", \"" + LanguageManager.language.phrases.normal + "\");");
     }
 }
        private void Browser1_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (!e.IsLoading)
            {
                this.Browser1.Dispatcher.Invoke(new Action(() => { this.Browser1.ZoomLevel = this.genSettings.ZoomLevel; }));

                if (string.IsNullOrEmpty(this.genSettings.CustomCSS))
                {
                    // Fix for KapChat so a long chat message doesn't wrap to a new line
                    if (this.genSettings.ChatType == (int)ChatTypes.KapChat)
                    {
                        InsertCustomCSS(@".message { display: inline !important; }");
                    }
                }
                else
                {
                    InsertCustomCSS(this.genSettings.CustomCSS);
                }


                if ((this.genSettings.ChatType == (int)ChatTypes.KapChat) && (this.genSettings.ChatNotificationSound.ToLower() != "none"))
                {
                    // Insert JS to play a sound on each chat message
                    string script = @"var oldChatInsert = Chat.insert;
Chat.insert = function() {
    (async function() {
	    await CefSharp.BindObjectAsync('jsCallback');
        jsCallback.playSound();
    })();
    return oldChatInsert.apply(oldChatInsert, arguments);
}";
                    InsertCustomJavaScript(script);
                }
            }
        }
Example #4
0
        private void webBrowser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            this.InvokeOnUiThreadIfRequired(new Action(() =>
            {
                try
                {
                    btnBack.Enabled = e.Browser.CanGoBack;
                    btnNext.Enabled = e.Browser.CanGoForward;

                    if (e.IsLoading)
                    {
                        btnRefresh.Text    = "终止";
                        btnRefresh.Tooltip = "终止加载";
                    }
                    else
                    {
                        btnRefresh.Text    = "刷新";
                        btnRefresh.Tooltip = "刷新页面";
                    }
                    lbTips.Text = e.IsLoading ? "正在加载中..." : "加载完毕";
                    if (LoadingStateChanged != null)
                    {
                        LoadingStateChanged(this, e);
                    }
                }
                catch (Exception)
                {
                }
            }));
        }
Example #5
0
        private void webBrowser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            SetCanGoBack(e.CanGoBack);
            SetCanGoForward(e.CanGoForward);

            this.InvokeOnUiThreadIfRequired(() => SetIsLoading(e.IsLoading));
            _CanCopy = !e.IsLoading;
            if (!e.IsLoading)
            {
                _IsLoading = false;
                if (!_IsLoadedForFirstTime)
                {
                    _IsLoadedForFirstTime = true;
                }
                if (myBrowserInfo.ScrollDown != 0)
                {
                    webBrowser.ExecuteScriptAsync("window.scrollTo(0," + myBrowserInfo.ScrollDown + " );");
                }
                if (myBrowserInfo.ScrollRight != 0)
                {
                    webBrowser.ExecuteScriptAsync("window.scrollTo(" + myBrowserInfo.ScrollRight + " ,0);");
                }


                if (!_IsZoomSet)
                {
                    tsZoom.Text = myBrowserInfo.Zoom.ToString(CultureInfo.CurrentCulture) + "%";
                    webBrowser.SetZoomLevel((Convert.ToDouble(myBrowserInfo.Zoom) - 100) / 25.0);
                    _IsZoomSet = true;
                }
            }
        }
Example #6
0
        private void Browser1_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (!e.IsLoading)
            {
                this.Browser1.Dispatcher.Invoke(new Action(() => { this.Browser1.ZoomLevel = this.genSettings.ZoomLevel; }));

                if (!string.IsNullOrEmpty(this.genSettings.CustomCSS))
                {
                    InjectCSS(this.genSettings.CustomCSS);
                }


                if ((!this.genSettings.isCustomURL) && (this.genSettings.ChatNotificationSound))
                {
                    // Inject JS to play a sound on each chat message
                    string script = @"var oldChatInsert = Chat.insert;
Chat.insert = function() {
    (async function() {
	    await CefSharp.BindObjectAsync('jsCallback');
        jsCallback.playSound();
    })();
    return oldChatInsert.apply(oldChatInsert, arguments);
}";
                    InjectJS(script);
                }
            }
        }
Example #7
0
 private void CefBrowser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
 {
     this.Dispatcher.Invoke(() =>
     {
         //LifeSpanHandler life = new LifeSpanHandler();        
         //cefBrowser.LifeSpanHandler = null;
     });            
 }
Example #8
0
        public void OnLoadingStateChanged(CefSharp.LoadingStateChangedEventArgs e)
        {
            ILoadHandler handler = webBrowser.LoadHandler;

            if (handler != null)
            {
                handler.OnLoadingStateChange(webBrowser, e);
            }
        }
Example #9
0
        private async void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)        //30行目の中身
        {
            if (!e.IsLoading)
            {
                var text = await e.Browser.MainFrame.GetSourceAsync();

                source.Invoke((MethodInvoker) delegate {
                    source.Text = text;
                });
            }
        }
Example #10
0
        private void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (!e.IsLoading && e.Browser.HasDocument)
            {
                InsertInjectableFiles();

                foreach (PluginContainer p in RegisteredPlugins)
                {
                    p.LoadedPlugin.OnBrowserNavigation(_addon, this, _wkOverlay.Browser);
                }
            }
        }
Example #11
0
        private void Browser1_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (!e.IsLoading)
            {
                //if ((this.genSettings.ZoomLevel >= -4.0) && (this.genSettings.ZoomLevel <= 4.0))
                this.Browser1.Dispatcher.Invoke(new Action(() => { this.Browser1.ZoomLevel = this.genSettings.ZoomLevel; }));

                if (!string.IsNullOrEmpty(this.genSettings.CustomCSS))
                {
                    InjectCSS(this.genSettings.CustomCSS);
                }
            }
        }
Example #12
0
        private void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            Console.WriteLine("Loading state changed");

            if (!e.IsLoading)
            {
                this.Invoke((MethodInvoker) delegate
                {
                    lblLoading.Visible = false;
                    Browser.Visible    = true;
                });
            }
        }
Example #13
0
 private void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (e.CanReload)//当加载页面  由于完成、取消、因错误停止时
     {
         pageLoaded?.Invoke();
         try
         {
         }
         catch
         {
         }
     }
     //throw new NotImplementedException();
 }
        private async void ChromiumWebBrowser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (e.IsLoading)
            {
                this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => this.ChromiumWebBrowser.Visibility = Visibility.Hidden));
            }
            else
            {
                RemoveBlocksOnPage();
                this.ChromiumWebBrowser.ExecuteScriptAsync(File.ReadAllText(@"jquery-3.4.0.min.js"));
                //Thread.Sleep(1000);

                this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => this.ChromiumWebBrowser.Visibility = Visibility.Visible));
            }
        }
        /// <summary>
        /// Invoked when the browser starts or finishes loading
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void BrowserLoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
        {
            // Done loading?
            if (! e.IsLoading)
            {
                // Find a better way to modify the UI than to invoke dispatcher
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                  {
                    // Find the loading fade out Storyboard
                    Storyboard fadeOut = (Storyboard)FindResource("FadeOutLoading");

                    // Fade out the loading image
                    fadeOut.Begin();
                }));
            }
        }
Example #16
0
        private void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
        {
            try
            {
                WriteLog(String.Format("{5}:\r\nBrowser: {0}\r\nCanGoBack. {1}\r\nCanGoForward: {2}\r\nCanReload: {3}\r\nIsLoading: {4}", e.Browser, e.CanGoBack, e.CanGoForward, e.CanReload, e.IsLoading, System.Reflection.MethodBase.GetCurrentMethod().Name));

                this.Dispatcher.Invoke(
                    () =>
                {
                    lbStatus.Content = browser.IsLoading ? "loading..." : "loaded";
                });
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Example #17
0
        private void cefWebBrowerX_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            var          cefWebBrowerX = (CefWebBrowserX)sender;
            SuperTabItem item          = GetTabItem(cefWebBrowerX);

            if (item == null)
            {
                return;
            }
            if (e.IsLoading)
            {
                item.Text = "加载...";
            }
            else
            {
                item.Text = cefWebBrowerX.WebName;
            }
        }
Example #18
0
        private void HandleBrowserLoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (e.IsLoading)
            {
                StatusEvent?.Invoke(this, new WebBrowserProgressEventArgs
                {
                    Description = Properties.Resources.WEB_LOADING
                });
            }
            else
            {
                StatusEvent?.Invoke(this, new WebBrowserProgressEventArgs {
                    Description = string.Empty
                });
            }

            DispatcherHelper.CheckBeginInvokeOnUI(async() =>
            {
                Log.Debug(e.IsLoading ? $"Loading web page = {_browser.Address}" : "Loaded web page");

                if (!e.IsLoading)
                {
                    if (!_showing)
                    {
                        // page is loaded so fade in...
                        _showing = true;
                        await InitBrowserFromDatabase(_currentMediaItemUrl);

                        FadeBrowser(true, () =>
                        {
                            OnMediaChangeEvent(CreateMediaEventArgs(_mediaItemId, MediaChange.Started));
                            _browserGrid.Focus();

                            if (_useMirror)
                            {
                                ShowMirror();
                            }
                        });
                    }
                }
            });
        }
Example #19
0
        private void Browser1_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (!e.IsLoading)
            {
                if (SettingsSingleton.Instance.genSettings.ChatType == (int)ChatTypes.TwitchPopout)
                {
                    if (SettingsSingleton.Instance.genSettings.BetterTtv)
                    {
                        InsertCustomJavaScriptFromUrl("https://cdn.betterttv.net/betterttv.js");
                    }
                    if (SettingsSingleton.Instance.genSettings.FrankerFaceZ)
                    {
                        // Observe for FrankerFaceZ's reskin stylesheet
                        // that breaks the transparency and remove it
                        InsertCustomJavaScript(@"
(function() {
    const head = document.getElementsByTagName(""head"")[0];
    const observer = new MutationObserver((mutations, observer) => {
        for (const mut of mutations) {
            if (mut.type === ""childList"") {
                for (const node of mut.addedNodes) {
                    if (node.tagName.toLowerCase() === ""link"" && node.href.includes(""color_normalizer"")) {
                        node.remove();
                    }
                }
            }
        }
    });
    observer.observe(head, {
        attributes: false,
        childList: true,
        subtree: false,
    });
})();
                        ");

                        InsertCustomJavaScriptFromUrl("https://cdn.frankerfacez.com/static/script.min.js");
                    }
                }
            }
        }
        private void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            Dispatcher.Invoke(() => Url = Browser.Address);

            if (Url != null && Url.StartsWith(AppInfo.SpotifyRedirectUri + "?code="))
            {
                while (RefreshToken == null)
                {
                    string code = UriExtensions.GetPropertyValue(Url, "code");

                    var tokenResp = _spotify.GetToken(code, AppInfo.SpotifyRedirectUri);

                    this.ExpireTime   = tokenResp.ExpiresIn;
                    this.ResultToken  = tokenResp.AccessToken;
                    this.RefreshToken = tokenResp.RefreshToken;

                    Dispatcher.Invoke(() => this.Browser.Dispose());
                    Dispatcher.Invoke(() => this.Close());
                }
            }
        }
Example #21
0
        private void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            var CookieManager = CefSharp.Cef.GetGlobalCookieManager();

            //cookieManager = Browser.GetCookieManager();

            if (!e.IsLoading)
            {
                CookieManager.VisitAllCookiesAsync().ContinueWith(t =>
                {
                    if (t.Status == TaskStatus.RanToCompletion)
                    {
                        string cookies     = "";
                        var browsercookies = t.Result;
                        foreach (var cookie in browsercookies)
                        {
                            System.Diagnostics.Debug.WriteLine("CookieName: " + cookie.Name);
                            if (cookie.Domain == new Uri(this.url).DnsSafeHost)
                            {
                                cookies += cookie.Name + "=" + cookie.Value + "; ";
                            }
                        }
                        if (!string.IsNullOrEmpty(cookies))
                        {
                            // System.Diagnostics.Debug.WriteLine(getjwt(this.url, cookies));
                            _jwt = getjwt(this.url, cookies);
                            if (!string.IsNullOrEmpty(_jwt))
                            {
                                GenericTools.RunUI(() => { DialogResult = true; });
                            }
                        }
                    }
                    else
                    {
                        System.Diagnostics.Debug.WriteLine("No Cookies found");
                    }
                });
            }
        }
        private void Browser1_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (!e.IsLoading)
            {
                //string[] vipList = new string[] { "Chat", "Baffler", "test" };

                /*string script = @"var oldChatInsert = Chat.insert;
                 * Chat.insert = function(nick, tags, message) {
                 * var nick = nick || 'Chat';
                 * var vips = ['";
                 * script += string.Join(",", vipList).Replace(",", "','").ToLower();
                 * script += @"'];
                 * if (vips.includes(nick.toLowerCase()))
                 * {
                 * (async function() {
                 * await CefSharp.BindObjectAsync('jsCallback');
                 * jsCallback.playSound();
                 * })();
                 * return oldChatInsert.apply(oldChatInsert, arguments);
                 * }
                 * }";*/
            }
        }
Example #23
0
        private void View_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            loading = e.IsLoading;

            if (tabs is null || tabs.main is null)
            {
                return;
            }

            if (e.IsLoading)
            {
                tabs.main.SetTabTitle(" ... ", tabIndex);
            }
            else
            {
                tabs.main.UpdateSelectedTab();

                if (view.Address.Contains(FormMain.URL_LOGIN) && UserLogoutClicked != null)
                {
                    UserLogoutClicked(sender, e);
                }
            }
        }
        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; }));

                // Insert some custom CSS for webcaptioner.com domain
                if (this.customURL.ToLower().Contains("webcaptioner.com"))
                {
                    string base64CSS = Utilities.Base64Encode(CustomCSS_Defaults.WebCaptioner.Replace("\r\n", "").Replace("\t", ""));

                    string href = "data:text/css;charset=utf-8;base64," + base64CSS;

                    string script = "var link = document.createElement('link');";
                    script += "link.setAttribute('rel', 'stylesheet');";
                    script += "link.setAttribute('type', 'text/css');";
                    script += "link.setAttribute('href', '" + href + "');";
                    script += "document.getElementsByTagName('head')[0].appendChild(link);";

                    this.Browser2.ExecuteScriptAsync(script);
                }
            }
        }
Example #25
0
 private void chromiumWebBrowser1_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
 }
        private void OnBrowserLoadingStateChanged(object sender, LoadingStateChangedEventArgs args)
        {
            SetCanGoBack(args.CanGoBack);
            SetCanGoForward(args.CanGoForward);

            this.InvokeOnUiThreadIfRequired(() => SetIsLoading(!args.CanReload));
        }
Example #27
0
 private void BrowserOnLoadingStateChanged(object sender, LoadingStateChangedEventArgs loadingStateChangedEventArgs)
 {
     var allJs = Properties.Resources.jsAllLoadSkybet;
     var matheses = new List<Mathes>();
     if (loadingStateChangedEventArgs.IsLoading) return;
     Debug.WriteLine("Loaded");
     //getScreenShot("load");
     var all = browser.EvaluateScriptAsync(allJs);
     all.ContinueWith(task2 =>
     {
         isLoad = true;
     });
 }
Example #28
0
 private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
 {
     Browser.EvaluateScriptAsync("document.getElementsByTagName('body')[0].style.overflow = 'hidden'");
     Browser.SetFocus(true);
     ToggleBrowser(!e.IsLoading);
     if (e.IsLoading)
         SetTitle("Loading...");
 }
Example #29
0
 private void Webbrowser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
 }
Example #30
0
 private void ExtendedBrowser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
 {
     OnLoadingStateChanged?.Invoke(this, e);
 }
 private async void WebMain_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
 {
     if (e.IsLoading) return;
     await FetchBookInfoAsync();
 }
Example #32
0
        /// <summary>
        /// Webブラウザーのプログレス変更
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ChromeBrowser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            delegate_UpdateProgressBar callback = new delegate_UpdateProgressBar(UpdateProgressBar);

            this.ProgressBar.Invoke(callback, e.IsLoading);
        }
Example #33
0
 void browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
 {
     Console.WriteLine("load changed:" + e.IsLoading);
 }
Example #34
0
        private void OnBrowserLoadingStateChanged(object sender, LoadingStateChangedEventArgs args)
        {
            if (args.IsLoading==false)
            {
                browser.ShowDevTools();

            }
            //SetCanGoBack(args.CanGoBack);
            //SetCanGoForward(args.CanGoForward);

            //this.InvokeOnUiThreadIfRequired(() => SetIsLoading(!args.CanReload));
        }
Example #35
0
        //task
        private void Browser_StateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
        {
            if (e.IsLoading == false)
            {
                new Thread(
                    () =>
                {
                    var w        = sender as CustomChrominWebBrowser;
                    var infoTask = w.Info;
                    //获取对应View
                    var _TaskView = GetTaskViewModel(w);
                    if (_TaskView.Chrome == null)
                    {
                        _TaskView.Chrome = w;
                    }

                    if (infoTask != null)
                    {
                        LogHelper.Debug("开始执行任务 :" + infoTask.Action);
                        //设置显示标题
                        App.Current.Dispatcher.BeginInvoke(new Action(() =>
                        {
                            _TaskView.Url   = w.Address;
                            _TaskView.Title = w.Title;
                        }));
                        //获取本地Tasksize
                        //if (_TaskView.TotalCount < w.TaskSize()) _TaskView.TotalCount = w.TaskSize();

                        //JQ环境检查与注入
                        var _jq = JSHelper.EnableJQ(e.Browser.MainFrame);
                        _jq.Wait();
                        if (!_jq.Result)
                        {
                            JSHelper.InjuctJQ(e.Browser.MainFrame);
                        }


                        string url = w.Info.Action;   //即使页面发生跳转也按指定的task进行解析
                                                      //App.Current.Dispatcher.Invoke((Func<string>)(() => { return w.Address; }));

                        //进行解析
                        var _result = ExcuteAnalysis(w, e.Browser.MainFrame, CmdHelper.GetRule(url), infoTask, _TaskView);
                        _result.Wait();
                        Console.WriteLine("Task 执行完毕 出错值为" + _result.Result);
                        w.Info = null;

                        App.Current.Dispatcher.BeginInvoke(new Action(() =>
                        {
                            //只获取当前存储路径
                            _TaskView.Path = infoTask.WorkDirectory;

                            if (_result.Result > 0)
                            {
                                _TaskView.ErrorCount += 1;
                            }
                            else
                            {
                                _TaskView.SuccessCount += 1;
                            }
                        }));
                    }
                    //控制响应
                    if (_TaskView.IsPauseing)
                    {
                        _TaskView.IsPaused   = true;
                        _TaskView.IsPauseing = false;
                        LogHelper.Debug(w.ID + " 任务已被用户主动暂停");
                        return;
                    }

                    if (_TaskView.IsStopping)
                    {
                        _TaskView.IsStopped  = true;
                        _TaskView.IsStopping = false;
                        LogHelper.Debug(w.ID + " 任务已被用户主动停止");
                        return;
                    }


                    if (w.TaskSize() > 0)
                    {
                        //if (_TaskView.TotalCount < w.TaskSize()) _TaskView.TotalCount = w.TaskSize();
                        //获取下一个解析任务
                        w.Info = w.PopTask();

                        //跳转网页地址
                        App.Current.Dispatcher.Invoke(
                            (Action)(() =>
                        {
                            w.Address = w.Info.Action;
                        }));

                        LogHelper.Debug(w.ID + " 已分配下一个内部任务 " + w.Info.Action);
                    }
                    else
                    {
                        App.Current.Dispatcher.BeginInvoke(new Action(() => {
                            _TaskView.IsCompleted = true;
                        }));
                        //Console.WriteLine("Finished ===> {0}", _TaskView.IsCompleted);


                        //重置以回收
                        //w.Reset();
                        BH.Reuse(w);
                        RemoveTaskBrowserView(w);
                        UpdateTasekViewUI();
                        LogHelper.Debug(w.ID + " 的内部任务已执行完毕,并已重置后回收到对象池");

                        //若向主任务队列中加入了子任务,而主任务分配线程已结束,需要重新启动分配线程
                        if (TaskHelper.HasTask() && !BK.IsBusy)
                        {
                            BK.RunWorkerAsync();
                        }
                    }
                }
                    ).Start();
            }
        }
Example #36
0
 private void browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     OnPropertyChanged("ReadyToPush");
 }
        private void ChromeBrowser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
        {
            try
            {
                if (chromeBrowser.Address == "http://www.abalonellc.com/hairshop-10-coming-so10.html")
                    IsSuccess = false;
                else if (chromeBrowser.Address.Contains("abalonellc")) // оплата прошла?
                {
                    /*          // Возвращает return url вида:
                    http://www.abalonellc.com/hairshop-10-coming-so10.html?
                    paymentId=PAY-3PR23826GT693594MLALPVYA&
                    token=EC-6H734593WP4251039&
                    PayerID=6YDRH9BGLQN9G
                    */

                    var parse = HttpUtility.ParseQueryString(chromeBrowser.Address);
                    var paymentId = parse.Get("paymentId");
                    var token = parse.Get("token");
                    var payerId = parse.Get("PayerID");

                    if (string.IsNullOrEmpty(payerId))
                    {
                        IsSuccess = false;
                        throw new Exception();
                    }

                    createdPayment.Execute(apiContext, new PaymentExecution() { payer_id = payerId, transactions = createdPayment.transactions });
                    IsSuccess = true;
                    ((Form)TopLevelControl).Close();
                }
            }
            catch
            {
                IsSuccess = false;
                ((Form)TopLevelControl).Close();
            }
        }
Example #38
0
        private void BrowserOnLoadingStateChanged(object sender, LoadingStateChangedEventArgs loadingStateChangedEventArgs)
        {
            var allJs = Properties.Resources.jsAllLoad;
            var matheses = new List<Mathes>();

            if (loadingStateChangedEventArgs.IsLoading) return;
            if (!isLoad)
                return;
            var all = browser.EvaluateScriptAsync(allJs);
            all.ContinueWith(task2 =>
            {
                CheckLoaded();
                var click = browser.EvaluateScriptAsync("clickToTennis()");
                if (click.Result.Success != true)
                {
#if DEBUG   
                   // getScreenShot("two");
#endif
                    throw new Exception("Exeption in stateChanged" + click.Result.Message);
                }
                CheckLoaded();
                Debug.WriteLine("Click");
                var suscribe = browser.EvaluateScriptAsync("suscribeEventsScores()");
                if (!string.IsNullOrEmpty(prevComp))
                {
                    SuscribeToScores(prevComp);
                }
                if (suscribe.Result.Success == true) return;
#if DEBUG
               // getScreenShot("three");
#endif
                throw new Exception("Exeption in stateChanged" + suscribe.Result.Message);
            });
        }
 private void Browser_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
 {
     if (!e.IsLoading)
     {
     }
 }
 private void CurrentBrowser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
 {
     UpdateNavigation?.Invoke(this, new NavigationalEventArgs(CurrentTab.CanGoForward, CurrentTab.CanGoBack));
 }