Пример #1
0
 public void AddTodo(Todo task)
 {
     task.Id = repo.CreateId();
     repo.Create(task);
     if (task.Notify == 1)
     {
         task.CreateNotification();
     }
     if (task.Notify == 2)
     {
         task.CreateAlarm();
     }
 }
Пример #2
0
 public void Postpone(Todo task)
 {
     using (var trans = _instance.BeginWrite())
     {
         task.Status = 1;
         trans.Commit();
     }
     if (task.Status != 1 || task.Status != 2)
     {
         if (task.Notify == 1)
         {
             task.CreateNotification();
         }
         if (task.Notify == 2)
         {
             task.CreateAlarm();
         }
     }
 }
Пример #3
0
        public static void UpdateNotification(this Todo item)
        {
            var toastnotifier = ToastNotificationManager.CreateToastNotifier();

            foreach (var scheduledToastNotification in toastnotifier.GetScheduledToastNotifications())
            {
                if (scheduledToastNotification.Id == item.Id)
                {
                    toastnotifier.RemoveFromSchedule(scheduledToastNotification);
                }
            }

            if (item.Notify == 1)
            {
                item.CreateNotification();
            }
            else if (item.Notify == 2)
            {
                item.CreateAlarm();
            }
        }
Пример #4
0
        public void Undone(Todo task)
        {
            using (var trans = _instance.BeginWrite())
            {
                task.Status = 2;
                trans.Commit();
            }

            if (task.StartTime > DateTimeOffset.Now)   //If else... the user should edit the time
            {
                if (task.Status != 2 || task.Status != 1)
                {
                    if (task.Notify == 1)
                    {
                        task.CreateNotification();
                    }
                    if (task.Notify == 2)
                    {
                        task.CreateAlarm();
                    }
                }
            }
        }