Skip to content

Commit 9764a99

Browse files
committed
show notification message when attempting to run an unsupported UWP app as admin
1 parent 6c7eab9 commit 9764a99

File tree

9 files changed

+17
-6
lines changed

9 files changed

+17
-6
lines changed

Plugins/Flow.Launcher.Plugin.Program/Languages/de.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@
3333

3434
<system:String x:Key="flowlauncher_plugin_program_plugin_name">Programm</system:String>
3535
<system:String x:Key="flowlauncher_plugin_program_plugin_description">Suche Programme mit Flow Launcher</system:String>
36+
<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>
3637

3738
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Program/Languages/en.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@
5353
<!--Dialogs-->
5454
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success">Success</system:String>
5555
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success_message">Successfully disabled this program from displaying in your query</system:String>
56+
<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>
5657

5758
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Program/Languages/ja.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@
3434

3535
<system:String x:Key="flowlauncher_plugin_program_plugin_name">Program</system:String>
3636
<system:String x:Key="flowlauncher_plugin_program_plugin_description">Search programs in Flow Launcher</system:String>
37+
<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>
3738

3839
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Program/Languages/pl.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@
3333

3434
<system:String x:Key="flowlauncher_plugin_program_plugin_name">Programy</system:String>
3535
<system:String x:Key="flowlauncher_plugin_program_plugin_description">Szukaj i uruchamiaj programy z poziomu Flow Launchera</system:String>
36+
<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>
3637

3738
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Program/Languages/sk.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@
5353
<!--Dialogs-->
5454
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success">Úspešné</system:String>
5555
<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>
56+
<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>
5657

5758
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Program/Languages/tr.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,6 @@
3535
<system:String x:Key="flowlauncher_plugin_program_plugin_description">Programları Flow Launcher'tan arayın</system:String>
3636

3737
<system:String x:Key="flowlauncher_plugin_program_invalid_path">Geçersiz Konum</system:String>
38+
<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>
3839

3940
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Program/Languages/zh-cn.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,6 @@
5050
<!--Dialogs-->
5151
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success">完成</system:String>
5252
<system:String x:Key="flowlauncher_plugin_program_disable_dlgtitle_success_message">成功禁用了该程序以使其无法显示在查询中</system:String>
53+
<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>
5354

5455
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Program/Languages/zh-tw.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@
3333

3434
<system:String x:Key="flowlauncher_plugin_program_plugin_name">程式</system:String>
3535
<system:String x:Key="flowlauncher_plugin_program_plugin_description">在 Flow Launcher 中搜尋程式</system:String>
36+
<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>
37+
3638
</ResourceDictionary>

Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,18 +328,20 @@ public Result Result(string query, IPublicAPI api)
328328
!e.SpecialKeyState.WinPressed
329329
);
330330

331-
if (elevated)
331+
if (elevated && CanRunElevated)
332332
{
333-
if (!CanRunElevated)
334-
{
335-
return false;
336-
}
337-
338333
LaunchElevated();
339334
}
340335
else
341336
{
342337
Launch(api);
338+
339+
if (elevated)
340+
{
341+
var title = "Plugin: Program";
342+
var message = api.GetTranslation("flowlauncher_plugin_program_run_as_administrator_not_supported_message");
343+
api.ShowMsg(title, message, string.Empty);
344+
}
343345
}
344346

345347
return true;

0 commit comments

Comments
 (0)