예제 #1
0
 public void AlarmRegular()
 {
     while (true)
     {
         foreach (TaskRegular t in ListRegular.Where(t => t.isActual == 1 && t.IsTick == true))
         {
             if (t.StartTime < System.DateTime.Now && t.DelimiterTime > System.DateTime.Now)
             {
                 PushStatus = 1;
                 Mediator.GetInstance().NotifyColleagues("StatusWaiting", PushStatus);
             }
             if (t.DelimiterTime < System.DateTime.Now && t.NextTime > System.DateTime.Now)
             {
                 PushStatus = 2;
                 Mediator.GetInstance().NotifyColleagues("StatusWaiting", PushStatus);
             }
             lock (locker)
             {
                 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();
                 }
                 Thread.Sleep(100);
             }
         }
         Thread.Sleep(3000);
     }
 }
예제 #2
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);
     }
 }