private void Team2EditClick(object sender, RoutedEventArgs e) { if (Score.CurrentOrEndedGame != null) { string text = Score.CurrentOrEndedGame.Team2Color; if (TextDialog.ShowTextDialog(this, "Enter Team 2 Colour", "Colour", ref text)) { Score.CurrentOrEndedGame.Team2Color = String.IsNullOrEmpty(text) ? null : text; } } }
public static bool ShowTextDialog(Window owner, string caption, string label, ref string text) { TextDialog textDialog = new TextDialog(caption, label, text) { Owner = owner }; if (textDialog.ShowDialog() == true) { text = textDialog.Text; return(true); } return(false); }