show notification message when attempting to run an unsupported UWP app as admin

This commit is contained in:
Michael Mouawad 2021-09-11 21:01:48 +03:00
parent 6c7eab9c50
commit 9764a99d26
9 changed files with 17 additions and 6 deletions

View file

@ -33,5 +33,6 @@
<system:String x:Key="flowlauncher_plugin_program_plugin_name">Programm</system:String>
<system:String x:Key="flowlauncher_plugin_program_plugin_description">Suche Programme mit Flow Launcher</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
</ResourceDictionary>

View file

@ -53,5 +53,6 @@
<!--Dialogs-->
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success">Success</system:String>
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success_message">Successfully disabled this program from displaying in your query</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
</ResourceDictionary>

View file

@ -34,5 +34,6 @@
<system:String x:Key="flowlauncher_plugin_program_plugin_name">Program</system:String>
<system:String x:Key="flowlauncher_plugin_program_plugin_description">Search programs in Flow Launcher</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
</ResourceDictionary>

View file

@ -33,5 +33,6 @@
<system:String x:Key="flowlauncher_plugin_program_plugin_name">Programy</system:String>
<system:String x:Key="flowlauncher_plugin_program_plugin_description">Szukaj i uruchamiaj programy z poziomu Flow Launchera</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
</ResourceDictionary>

View file

@ -53,5 +53,6 @@
<!--Dialogs-->
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success">Úspešné</system:String>
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success_message">Úspešne zakázané zobrazovanie tohto programu vo výsledkoch vyhľadávania</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
</ResourceDictionary>

View file

@ -35,5 +35,6 @@
<system:String x:Key="flowlauncher_plugin_program_plugin_description">Programları Flow Launcher'tan arayın</system:String>
<system:String x:Key="flowlauncher_plugin_program_invalid_path">Geçersiz Konum</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
</ResourceDictionary>

View file

@ -50,5 +50,6 @@
<!--Dialogs-->
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success">完成</system:String>
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success_message">成功禁用了该程序以使其无法显示在查询中</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
</ResourceDictionary>

View file

@ -33,4 +33,6 @@
<system:String x:Key="flowlauncher_plugin_program_plugin_name">程式</system:String>
<system:String x:Key="flowlauncher_plugin_program_plugin_description">在 Flow Launcher 中搜尋程式</system:String>
<system:String x:Key="flowlauncher_plugin_program_run_as_administrator_not_supported_message">This app is not intended to be run as administrator</system:String>
</ResourceDictionary>

View file

@ -328,18 +328,20 @@ namespace Flow.Launcher.Plugin.Program.Programs
!e.SpecialKeyState.WinPressed
);
if (elevated)
if (elevated && CanRunElevated)
{
if (!CanRunElevated)
{
return false;
}
LaunchElevated();
}
else
{
Launch(api);
if (elevated)
{
var title = "Plugin: Program";
var message = api.GetTranslation("flowlauncher_plugin_program_run_as_administrator_not_supported_message");
api.ShowMsg(title, message, string.Empty);
}
}
return true;