// ============================================ // text box validation handler // ============================================ private void HandleMetFileNumberLostFocus(object sender, RoutedEventArgs e) { Int32 bongo = Convert.ToInt32(MetFileNumber.Text); if (bongo < 1 || bongo > 10) { string messageBoxText = "The number of met files must be between 1 and 10. Resetting to the default value of 1 ..."; MessageBox.Show(messageBoxText, "Oops!", MessageBoxButton.OK, MessageBoxImage.Error); MetFileNumber.Text = "1"; bongo = 1; } // the trick here is we only want to display the met file input page if one of two scenarios has happened - // * this is the first time the scenario page has been displayed and the met file number loses focus // * or the number of met files changes if (previousMetFileNumber != bongo) { MessageBox.Show("Switching to the Met File Name Input Screen ..."); MetfilePage metfileInputPage = new MetfilePage(this); this.NavigationService.Navigate(metfileInputPage); } previousMetFileNumber = bongo; }
private void MetFileNameMenuClick(object sender, RoutedEventArgs e) { MetfilePage metfileInputPage = new MetfilePage(this); this.NavigationService.Navigate(metfileInputPage); }