Пример #1
0
            protected override async Task Handle(Request request, CancellationToken cancellationToken)
            {
                if (request.Cancel)
                {
                    _logger.LogWarning("Shutdown has been canceled.");
                    return;
                }

                _logger.LogInformation("Shutting down AnyStatus...");

                _sysTray.Dispose();

                await _jobScheduler.StopAsync(cancellationToken);

                await _mediator.Send(new SaveSession.Request());

                await _mediator.Send(new SaveUserSettings.Request());

                _telemetry.TrackEvent("Shutdown");

                _dispatcher.Invoke(() =>
                {
                    foreach (Window window in Application.Current.Windows)
                    {
                        window.Close();
                    }

                    Application.Current.Shutdown();
                });
            }
Пример #2
0
            protected override async Task Handle(Request request, CancellationToken cancellationToken)
            {
                if (request.Cancel)
                {
                    _logger.LogDebug("Shutdown has been canceled.");

                    return;
                }

                _logger.LogDebug("Shutting down AnyStatus...");

                _telemetry.TrackEvent("Shutdown");

                await _mediator.Send(new CloseAllWindows.Request(), cancellationToken).ConfigureAwait(false);

                await _mediator.Send(new StopScheduler.Request(), cancellationToken).ConfigureAwait(false);

                await _mediator.Send(new SaveContext.Request(), cancellationToken).ConfigureAwait(false);

                _sysTray.Dispose();

                _dispatcher.Invoke(Application.Current.Shutdown);
            }