private void Propreties_SelectionChanged(object sender, SelectionChangedEventArgs e) { var PropCombo = (ComboBox)sender; String spec = PropCombo.SelectedValue as String; if (spec == null) spec = ""; Faculty FacultyDialog; bool? FacultyDialogResult = false; // If this spec already choosen foreach(Specialization Spec in Specs) { if(Spec != null && Spec.Spec.Equals(spec)) { MessageBox.Show("Одну и ту же специальность нельзя выбирать дважды", "Предупреждение", MessageBoxButton.OK, MessageBoxImage.Warning); PropCombo.SelectedItem = null; return; } } // If something choosen, select facs if (spec.Equals("")) return; else { FacultyDialog = new Faculty(spec); FacultyDialogResult = FacultyDialog.ShowDialog(); } if ((bool)FacultyDialogResult) { if (PropCombo.Name.Equals("ControlFirstPriority")) Specs[0] = new Specialization(spec, FacultyDialog.Output); else if (PropCombo.Name.Equals("ControlSecondPriority")) Specs[1] = new Specialization(spec, FacultyDialog.Output); else if (PropCombo.Name.Equals("ControlThirdPriority")) Specs[2] = new Specialization(spec, FacultyDialog.Output); } else PropCombo.SelectedItem = null; }
private void ControlMagistrSpec_SelectionChanged(object sender, SelectionChangedEventArgs e) { var PropCombo = (ComboBox)sender; String spec = PropCombo.SelectedValue as String; Faculty FacultyDialog; // If something choosen, select facs if (spec.Equals("")) return; else { FacultyDialog = new Faculty(spec); FacultyDialog.ShowDialog(); } if (PropCombo.Name.Equals("ControlMagistrSpec")) { Specs[0] = new Specialization(spec, FacultyDialog.Output); Specs[1] = null; Specs[2] = null; } }
private void Propreties_SelectionChanged(object sender, SelectionChangedEventArgs e) { var PropCombo = (ComboBox)sender; String spec = PropCombo.SelectedValue as String; // If something choosen, select facs if (spec.Equals("")) return; else { Faculty FacultyDialog = new Faculty(spec); FacultyDialog.ShowDialog(); } if (PropCombo.Name.Equals("ControlFirstPriority")) { } else if (PropCombo.Name.Equals("ControlSecondPriority")) { } else if (PropCombo.Name.Equals("ControlThirdPriority")) { } }