Пример #1
0
 /// <summary>
 /// 页面加载完成
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="FrameLoadEndEventArgs"/> instance containing the event data.</param>
 private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
 {
     if (e.Url.Contains("https://login.taobao.com/member/login.jhtml"))
     {
         if (!isLoadCompleted)
         {
             isLoadCompleted  = true;
             isLoginCompleted = false;
             if (!isQrCodeLogin)
             {
                 GetLocalData();
             }
             new Thread(() =>
             {
                 //页面加载完成回调
                 LoadSuccessHandle?.Invoke(true);
             })
             {
                 IsBackground = true
             }.Start();
         }
     }
     //错误
     else if (e.Url.Contains(errorUrl) || e.Url.Contains(denyUrl))
     {
         new Thread(() =>
         {
             LoadDenyHandler?.Invoke();
         })
         {
             IsBackground = true
         }.Start();
     }
     else if (e.Url.Contains(authView))
     {
         if (!isAuthCompleted)
         {
             isAuthCompleted = true;
             HideWindow();
         }
     }
     else if (e.Url.Equals(authUrl))
     {
         new Thread(() =>
         {
             Thread.Sleep(10000);
             if (browser.Address.Equals(authUrl))
             {
                 browser.ExecuteScriptAsync("auther('true')");
             }
         })
         {
             IsBackground = true
         }.Start();
     }
 }
Пример #2
0
 /// <summary>
 /// 页面加载完成
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="FrameLoadEndEventArgs"/> instance containing the event data.</param>
 private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
 {
     if (e.Url == LoginUrl)
     {
         if (!isLoadCompleted)
         {
             isLoadCompleted  = true;
             isLoginCompleted = false;
             new Thread(() =>
             {
                 //页面加载完成回调
                 LoadSuccessHandle?.Invoke(true);
             })
             {
                 IsBackground = true
             }.Start();
         }
     }
     //登录成功后的页面
     else if (e.Url == LoginSuccessUrl)
     {
         if (!isLoginCompleted)
         {
             isLoginCompleted = true;
             new Thread(() =>
             {
                 LoginSuccess();
             })
             {
                 IsBackground = true
             }.Start();
         }
     }
     //错误
     else if (e.Url.Contains(errorUrl) || e.Url.Contains(denyUrl))
     {
         new Thread(() =>
         {
             LoadDenyHandler?.Invoke();
         })
         {
             IsBackground = true
         }.Start();
     }
 }
Пример #3
0
 /// <summary>
 /// 页面加载完成
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="FrameLoadEndEventArgs"/> instance containing the event data.</param>
 private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e)
 {
     log.Debug(e.Url);
     if (e.Url == LoginUrl)
     {
         if (!isLoadCompleted)
         {
             isLoadCompleted = true;
             new Thread(() =>
             {
                 //页面加载完成回调
                 LoadSuccessHandle?.Invoke(true);
             })
             {
                 IsBackground = true
             }.Start();
         }
     }
     //登录成功后的页面
     else if (e.Url == LoginSuccessUrl)
     {
         HideWindow();
         isLoginSuccess = true;
         if (!isLoginCompleted)
         {
             isLoginCompleted = true;
             new Thread(() =>
             {
                 LoginSuccess();
             })
             {
                 IsBackground = true
             }.Start();
         }
     }
     else if (!string.IsNullOrEmpty(planUrl) && e.Url.Contains(planUrl))
     {
         if (!isLoadPlanCompleted)
         {
             isLoadPlanCompleted = true;
             new Thread(() =>
             {
                 ClickCampaignElement();
             })
             {
                 IsBackground = true
             }.Start();
         }
     }
     else if (e.Url == callback || e.Url.Contains("alisec.alimama.com/deny.html"))
     {
         new Thread(() =>
         {
             //提交完成
             SubmitSuccessHandle?.Invoke(true, goods);
         })
         {
             IsBackground = true
         }.Start();
     }
 }