/// <summary> /// Restarts the application. /// </summary> private async void RestartApplication() { var result = PresentationManager.ShowMessage(new MessageBoxInfo { Button = MessageBoxButton.OKCancel, Caption = "Restart Media Browser Theater", Icon = MessageBoxIcon.Information, Text = "Please restart to finish updating Media Browser Theater." }); if (result != MessageBoxResult.OK) { return; } try { await AppHost.Restart(); } catch (Exception ex) { Logger.ErrorException("Error restarting application.", ex); PresentationManager.ShowDefaultErrorMessage(); } }
/// <summary> /// Returns the task to be executed /// </summary> /// <param name="cancellationToken">The cancellation token.</param> /// <param name="progress">The progress.</param> /// <returns>Task.</returns> public async Task Execute(CancellationToken cancellationToken, IProgress <double> progress) { Logger.Info("Re-starting server as requested/scheduled..."); progress.Report(100); // Don't await this so that we will finish before the restart and not get reported as aborted AppHost.Restart(); }
void BtnRestart_Click(object sender, RoutedEventArgs e) { _appHost.Restart(); }