private void BT_Validate_Click(object sender, RoutedEventArgs e) { string name = this.TB_Name.Text; double coeff = this.NUD_Coeff.Value; Color color = this.colorDialog.Color; if (!string.IsNullOrEmpty(name)) { Subject subject = new Subject(name, (float)coeff, color); SettingsManager.AddSubject(subject); this.DialogResult = true; } else { System.Windows.MessageBox.Show("Saisissez le nom de la matière !", "Agenda - Virtuel", MessageBoxButton.OK, MessageBoxImage.Information); this.TB_Name.Focus(); } }