private void btnSubmit_Click(object sender, RoutedEventArgs e) { //validate name string strName = txtName.Text; if (strName.Length > 40) { MessageBox.Show("Name cannot be more that 40 character", "Error", MessageBoxButton.OK); return; } if (!(Regex.IsMatch(strName, "^([ \u00c0-\u01ffa-zA-Z'])+$"))) { MessageBox.Show("Please enter valid Name", "Error", MessageBoxButton.OK); return; } media.Play(); StaticData.Name = Message; MathPadServicesClient objScore = new MathPadServicesClient(); objScore.GetTopScoreCompleted += new EventHandler <GetTopScoreCompletedEventArgs>(obj_GetTopScoreCompleted); objScore.GetTopScoreAsync(); MathPadServicesClient objSvc = new MathPadServicesClient(); objSvc.AddHallofFameAsync(StaticData.Name, int.Parse(StaticData.Points), int.Parse(StaticData.Time), StaticData.Category); this.Visibility = Visibility.Collapsed; }
//private void Image_ImageFailed(object sender, ExceptionRoutedEventArgs e) //{ // Holder holder = this.Parent as Holder; // holder.Navigate(new HelpPage()); //} private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (Level.Content.ToString() == "10") { //Check for Top Score //int TpScore = 0; MathPadServicesClient objScore = new MathPadServicesClient(); objScore.GetTopScoreCompleted += new EventHandler <GetTopScoreCompletedEventArgs>(obj_GetTopScoreCompleted); objScore.GetTopScoreAsync(); image1.Visibility = System.Windows.Visibility.Visible; txtHallOfFame.Text = "You have entered HALL OF FAME"; txtHallOfFame.Visibility = System.Windows.Visibility.Visible; Popup p = new Popup(); PopupEx obj = new PopupEx(); p.Child = obj; // Set where the popup will show up on the screen. p.VerticalOffset = 200; p.HorizontalOffset = 200; // StaticData.Data = "0"; // Open the popup. p.IsOpen = true; // MathPadServicesClient objSvc = new MathPadServicesClient(); // objSvc.AddHallofFameAsync(StaticData.Data, int.Parse(Score.Content.ToString()), int.Parse(Time.Content.ToString()), strCategory); } else { image1.Visibility = System.Windows.Visibility.Collapsed; txtHallOfFame.Text = ""; } }