private void GetAuthorizationCode() { _client = new YubiCryptClient(clientId, clientSecret, callbackUrl); messageText.Text = "Please sign in to your YubiCrypt account:"; var url = _client.GetAuthorizationCodeRequestUrl(new string[] { "files", "keys" }); MainBrowser.Navigate(url); }
private void ErrorComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var item = ErrorComboBox.SelectedItem as FileInfo; if (item == null) { MainBrowser.Navigate("about:blank"); } else { var uri = new System.Uri(item.FullName); MainBrowser.Navigate(uri.AbsoluteUri); } }
public MainWindow() { InitializeComponent(); DataContext = new MainWindowViewModel(); if (!SetBrowserEmulationVersion(BrowserEmulationVersion.Version11Edge)) { _logger.Error("Initialization was failed! NOT SET THE VERSION OF BROWSER!"); } MainBrowser.Navigating += (s, e) => { var fiComWebBrowser = typeof(WebBrowser).GetField("_axIWebBrowser2", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); if (fiComWebBrowser == null) { return; } var objComWebBrowser = fiComWebBrowser.GetValue(MainBrowser); if (objComWebBrowser == null) { return; } objComWebBrowser.GetType().InvokeMember("Silent", System.Reflection.BindingFlags.SetProperty, null, objComWebBrowser, new object[] { true }); }; MainBrowser.Navigated += (sender, args) => { var webBrowserSource = MainBrowser.Source.ToString(); var correctUrlMatchValue = Regex.Match(webBrowserSource, "(?<=https://)www.instagram.com").Value; if (string.IsNullOrEmpty(correctUrlMatchValue)) { MessageBox.Show( "You can navigate only to \"https://www.instagram.com\" page. Please, navigate to correct page. You will redirect to correct page.", "Wrong URL", MessageBoxButton.OK); MainBrowser.Source = new Uri("https://www.instagram.com/"); MainBrowser.Navigate("https://www.instagram.com/"); } }; var curDir = Directory.GetCurrentDirectory(); DocumentationBrowser.Navigate($"file:///{curDir}/Doc/documentation.htm"); }
void RefreshErrorsComboBox() { var asm = new AssemblyInfo(); var dir = new DirectoryInfo(LogHelper.Current.LogsFolder); var errors = dir.GetFiles("*.htm").OrderByDescending(x => x.CreationTime).ToArray(); SubjectTextBox.Text = string.Format("Problem with {0}", asm.Product); ErrorComboBox.ItemsSource = errors; ErrorComboBox.DisplayMemberPath = nameof(FileInfo.Name); if (errors.Length > 0) { ErrorComboBox.SelectedIndex = 0; } else { MainBrowser.Navigate("about:blank"); } }
async Task GetLinesFromPage(string page, HtmlElementCollection tr) { if (page != "") { MainBrowser.Document.InvokeScript(page); } List <string> links = new List <string>(); Regex rS = new Regex("\"/draha/.*?\""); foreach (HtmlElement element in tr) { string test = rS.Match(element.InnerHtml).Value; if (test != "") { test = test.Replace("\"", ""); links.Add(test); } } foreach (string s in links) { MainBrowser.Navigate("https://cp.hnonline.sk" + s); await PageLoad(1); tr = MainBrowser.Document.GetElementsByTagName("tr"); lines.Add(new Line()); for (int i = 1; i < tr.Count - 1; i++) { if (tr[i].Children[0].OuterHtml.Contains("EndDark") || tr[i].Children[0].OuterHtml.Contains("lastRouteDark")) { lines.Last().AddStop(tr[i].Children[0].InnerText, tr[i].Children[1].InnerText == " " ? tr[i].Children[2].InnerText : tr[i].Children[1].InnerText); break; } else if (tr[i].Children[0].OuterHtml.Contains("Dark")) { lines.Last().AddStop(tr[i].Children[0].InnerText, tr[i].Children[2].InnerText); } } } }
async void HladajButton_Click(object sender, EventArgs e) { dataGridView1.Visible = false; dataGridView1.Columns.Clear(); lines.Clear(); MainBrowser.Navigate("https://cp.hnonline.sk/" + GetTransportMethod() + "/odchody/"); await PageLoad(10); MainBrowser.Focus(); SendKeys.Send("%{o}"); //access key which selects the field SendKeys.Send(ZTextBox.Text); SendKeys.Send("%{k}"); SendKeys.Send(DoTextBox.Text); SendKeys.Send("%{t}"); SendKeys.Send(datumPicker.Value.ToString("d.M.yyyy")); SendKeys.Send("%{a}"); SendKeys.Send("00:00"); SendKeys.SendWait("{ENTER}"); await PageLoad(10); await PageLoad(10); var tr = MainBrowser.Document.GetElementsByTagName("tr"); Regex rL = new Regex(@"javascript:.+?\)"); List <string> pages = rL.Matches(tr[1].InnerHtml).Cast <Match>().Select(match => match.Value).ToList(); await GetLinesFromPage("", tr); foreach (string page in pages) { await GetLinesFromPage(page, tr); } dataGridView1.Visible = true; ShowResults(); }
private void BtnShowMap_Click(object sender, RoutedEventArgs e) { MainBrowser.Navigate("http://localhost:13060/Map/Population"); }
public MainWindow() { InitializeComponent(); MainBrowser.Navigate("http://www.google.com"); }
private void MainBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { // Determinar en Que pagina Estoy. // Tomar Desicion // CASE // Darle a Pagina Anterior. if (cbGetCases.Checked) { int Activity = 0; var WPDoc = new HtmlAgilityPack.HtmlDocument(); var doc = ((MainForm)Application.OpenForms[0]).MainBrowser.Document; var renderedHtml = doc.GetElementsByTagName("HTML")[0].OuterHtml; WPDoc.LoadHtml(renderedHtml); var SearchBtn = doc.GetElementById("ctl00$cphBody$cmdSearch"); var CancelBtn = doc.GetElementById("ctl00$cphBody$cmdClear"); var ViewElements = doc.GetElementById("cphBody_cmbPageSize"); if (SearchBtn != null && CancelBtn != null) { Activity = 1; } if (ViewElements != null) { if (ViewElements.OuterHtml.IndexOf("selected=\"selected\" value=\"All\">") > 0) { Activity = 3; } else { Activity = 2; } } if (renderedHtml.Contains("Modify your search criteria by selecting the Search Criteria tab")) { Activity = 4; } switch (Activity) { //ctl00$cphBody$gvSearch$ctl09$txtParameter: 01 / 01 / 2013 //ctl00$cphBody$gvSearch$ctl10$txtParameter: 02 / 01 / 2013 //ctl00$cphBody$gvSearch$ctl11$cmbParameterPostBack: 101 //ctl00$cphBody$gvSearch$ctl12$cmbParameterNoPostBack: 146 //ctl00$cphBody$gvSearch$ctl13$cmbParameterNoPostBack: 96 case 1: { var BeginDate = doc.GetElementById("cphBody_gvSearch_txtParameter_7"); var EndDate = doc.GetElementById("cphBody_gvSearch_txtParameter_8"); var CourtType = doc.GetElementById("cphBody_gvSearch_cmbParameterPostBack_9"); CourtType.SetAttribute("Value", "101"); var CaseType = doc.GetElementById("cphBody_gvSearch_cmbParameterNoPostBack_10"); Thread.Sleep(2000); // var SearchDate = GetMeDate(); SelectNewDayRange(); BeginDate.SetAttribute("Value", StartDay.ToString("MM/dd/yyyy")); EndDate.SetAttribute("Value", EndDay.ToString("MM/dd/yyyy")); CaseType.SetAttribute("Value", "146"); SearchBtn.InvokeMember("Click"); logclick("Search"); break; } case 2: { ViewElements.SetAttribute("Value", "All"); ViewElements.InvokeMember("onChange"); // MainBrowser.Refresh(WebBrowserRefreshOption.Completely); logclick("Search"); break; } case 3: { PalmCaseInfoClass CInfo = new PalmCaseInfoClass(); CInfo.County = County; // Tomar Casos en el Dia; var CasosDiaStr = doc.GetElementById("cphBody_lblRecordsReturned"); if (CasosDiaStr != null) { CInfo.NumberOfCases = Convert.ToInt32(CasosDiaStr.InnerText); var wrkint = CInfo.NumberOfCases; if (wrkint == 200) { StartDay.AddDays(AdicionarDias * -1); StartDay.AddDays(-1); EndDay = StartDay; EndDay.AddDays(AdicionarDias); AdicionarDias = AdicionarDias - 3; MainBrowser.Navigate("https://applications.mypalmbeachclerk.com/eCaseView/search.aspx"); logclick("Main Page"); break; } else { var casosxdia = wrkint / AdicionarDias; var amplitud = casosxdia * 3; var cabe = (200 - amplitud); if (wrkint > cabe) { AdicionarDias++; } } } var TablaCasos = WPDoc.GetElementbyId("cphBody_gvResults"); var CasesInfoRow = TablaCasos.Descendants("tr").ToList(); foreach (var Crow in CasesInfoRow) { if (!Crow.InnerText.Contains("Arrest Date")) { var CasesInfoColumn = Crow.Descendants("td").ToList(); int Num = 0; string[] AColInfo = new string[7]; foreach (var Ccol in CasesInfoColumn) { AColInfo[Num] = Ccol.InnerText; Num++; } pbICases WC = new pbICases(); WC.CaseNumber = AColInfo[0]; WC.Courts = AColInfo[1]; WC.CaseType = AColInfo[2]; try { WC.FileDate = Convert.ToDateTime(AColInfo[4]); } catch { WC.FileDate = Convert.ToDateTime("2008-01-01"); } if (!string.IsNullOrEmpty(AColInfo[5])) { if (AColInfo[5].IndexOf(" V ") > 0) { WC.PrimaryParty = AColInfo[5].Substring(0, AColInfo[5].IndexOf(" V ")); WC.SecondaryParty = AColInfo[5].Substring(AColInfo[5].IndexOf(" V ") + 3); } else { WC.PrimaryParty = AColInfo[5]; WC.SecondaryParty = AColInfo[5]; } } WC.CaseStatus = AColInfo[6]; CInfo.ListaCasos.Add(WC); CInfo.FileDate = WC.FileDate; } } // Salvar en Async y Threadding. SaveCases(CInfo); // Slow the speed Thread.Sleep(24000); // cphBody_lbSearch // Volver a la pantalla de Busqueda //var SearchLink = doc.GetElementById("ctl00$cphBody$cmdSearch"); //SearchBtn.InvokeMember("Click"); MainBrowser.Navigate("https://applications.mypalmbeachclerk.com/eCaseView/search.aspx"); logclick("Main Page"); break; } case 4: { MainBrowser.Navigate("https://applications.mypalmbeachclerk.com/eCaseView/search.aspx"); logclick("Main Page"); break; } } } }
private void btnGO_Click(object sender, EventArgs e) { MainBrowser.Navigate(new Uri(tbURI.Text)); logclick("Navigate To URI"); }