Пример #1
0
        /**
         * Fonction qui permet de supprimer une tâche de la liste
         **/

        private async void delSomething(object parameter)
        {
            if (SelectedModel != null)
            {
                MessageDialog showDialog = new MessageDialog("Etês-vous certain de vouloir supprimer cette tâche : " + SelectedModel.title + " ?");
                showDialog.Commands.Add(new UICommand("Oui")
                {
                    Id = 0
                });
                showDialog.Commands.Add(new UICommand("Non")
                {
                    Id = 1
                });
                showDialog.DefaultCommandIndex = 0;
                showDialog.CancelCommandIndex  = 1;
                var result = await showDialog.ShowAsync();

                if ((int)result.Id == 0)
                {
                    if (SelectedModel != null)
                    {
                        ListTasks.Remove(SelectedModel);
                        NotifyPropertyChanged("ListTasks");
                    }
                }
            }
            else
            {
                MessageDialog showDialog = new MessageDialog("Pas de tâche à supprimer.");
                var           result     = await showDialog.ShowAsync();
            }
        }
Пример #2
0
        private async void ValidateDelete(object sender)
        {
            MessageDialog showDialog = new MessageDialog("Etes vous sur de vouloir supprimer cette tache : " + SelectedTask.title + " ?");

            showDialog.Commands.Add(new UICommand("Oui")
            {
                Id = 0
            });
            showDialog.Commands.Add(new UICommand("Non")
            {
                Id = 1
            });
            showDialog.DefaultCommandIndex = 0;
            showDialog.CancelCommandIndex  = 1;
            var result = await showDialog.ShowAsync();

            if ((int)result.Id == 0)
            {
                if (SelectedTask != null)
                {
                    ListTasks.Remove(SelectedTask);
                    NotifyPropertyChanged("ListTasks");
                }
            }
        }
Пример #3
0
        /**
         * Fonction qui permet d'éditer une tâche de la liste
         **/

        public void EditTask(object parameter)
        {
            if (NewTask.title == "" || NewTask.title == null || NewTask.content == "" || NewTask.content == null)
            {
                dialogErrorAdd();
            }
            else
            {
                ListTasks.Add(NewTask);
                ListTasks.Remove(SelectedModel);
                NotifyPropertyChanged("ListTasks");
                NewTask        = new Model.Tasks();
                NewTaskTitle   = null;
                NewTaskContent = null;
                NewTaskDate    = DateTime.Today;
            }
        }