public User() { LogView = new WebBrowser(); LogView.Navigate(new Uri(AppResources.Server + "League.aspx")); //LogView.Navigate(new Uri("/League.html", UriKind.Relative)); int loadbrowser = 0; while (LogView.SaveToString().Length < 1) { loadbrowser++; } string x = LogView.SaveToString(); MessageBox.Show("Done"); InitializeComponent(); }
private void GoalB_Click(object sender, RoutedEventArgs e) { WebBrowser browser1 = new WebBrowser(); browser1.Navigate(new Uri(AppResources.Server + "Goal.aspx?teamScoring=" + "B" + "&MatchId=" + AppResources.GameId)); int loadbrowser = 0; while (browser1.SaveToString().Length < 1) { loadbrowser++; } string Data = browser1.SaveToString(); string[] RawHtmlSplit = Data.Split('`'); string DataNeeded = RawHtmlSplit[1]; if (DataNeeded.Contains("Score Updated")) { scoreB++; ScoreB.Text = String.Format("{0}", scoreB); } else MessageBox.Show("Action Failed"); }
private void signup_Click(object sender, RoutedEventArgs e) { WebBrowser Browser12 = new WebBrowser(); Browser12.Navigate(new Uri(AppResources.Server + "Login.aspx?Type=Register&Name=" + Name.Text + "&Password="******"&email=" + e_mail.Text + "&team="+team.Text)); //string Temp = Browser12.SaveToString(); string Data = null;// int loadbrowser = 0; while (Browser12.SaveToString().Length < 1) { loadbrowser++; } Data = Browser12.SaveToString(); string[] RawHtmlSplit = Data.Split('`'); string DataNeeded = RawHtmlSplit[1]; if(DataNeeded.Contains("User Added")) { string[] Clean = DataNeeded.Split(','); UserData.Text = Clean[0] + "\n" + "Your New Username is: " + Clean[1]; } }
private void SaveImgMethod(System.Windows.Controls.TextBox textBox, WebBrowser webBrowser) { Match host = Regex.Match(textBox.Text, "http://[ a-z|A-Z|\\:\\.\\-_0-9]*(\\/|)"); int i = 0; MatchCollection Mcoll = Regex.Matches(webBrowser.SaveToString(), "src=\"[ a-z|A-Z|\\:\\/\\.\\-_0-9]*(.jpg|.png)"); string[] aux = new string[Mcoll.Count]; foreach (Match m in Mcoll) { if (!Regex.IsMatch(m.Value, "http://")) { aux[i] = host.ToString() + m.Value.Replace("src=\"", ""); aux[i] = aux[i].Replace("//", "/"); } else { aux[i] = m.Value.Replace("src=\"", ""); } i++; } ((System.Windows.Controls.Frame)this.Parent).DataContext = aux; NavigationService.Navigate(new Uri("/SaveImg.xaml?url=" + textBox.Text, UriKind.RelativeOrAbsolute)); }
private void YellowB_Click(object sender, RoutedEventArgs e) { WebBrowser browser1 = new WebBrowser(); browser1.Navigate(new Uri(AppResources.Server + "Card.aspx?Team=" + AppResources.TeamB + "&CardType=Yellow")); int loadbrowser = 0; while (browser1.SaveToString().Length < 1) { loadbrowser++; } string Data = browser1.SaveToString(); string[] RawHtmlSplit = Data.Split('`'); string DataNeeded = RawHtmlSplit[1]; if (DataNeeded.Contains("Success!")) { yellowB++; YellowBtxt.Text = String.Format("{0}", yellowB); } else MessageBox.Show("Action Failed"); }
private void stop_Click(object sender, RoutedEventArgs e) { WebBrowser browser1 = new WebBrowser(); //browser1.Source = new Uri("http://mc:1482/aspx?UserId=Iz001&MatchId=1"); browser1.Navigate(new Uri(AppResources.Server + "Stop.aspx?UserId=" + AppResources.UserID + "&MatchId=" + AppResources.GameId)); int loadbrowser = 0; while (browser1.SaveToString().Length < 1) { loadbrowser++; } string Data = browser1.SaveToString(); string[] RawHtmlSplit = Data.Split('`'); string DataNeeded = RawHtmlSplit[1]; string output = ""; if (!DataNeeded.Contains("Has Started")) { string[] MatchInfo = DataNeeded.Split(','); AppResources.TeamA = MatchInfo[1]; AppResources.TeamB = MatchInfo[2]; //AppResources.GameId = MatchInfo[3]; output = MatchInfo[0]; } else output = DataNeeded; Commands.Text = output; mytimer.Stop(); }
private void PopulateFixtures() { WebBrowser browser1 = new WebBrowser(); browser1.Navigate(new Uri(AppResources.Server + "Fixture.aspx")); int loadbrowser = 0; while (browser1.SaveToString().Length < 1) { loadbrowser++; } string Data = browser1.SaveToString(); string[] RawHtmlSplit = Data.Split('`'); string DataNeeded = RawHtmlSplit[1]; string[] fixes = DataNeeded.Split('|'); foreach (string fix in fixes) { if (fix.Length > 2) { string[] game = fix.Split(','); Fixture TGame = new Fixture(); TGame.idfixture = game[0]; TGame.TeamA = game[1]; TGame.TeamB = game[2]; Fixtures.Add(TGame); } } }