[General]Display in titlebar/tray if running as admin (#28425)

* display in titlebar if running as admin

* show run as admin in tray tooltip
This commit is contained in:
Davide Giacometti
2023-09-12 12:11:26 +02:00
committed by GitHub
parent 63975600f1
commit ebd051ff61
17 changed files with 75 additions and 24 deletions

View File

@@ -37,8 +37,7 @@
x:Name="AppTitleTextBlock"
Grid.Column="2"
Style="{StaticResource CaptionTextBlockStyle}"
VerticalAlignment="Center"
Text="Hosts File Editor" />
VerticalAlignment="Center" />
</Grid>
<views:MainPage Grid.Row="1" />

View File

@@ -2,7 +2,6 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Hosts.Helpers;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
@@ -19,7 +18,11 @@ namespace Hosts
ExtendsContentIntoTitleBar = true;
SetTitleBar(titleBar);
AppWindow.SetIcon("Assets/Hosts/Hosts.ico");
Title = ResourceLoaderInstance.ResourceLoader.GetString("WindowTitle");
var loader = ResourceLoaderInstance.ResourceLoader;
var title = App.GetService<IElevationHelper>().IsElevated ? loader.GetString("WindowAdminTitle") : loader.GetString("WindowTitle");
Title = title;
AppTitleTextBlock.Text = title;
BringToForeground();

View File

@@ -307,8 +307,12 @@
<data name="WarningDialog_Title" xml:space="preserve">
<value>Warning</value>
</data>
<data name="WindowAdminTitle" xml:space="preserve">
<value>Administrator: Hosts File Editor</value>
<comment>Title of the window when running as administrator. "Hosts File Editor" is the name of the utility. "Hosts" refers to the system hosts file, do not loc</comment>
</data>
<data name="WindowTitle" xml:space="preserve">
<value>Hosts File Editor</value>
<comment>"Hosts File Editor" is the name of the utility. "Hosts" refers to the system hosts file, do not loc</comment>
<comment>Title of the window when running as user. "Hosts File Editor" is the name of the utility. "Hosts" refers to the system hosts file, do not loc</comment>
</data>
</root>