示例#1
0
 private void BackImplementation(object obj)
 {
     if (Application.Current.Dispatcher != null)
     {
         Application.Current.Dispatcher.Invoke(new Action(() =>
         {
             _tokenSource.Cancel();
             _workingThread.Abort();
             NavigationManager.Instance.Navigate(ViewType.AlarmClockList);
             AlarmClockListViewModel.StartWorkingThread();
         }));
     }
 }
示例#2
0
        private static void WorkingThreadProcess()
        {
            DateTime end = DateTime.Now.AddMinutes(2);

            while (!_token.IsCancellationRequested && end > DateTime.Now)
            {
                Thread.Sleep(1000);
            }
            if (Application.Current.Dispatcher != null)
            {
                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    _tokenSource.Cancel();
                    _workingThread.Abort();
                    NavigationManager.Instance.Navigate(ViewType.AlarmClockList);
                    AlarmClockListViewModel.StartWorkingThread();
                }));
            }
        }