Exemple #1
0
        private void Terminate()
        {
            _kataFilesMonitor?.Stop();
            _playerNotifier?.Dispose();
            _updateProcess?.Stop();
            _gameMonitor?.Dispose();
            _reminderTimer?.Stop();
            _monitorTimer?.Stop();

            var mainWindow = Current.MainWindow;

            mainWindow?.Close();
        }
Exemple #2
0
        private void ExitApplication()
        {
            var shutDownActions = new Action[]
            {
                () => _kataFilesMonitor?.Stop(),
                () => _playerNotifier?.Dispose(),
                () => _gameMonitor?.Dispose(),
                () => _reminderTimer?.Stop(),
                () => _monitorTimer?.Stop(),
            };
            var cancellationTokenSource = new CancellationTokenSource(5000);
            var tasks = shutDownActions
                        .Select(action => Task.Run(() => TryDo(action), cancellationTokenSource.Token))
                        .ToArray();

            Task.WaitAll(tasks);

            System.Windows.Application.Current.Shutdown();
        }