Example #1
0
 void DeleteTask()
 {
     dc.DeleteTask(SelectedTask);
     if (SelectedTask.GetType() == typeof(TaskOneTime))
     {
         ListOneTime.Remove((TaskOneTime)SelectedTask);
         return;
     }
     if (SelectedTask.GetType() == typeof(TaskRegular))
     {
         ListRegular.Remove((TaskRegular)SelectedTask);
     }
 }
Example #2
0
 void AddTaskToList()
 {
     if (SelectedTask.GetType() == typeof(TaskRegular))
     {
         if (((TaskRegular)SelectedTask).id == 0)
         {
             int id = ListRegular.Max(t => t.id) + 1;
             ((TaskRegular)SelectedTask).id = id;
             ListRegular.Add((TaskRegular)SelectedTask);
         }
     }
     if (SelectedTask.GetType() == typeof(TaskOneTime))
     {
         if (((TaskOneTime)SelectedTask).id == 0)
         {
             int id = ListRegular.Max(t => t.id) + 1;
             ((TaskOneTime)SelectedTask).id = id;
             ListOneTime.Add((TaskOneTime)SelectedTask);
         }
     }
 }
Example #3
0
 public void AlarmOneTime()
 {
     while (true)
     {
         foreach (TaskOneTime t in ListOneTime.Where(t => t.isActual == 1))
         {
             if (t.signalDate < System.DateTime.Now)
             {
                 t.isActual = 0;
                 Mediator.GetInstance().Register("ModalDialogPrepared", PushTheValue);
                 Mediator.GetInstance().Register("CloseAlarmer", CloseAlarmer);
                 if (Alarmed == null)
                 {
                     Alarmed = new List <string>();
                     Alarmed.Add(t.name);
                 }
                 else
                 {
                     Alarmed.Add(t.name);
                 }
                 ViewModelBase A = new AlarmViewModel();
                 if (!WindowManager.GetInstance().IsNavigationItemExist(A))
                 {
                     Thread thread = new Thread(() =>
                     {
                         WindowManager.GetInstance().ShowModalDialogHard(A);
                     });
                     thread.SetApartmentState(ApartmentState.STA);
                     thread.IsBackground = true;
                     thread.Start();
                 }
                 //System.Windows.Threading.Dispatcher.Run();
             }
         }
         Thread.Sleep(3000);
     }
 }