Skip to content

Commit c3ec002

Browse files
committed
Show message box to ask users to restart as administrator when encountering issue checking startup
1 parent 479b49d commit c3ec002

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Flow.Launcher/App.xaml.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,21 @@ private void AutoStartup()
240240
{
241241
Helper.AutoStartup.CheckIsEnabled(_settings.UseLogonTaskForStartup, _settings.AlwaysRunAsAdministrator);
242242
}
243+
catch (UnauthorizedAccessException)
244+
{
245+
// If it fails for permission, we need to ask the user to restart as administrator
246+
if (API.ShowMsgBox(
247+
API.GetTranslation("runAsAdministratorChangeAndRestart"),
248+
API.GetTranslation("runAsAdministratorChange"),
249+
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
250+
{
251+
RestartAppAsAdministrator();
252+
}
253+
}
243254
catch (Exception e)
244255
{
245-
// but if it fails (permissions, etc) then don't keep retrying
246-
// this also gives the user a visual indication in the Settings widget
256+
// But if it fails for other reasons then do not keep retrying,
257+
// set startup to false to give users a visual indication in the general page
247258
_settings.StartFlowLauncherOnSystemStartup = false;
248259
API.ShowMsg(API.GetTranslation("setAutoStartFailed"), e.Message);
249260
}

0 commit comments

Comments
 (0)