/// <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(); }); }
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); }); }
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); }); }