Exemplo n.º 1
0
        private void WB_DownloadCompleted(object sender, CSWebDownloader.HttpDownloadCompletedEventArgs e)
        {
            var client = (sender as HttpDownloadClient);
            var url    = client.Url;

            if (SyncNavContext.EndUrls.Any(x => x == url.AbsoluteUri) && e.Error == null)
            {
                SyncNavContext.Tcs.TrySetResult(SynchronousLoadResult.GetFileDownloadResult(true, client.DownloadPath));
            }
            else
            {
                SyncNavContext.Tcs.TrySetResult(SynchronousLoadResult.GetFileDownloadResult(false, client.DownloadPath));
            }
        }
Exemplo n.º 2
0
 private void WB_Navigated(object sender, WebBrowserNavigatedEventArgs e)
 {
     if (SyncNavContext == null)
     {
         return;
     }
     if (!SyncNavContext.Tcs.Task.IsCompleted && SyncNavContext.EndUrls.Any(x => x == WB.Document.Url.AbsoluteUri))
     {
         if ((int)SyncNavContext.Tcs.Task.Status <= 3)
         {
             SyncNavContext.Tcs.TrySetResult(SynchronousLoadResult.GetWebBrowserResult(true));
         }
         else
         {
             SyncNavContext.Tcs.TrySetResult(SynchronousLoadResult.GetWebBrowserResult(false));
         }
     }
 }
Exemplo n.º 3
0
 private void WB_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 {
     if (SyncNavContext == null)
     {
         return;
     }
     if (e.Url.AbsoluteUri.StartsWith("https://login.taobao.com/member/login.jhtml"))
     {
         SyncNavContext.Tcs.TrySetResult(SynchronousLoadResult.GetWebBrowserResult(false, true));
         return;
     }
     if (!SyncNavContext.Tcs.Task.IsCompleted && SyncNavContext.EndUrls.Any(x => x == WB.Document.Url.AbsoluteUri))
     {
         if ((int)SyncNavContext.Tcs.Task.Status <= 3)
         {
             SyncNavContext.Tcs.TrySetResult(SynchronousLoadResult.GetWebBrowserResult(true));
         }
         else
         {
             SyncNavContext.Tcs.TrySetResult(SynchronousLoadResult.GetWebBrowserResult(false));
         }
     }
 }