예제 #1
0
        /// <summary>
        /// Вызывать только внутри DownloadPage
        /// </summary>
        /// <param name="url"></param>
        public static void NavigatePage(string url)
        {
            if (string.IsNullOrWhiteSpace(url))
            {
                throw new NullReferenceException("DownloadPage url can't be null!");
            }

            DCT.ExecuteCurrentDispatcher(d =>
            {
                WebBrowser.Navigate(url);
                Wait();
            });
        }
예제 #2
0
 public static void WaitPage(Action <string> afterCompleted)
 {
     Execute(() =>
     {
         Stream stream = null;
         DCT.ExecuteCurrentDispatcher(d =>
         {
             Wait();
             stream = WebBrowser.DocumentStream;
         });
         var result = "";
         using (var sr = new StreamReader(stream))
             result = sr.ReadToEnd();
         afterCompleted?.Invoke(result);
     });
 }
예제 #3
0
 public static void DownloadPage(string url, Action <string> compliteAction)
 {
     if (string.IsNullOrWhiteSpace(url))
     {
         throw new NullReferenceException("DownloadPage url can't be null!");
     }
     Execute(() =>
     {
         Stream stream = null;
         DCT.ExecuteCurrentDispatcher(d =>
         {
             WebBrowser.Navigate(url);
             Wait();
             stream = WebBrowser.DocumentStream;
         });
         var result = "";
         using (var sr = new StreamReader(stream))
             result = sr.ReadToEnd();
         compliteAction?.Invoke(result);
     });
 }