private void nontButton_Click(object sender, RoutedEventArgs e) { try { this.Cursor = Cursors.Wait; if (String.IsNullOrEmpty(ControlName)) { MessageBox.Show("You must choose a valid control name", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } symboltype = VADG.Global.SymbolType.Nonterminal; confirmChange = true; // distance! if (ControlName.Length >= 4 && !symbolNames.Contains(ControlName)) { // new nont with length >= 4 String suggestion = VADG.Global.LevenshteinDistanceCalculator.suggest(ControlName, symbolNames); if (suggestion != null) { MessageBoxResult result = MessageBox.Show("Did you mean: '" + suggestion + "'?", "Suggestion", MessageBoxButton.YesNoCancel, MessageBoxImage.Question); if (result == MessageBoxResult.Cancel) return; if (result == MessageBoxResult.Yes) ControlName = suggestion; } } this.Close(); } finally { this.Cursor = Cursors.Arrow; } }
private void terminalButton_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrEmpty(ControlName)) { MessageBox.Show("You must choose a valid control name", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } symboltype = VADG.Global.SymbolType.Terminal; confirmChange = true; this.Close(); }