Skip to content

Commit

Permalink
Merge pull request #69 from microsoft/jschick/provider_import_reboot
Browse files Browse the repository at this point in the history
Added confirmation for reboot when importing providers
  • Loading branch information
bill-long authored May 19, 2023
2 parents c72e8a1 + fa05b38 commit a5f5508
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/EventLogExpert/Shared/Components/SettingsModal.razor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// // Copyright (c) Microsoft Corporation.
// // Licensed under the MIT License.

using EventLogExpert.Library.Helpers;
using EventLogExpert.Library.Models;
using EventLogExpert.Store.Settings;
using Microsoft.AspNetCore.Components;
Expand Down Expand Up @@ -57,7 +58,19 @@ private async void ImportProvider()
{ // TODO: Log Error
}

Dispatcher.Dispatch(new SettingsAction.LoadProviders(Utils.DatabasePath));
bool answer = await Application.Current.MainPage.DisplayAlert("Reboot Required",
"In order to use these providers, a restart of the application is required. Would you like to restart now?",
"Yes", "No");

if (!answer)
{
Dispatcher.Dispatch(new SettingsAction.LoadProviders(Utils.DatabasePath));
return;
}

uint res = NativeMethods.RegisterApplicationRestart(null, NativeMethods.RestartFlags.NONE);

if (res == 0) { Application.Current.Quit(); }
}

private void Load(SettingsAction.OpenMenu action) => _request.TimeZoneId = SettingsState.Value.TimeZoneId;
Expand Down

0 comments on commit a5f5508

Please sign in to comment.