/// <summary> /// Invoked when the user selects the "Extract Local Variable" command /// </summary> private void ExtractLocalVariableClicked(Object sender, EventArgs e) { try { var command = new ExtractLocalVariableCommand(); command.Execute(); } catch (Exception ex) { ErrorManager.ShowError(ex); } }
/// <summary> /// Invoked when the user selects the "Extract Local Variable" command /// </summary> private void ExtractLocalVariableClicked(Object sender, EventArgs e) { try { String suggestion = "newVar"; String label = TextHelper.GetString("Label.NewName"); String title = TextHelper.GetString("Title.ExtractLocalVariableDialog"); LineEntryDialog askName = new LineEntryDialog(title, label, suggestion); DialogResult choice = askName.ShowDialog(); if (choice == DialogResult.OK && askName.Line.Trim().Length > 0 && askName.Line.Trim() != suggestion) { suggestion = askName.Line.Trim(); } if (choice == DialogResult.OK) { ExtractLocalVariableCommand command = new ExtractLocalVariableCommand(suggestion); command.Execute(); } } catch (Exception ex) { ErrorManager.ShowError(ex); } }