Exemple #1
0
        private async void CheckboxCheckChanged(object sender, EventArgs e)
        {
            CheckBox checkBox = sender as CheckBox;
            TaskToDo task     = (from itm in tasks.Items
                                 where itm.Id == Convert.ToInt32(checkBox.Text)
                                 select itm).FirstOrDefault <TaskToDo>();
            Grid grid = checkBox.Parent as Grid;

            if (Settings.EnableAnimations)
            {
                #pragma warning disable CS4014
                grid.FadeTo(0.3, 100);
                #pragma warning restore CS4014
                await grid.ScaleTo(0.9, 100, Easing.SinIn);
            }
            trash.Add(task);
            trashIndex.Add(tasks.Items.IndexOf(task));
            if (trash.Count > Settings.ToDoListTrashSize)
            {
                trash.RemoveAt(0);
                trashIndex.RemoveAt(0);
            }
            tasks.Items.Remove(task);
            UndoLayout.IsVisible = true;
            if (Settings.EnableAnimations)
            {
                await UndoLayout.FadeTo(1, 100);
            }
            else
            {
                UndoLayout.Opacity = 1;
            }
        }
Exemple #2
0
 private async void UndoButtonClicked(object sender, EventArgs e)
 {
     if (trash.Count > 0)
     {
         TaskToDo taskToRestore = trash.Last();
         int      removingIndex = trashIndex.Last();
         restoringId = taskToRestore.Id;
         trash.RemoveAt(trash.Count - 1);
         trashIndex.RemoveAt(trashIndex.Count - 1);
         tasks.Items.Insert(removingIndex, taskToRestore);
         if (trash.Count == 0)
         {
             if (Settings.EnableAnimations)
             {
                 await UndoLayout.FadeTo(0, 100);
             }
             UndoLayout.IsVisible = false;
         }
     }
 }