Exemple #1
0
        private void ReturnToAlarms(object obj)
        {
            if (Application.Current.Dispatcher != null)
            {
                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    _tokenSource.Cancel();
                    _workingThread.Abort();


                    NavigationManager.Instance.Navigate(ViewType.Alarms);
                    AlarmsViewModel.StartWorkingThread();
                }));
            }
        }
Exemple #2
0
        private static void StartWorkingThreadProcess()
        {
            DateTime stop = DateTime.Now.AddMinutes(2);

            while (!_token.IsCancellationRequested && stop > DateTime.Now)
            {
                Thread.Sleep(1000);
            }


            if (Application.Current.Dispatcher != null)
            {
                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    _tokenSource.Cancel();
                    _workingThread.Abort();


                    NavigationManager.Instance.Navigate(ViewType.Alarms);
                    AlarmsViewModel.StartWorkingThread();
                }));
            }
        }