Ejemplo n.º 1
0
        private void ButtonAddEvent_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Evenement ev = new Evenement();

            if (debutDatePicker.SelectedDate == null)
            {
                MessageBox.Show("Please select a day");
                return;
            }
            ev.DateDebut   = debutDatePicker.SelectedDate.Value;
            ev.Title       = TextboxTitre.Text;
            ev.Description = TextBoxDescription.Text;
            DataSupervisor.ds.AddEvenement(ev);

            windowParent.Close();
        }
Ejemplo n.º 2
0
 private void bouttonAnnulerAddContact_Click(object sender, RoutedEventArgs e)
 {
     windowFather.Close();
 }
        //On crée une nouvelle activité
        private void ButtonAddActivity_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            string Activityname = TextBoxActivityname.Text;

            if (Activityname.Length == 0)
            {   //Envoyez une notification
                MessageBox.Show("Activityname is empty");

                //Concentrez sur ce textbox
                TextBoxActivityname.Focus();
                return;
            }

            // TODO : Disable already used activities


            string Activitycolor = "#ffffff";

            if (ComboitemCouleur0.IsSelected == true)
            {
                Activitycolor = "#7FFFD4";
                ComboboxActivitycolor.Items.Remove(ComboitemCouleur0); // il faut supprimer la couleur choisi de la liste
            }
            else if (ComboitemCouleur1.IsSelected)
            {
                Activitycolor = "#B0C4DE";
                ComboitemCouleur1.IsEnabled = true;
            }
            else if (ComboitemCouleur2.IsSelected)
            {
                Activitycolor = "#87CEFA";
                ComboitemCouleur2.IsEnabled = false;
            }
            else if (ComboitemCouleur3.IsSelected)
            {
                Activitycolor = "#8A2BE2";
                ComboitemCouleur3.IsEnabled = false;
            }
            else if (ComboitemCouleur4.IsSelected)
            {
                Activitycolor = "#FFD700";
                ComboitemCouleur4.IsEnabled = false;
            }
            else if (ComboitemCouleur5.IsSelected)
            {
                Activitycolor = "#32CD32";
                ComboitemCouleur5.IsEnabled = false;
            }
            else if (ComboitemCouleur6.IsSelected)
            {
                Activitycolor = "#DC143C";
                ComboitemCouleur6.IsEnabled = false;
            }
            else if (ComboitemCouleur7.IsSelected)
            {
                Activitycolor = "#FFA500";
                ComboitemCouleur7.IsEnabled = false;
            }
            else if (ComboitemCouleur8.IsSelected)
            {
                Activitycolor = "#FFE4B5";
                ComboitemCouleur8.IsEnabled = false;
            }
            else if (ComboitemCouleur9.IsSelected)
            {
                Activitycolor = "#FF7F50";
                ComboitemCouleur9.IsEnabled = false;
            }

            //l'instruction ci-dessous est pour supprimer une couleur qui représente déja une autre activité
            //ComboboxActivitycolor.Items.RemoveAt(0); // This instruction delete the item 0 from the combobox
            // By Nedjima : Add activitie and close the activities Form
            DataSupervisor.ds.user.Activities.Add(Activityname, Activitycolor);
            windowFather.Close();
        }
Ejemplo n.º 4
0
 private void ButtonCancel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     windowParent.Close();
 }
Ejemplo n.º 5
0
        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();
            }
        }