mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
show run as administrator in title (#28516)
This commit is contained in:
committed by
GitHub
parent
baa7c7bc6c
commit
b01a995062
@@ -3,6 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using EnvironmentVariables.Helpers;
|
||||
using EnvironmentVariables.ViewModels;
|
||||
using ManagedCommon;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -42,6 +43,7 @@ namespace EnvironmentVariables
|
||||
|
||||
Host = Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder().UseContentRoot(AppContext.BaseDirectory).ConfigureServices((context, services) =>
|
||||
{
|
||||
services.AddSingleton<IElevationHelper, ElevationHelper>();
|
||||
services.AddTransient<MainViewModel>();
|
||||
}).Build();
|
||||
|
||||
|
||||
@@ -41,8 +41,7 @@
|
||||
x:Name="AppTitleTextBlock"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="Environment Variables" />
|
||||
Style="{StaticResource CaptionTextBlockStyle}" />
|
||||
</Grid>
|
||||
|
||||
<views:MainPage Grid.Row="1" />
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using EnvironmentVariables.Helpers;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using WinUIEx;
|
||||
|
||||
namespace EnvironmentVariables
|
||||
@@ -22,7 +20,10 @@ namespace EnvironmentVariables
|
||||
SetTitleBar(titleBar);
|
||||
|
||||
AppWindow.SetIcon("Assets/EnvironmentVariables/EnvironmentVariables.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +140,7 @@
|
||||
</data>
|
||||
<data name="WindowTitle" xml:space="preserve">
|
||||
<value>Environment Variables</value>
|
||||
<comment>Title of the window when running as user</comment>
|
||||
</data>
|
||||
<data name="EditDialog.CloseButtonText" xml:space="preserve">
|
||||
<value>Cancel</value>
|
||||
@@ -165,4 +166,8 @@
|
||||
<data name="Enabled.Header" xml:space="preserve">
|
||||
<value>Enabled</value>
|
||||
</data>
|
||||
<data name="WindowAdminTitle" xml:space="preserve">
|
||||
<value>Administrator: Environment Variables</value>
|
||||
<comment>Title of the window when running as administrator</comment>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user