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(); })); } }
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(); })); } }