public CarteEvent(Evenement e) { InitializeComponent(); Regex r = new Regex(@"[^/\\]+$"); this.ev = e; this.eventTitle.Text = e.Title; this.eventDetails.Text = e.Description; this.eventPlace.Text = e.place; switch (e.DateDebut.Month) { case 1: this.eventDateDeb.Text = $"{e.DateDebut.Day} Janvier"; break; case 2: this.eventDateDeb.Text = $"{e.DateDebut.Day} Fevrier"; break; case 3: this.eventDateDeb.Text = $"{e.DateDebut.Day} Mars"; break; case 4: this.eventDateDeb.Text = $"{e.DateDebut.Day} Avril"; break; case 5: this.eventDateDeb.Text = $"{e.DateDebut.Day} May"; break; case 6: this.eventDateDeb.Text = $"{e.DateDebut.Day} Juin"; break; case 7: this.eventDateDeb.Text = $"{e.DateDebut.Day} Juillet"; break; case 8: this.eventDateDeb.Text = $"{e.DateDebut.Day} Août"; break; case 9: this.eventDateDeb.Text = $"{e.DateDebut.Day} Septembre"; break; case 10: this.eventDateDeb.Text = $"{e.DateDebut.Day} Octobre"; break; case 11: this.eventDateDeb.Text = $"{e.DateDebut.Day} Novembre"; break; case 12: this.eventDateDeb.Text = $"{e.DateDebut.Day} Decembre"; break; } switch (e.DateFin.Month) { case 1: this.eventDateDeb.Text = $"{e.DateFin.Day} Janvier"; break; case 2: this.eventDateFin.Text = $"{e.DateFin.Day} Fevrier"; break; case 3: this.eventDateFin.Text = $"{e.DateFin.Day} Mars"; break; case 4: this.eventDateFin.Text = $"{e.DateFin.Day} Avril"; break; case 5: this.eventDateFin.Text = $"{e.DateFin.Day} May"; break; case 6: this.eventDateFin.Text = $"{e.DateFin.Day} Juin"; break; case 7: this.eventDateFin.Text = $"{e.DateFin.Day} Juillet"; break; case 8: this.eventDateFin.Text = $"{e.DateFin.Day} Août"; break; case 9: this.eventDateFin.Text = $"{e.DateFin.Day} Septembre"; break; case 10: this.eventDateFin.Text = $"{e.DateFin.Day} Octobre"; break; case 11: this.eventDateFin.Text = $"{e.DateFin.Day} Novembre"; break; case 12: this.eventDateFin.Text = $"{e.DateFin.Day} Decembre"; break; } Dictionary <string, string> colorDict = new Dictionary <string, string>(); colorDict["Urgente"] = "#DDFF0707"; colorDict["Normale"] = "#FFEB3B"; colorDict["Basse"] = "#DD64CEFF"; this.priorityText.Text = e.Priority; this.priorityIndicator.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(colorDict[e.Priority])); try { documentText.Text = r.Match(e.Fichiers[0]).Value; alarmText.Text = e.Alarms[0].time.ToString(); } catch (Exception e1) { } event_activity_tag.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(DataSupervisor.ds.user.Activities[e.activite])); EventStateToggle.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(DataSupervisor.ds.user.Activities[e.activite])); eventPlace.Text = e.place; }
private void AddEvent(object sender, MouseButtonEventArgs e) { if (TextboxTitre.Text == "") { TextboxTitre.Focus(); } else if (TextBoxLieu.Text == "") { TextBoxLieu.Focus(); } else if (debutDatePicker.SelectedDate == null || finDatePicker.SelectedDate == null || Heure.SelectedTime == null) { MessageBox.Show("Veuillez choisir la date exacte"); return; } else if ((ComboBoxPriorite.SelectedIndex != 0) && (ComboBoxPriorite.SelectedIndex != 1) && (ComboBoxPriorite.SelectedIndex != 2)) { MessageBox.Show("Veuillez choisir la priorité"); } else if (((string)((ComboBoxItem)ComboBoxActivities.SelectedItem).DataContext) == "Activité scolaire" && DataSupervisor.ds.user.JoursFeries.Keys.Contains(debutDatePicker.SelectedDate.Value)) { MessageBox.Show("Le jour choisit est ferie"); } else { Evenement ev = new Evenement(); DateTime d = new DateTime(debutDatePicker.SelectedDate.Value.Year, debutDatePicker.SelectedDate.Value.Month, debutDatePicker.SelectedDate.Value.Day, Heure.SelectedTime.Value.Hour, Heure.SelectedTime.Value.Minute, Heure.SelectedTime.Value.Second); ev.DateDebut = d; ev.DateFin = finDatePicker.SelectedDate.Value; ev.Title = TextboxTitre.Text; ev.Description = TextBoxDescription.Text; ev.place = TextBoxLieu.Text; switch (cpt_files) { case 1: ev.Fichiers.Add((String)File1.Content); break; case 2: ev.Fichiers.Add((String)File1.ContentStringFormat); ev.Fichiers.Add((String)File2.ContentStringFormat); break; case 3: ev.Fichiers.Add((String)File1.ContentStringFormat); ev.Fichiers.Add((String)File2.ContentStringFormat); ev.Fichiers.Add((String)File3.ContentStringFormat); break; default: break; } switch (ComboBoxPriorite.SelectedIndex) { case 0: ev.Priority = "Urgente"; break; case 1: ev.Priority = "Normale"; break; case 2: ev.Priority = "Basse"; break; } ev.activite = (string)((ComboBoxItem)ComboBoxActivities.SelectedItem).DataContext; ev.Alarms = new List <Notif>(); foreach (Notif n in NotificationDict.Values) { ev.Alarms.Add(n); } DataSupervisor.ds.AddEvenement(ev); windowParent.Close(); } }