private void Valider_Click(object sender, RoutedEventArgs e) { if (ComboDays.SelectedItem == null || ComboHours.SelectedItem == null || ComboDuree.SelectedItem == null) { return; } string day = ComboDays.SelectedItem as string; Days dayChoosed = GetDayByStr(day); HourModel hour = ComboHours.SelectedItem as HourModel; DureeModel duree = ComboDuree.SelectedItem as DureeModel; string libelleAffiche = TxtBoxLibelle.Text; Creneau creneauChoosed = new Creneau() { Activite = DataManager.Instance.ActiviteChoosed, Classe = CurrentClasse, Jour = dayChoosed, Duree = duree, Hour = hour, Column = ColumnSpanType.Full, LibelleAffiche = string.IsNullOrEmpty(libelleAffiche) ? CurrentClasse.Libelle : libelleAffiche, ConflitCreneauId = 0 }; CreneauChoosed?.Invoke(this, creneauChoosed); }
private void Valider_Click(object sender, RoutedEventArgs e) { if (ComboDays.SelectedItem == null || ComboHours.SelectedItem == null || ComboDuree.SelectedItem == null || string.IsNullOrEmpty(TxtBoxLibelle.Text) || LstClasses.SelectedItems.Count == 0) { return; } string day = ComboDays.SelectedItem as string; Days dayChoosed = GetDayByStr(day); HourModel hour = ComboHours.SelectedItem as HourModel; DureeModel duree = ComboDuree.SelectedItem as DureeModel; string libelleAffiche = TxtBoxLibelle.Text; List <Classe> lstClasse = new List <Classe>(); lstClasse.AddRange(LstClasses.SelectedItems.Cast <Classe>()); Creneau creneauChoosed = new Creneau() { Activite = DataManager.Instance.ActiviteChoosed, //Classe = CurrentClasse, ListClass_Custom = lstClasse, Jour = dayChoosed, Duree = duree, Hour = hour, Column = ColumnSpanType.Full, LibelleAffiche = libelleAffiche, ConflitCreneauId = 0 }; LstClasses.SelectedItem = null; CreneauChoosed?.Invoke(this, creneauChoosed); }