private async void VisitUrlAsync() { if (!enableRefresh) { return; } URLHTML = await MainFrm.RunBusyWork(() => { HttpStatusCode code; return(GetHtml(URL, out code)); }); if (URLHTML.Contains("尝试自动重定向") && MessageBox.Show("网站提示: " + URLHTML + "\n 通常原因是网站对请求合法性做了检查, 建议填写关键字对网页内容进行自动嗅探", "提示信息", MessageBoxButton.OK) == MessageBoxResult.OK) { return; } ControlExtended.SafeInvoke(() => HtmlDoc.LoadHtml(URLHTML), name: "解析html文档"); if (string.IsNullOrWhiteSpace(selectText) == false) { currentXPaths = HtmlDoc.SearchXPath(SelectText, () => IsAttribute).GetEnumerator(); GetXPathAsync(); } OnPropertyChanged("URLHTML"); }
private async void VisitUrlAsync() { if (!enableRefresh) { return; } if (hasInit == false) { return; } URLHTML = await MainFrm.RunBusyWork(() => { HttpStatusCode code; ConfigFile.GetConfig <DataMiningConfig>().RequestCount++; return(GetHtml(URL, out code)); }, title : GlobalHelper.Get("long_visit_web")); if (URLHTML.Contains(GlobalHelper.Get("key_671")) && MessageBox.Show(GlobalHelper.Get("key_672") + URLHTML + GlobalHelper.Get("key_673"), GlobalHelper.Get("key_99"), MessageBoxButton.OK) == MessageBoxResult.OK) { return; } ControlExtended.SafeInvoke(() => { HtmlDoc.LoadHtml(URLHTML); if (MainDescription.IsUIForm) { var dock = MainFrm as IDockableManager ?? ControlExtended.DockableManager; var control = dock?.ViewDictionary.FirstOrDefault(d => d.Model == this); if (control != null) { dynamic invoke = control.View; if (IsSuperMode == false) { invoke.UpdateHtml(URLHTML); OnPropertyChanged("HtmlDoc"); } else { invoke.UpdateHtml(GlobalHelper.Get("key_674")); } } } }, name: GlobalHelper.Get("key_675")); if (string.IsNullOrWhiteSpace(selectText) == false) { currentXPaths = HtmlDoc.SearchXPath(SelectText, () => IsAttribute).GetEnumerator(); GetXPathAsync(); } OnPropertyChanged("URLHTML"); }
private async void VisitUrlAsync() { if (!enableRefresh) { return; } if (hasInit == false) { return; } URLHTML = await MainFrm.RunBusyWork(() => { HttpStatusCode code; RequestManager.Instance.RequestCount++; return(GetHtml(URL, out code)); }); if (URLHTML.Contains("尝试自动重定向") && MessageBox.Show("网站提示: " + URLHTML + "\n 通常原因是网站对请求合法性做了检查, 建议填写关键字对网页内容进行自动嗅探", "提示信息", MessageBoxButton.OK) == MessageBoxResult.OK) { return; } ControlExtended.SafeInvoke(() => { HtmlDoc.LoadHtml(URLHTML); if (MainDescription.IsUIForm) { var dock = MainFrm as IDockableManager ?? ControlExtended.DockableManager; var control = dock?.ViewDictionary.FirstOrDefault(d => d.Model == this); if (control != null) { dynamic invoke = control.View; if (IsSuperMode == false) { invoke.UpdateHtml(URLHTML); OnPropertyChanged("HtmlDoc"); } else { invoke.UpdateHtml("超级模式下内置浏览器不展示内容,请查看左侧的文本内容"); } } } }, name: "解析html文档"); if (string.IsNullOrWhiteSpace(selectText) == false) { currentXPaths = HtmlDoc.SearchXPath(SelectText, () => IsAttribute).GetEnumerator(); GetXPathAsync(); } OnPropertyChanged("URLHTML"); }