mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 04:37:30 +02:00
FileLocksmith UI (#27263)
* FileLocksmith * Titlebar updates * titlebar text color * titlebar text color * Titlebar updates center * titlebar code * fix ContentDialog * Adress feedback
This commit is contained in:
@@ -31,7 +31,6 @@
|
|||||||
<Setter Property="Width" Value="36" />
|
<Setter Property="Width" Value="36" />
|
||||||
<Setter Property="Padding" Value="0" />
|
<Setter Property="Padding" Value="0" />
|
||||||
<Setter Property="Height" Value="36" />
|
<Setter Property="Height" Value="36" />
|
||||||
<Setter Property="Padding" Value="{StaticResource ButtonPadding}" />
|
|
||||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||||
<Setter Property="VerticalAlignment" Value="Center" />
|
<Setter Property="VerticalAlignment" Value="Center" />
|
||||||
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}" />
|
||||||
|
|||||||
@@ -16,24 +16,35 @@
|
|||||||
<Window.SystemBackdrop>
|
<Window.SystemBackdrop>
|
||||||
<MicaBackdrop />
|
<MicaBackdrop />
|
||||||
</Window.SystemBackdrop>
|
</Window.SystemBackdrop>
|
||||||
<Grid>
|
<Grid RowSpacing="16">
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="32" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid x:Name="titleBar">
|
<Grid x:Name="AppTitleBar"
|
||||||
<StackPanel
|
Height="32"
|
||||||
Margin="16,8,8,8"
|
ColumnSpacing="16">
|
||||||
VerticalAlignment="Top"
|
<Grid.ColumnDefinitions>
|
||||||
Orientation="Horizontal">
|
<ColumnDefinition x:Name="LeftPaddingColumn" Width="0"/>
|
||||||
<Image Source="Assets/AppList.png" />
|
<ColumnDefinition x:Name="IconColumn" Width="Auto"/>
|
||||||
<TextBlock
|
<ColumnDefinition x:Name="TitleColumn" Width="Auto"/>
|
||||||
x:Uid="AppTitleText"
|
<ColumnDefinition x:Name="RightDragColumn" Width="*"/>
|
||||||
Margin="12,0,0,0"
|
<ColumnDefinition x:Name="RightPaddingColumn" Width="0"/>
|
||||||
Style="{StaticResource CaptionTextBlockStyle}" />
|
</Grid.ColumnDefinitions>
|
||||||
</StackPanel>
|
<Image
|
||||||
|
Grid.Column="1"
|
||||||
|
Source="Assets/Icon.ico"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Width="16"
|
||||||
|
Height="16"/>
|
||||||
|
<TextBlock
|
||||||
|
x:Name="AppTitleTextBlock"
|
||||||
|
x:Uid="AppTitleText"
|
||||||
|
Grid.Column="2"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource CaptionTextBlockStyle}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<views:MainPage x:Name="mainPage" Grid.Row="1" />
|
<views:MainPage x:Name="mainPage" Grid.Row="1" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</winuiex:WindowEx>
|
</winuiex:WindowEx>
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.UI.Windowing;
|
using Microsoft.UI.Windowing;
|
||||||
|
using Microsoft.UI.Xaml;
|
||||||
|
using Microsoft.UI.Xaml.Controls;
|
||||||
|
using Microsoft.UI.Xaml.Media;
|
||||||
using WinUIEx;
|
using WinUIEx;
|
||||||
|
|
||||||
namespace FileLocksmithUI
|
namespace FileLocksmithUI
|
||||||
@@ -14,13 +17,24 @@ namespace FileLocksmithUI
|
|||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
mainPage.ViewModel.IsElevated = isElevated;
|
mainPage.ViewModel.IsElevated = isElevated;
|
||||||
SetTitleBar();
|
ExtendsContentIntoTitleBar = true;
|
||||||
|
SetTitleBar(AppTitleBar);
|
||||||
|
Activated += MainWindow_Activated;
|
||||||
|
AppWindow.SetIcon("Assets/Icon.ico");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetTitleBar()
|
private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)
|
||||||
{
|
{
|
||||||
ExtendsContentIntoTitleBar = true;
|
if (args.WindowActivationState == WindowActivationState.Deactivated)
|
||||||
SetTitleBar(titleBar);
|
{
|
||||||
|
AppTitleTextBlock.Foreground =
|
||||||
|
(SolidColorBrush)App.Current.Resources["WindowCaptionForegroundDisabled"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AppTitleTextBlock.Foreground =
|
||||||
|
(SolidColorBrush)App.Current.Resources["WindowCaptionForeground"];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|||||||
@@ -34,22 +34,19 @@
|
|||||||
</core:EventTriggerBehavior>
|
</core:EventTriggerBehavior>
|
||||||
</interactivity:Interaction.Behaviors>
|
</interactivity:Interaction.Behaviors>
|
||||||
|
|
||||||
<Grid>
|
<Grid RowSpacing="8">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="48" />
|
<RowDefinition Height="Auto" x:Name="ButtonsRow" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Grid
|
<Grid Margin="16,0">
|
||||||
Padding="18,0,18,4"
|
|
||||||
VerticalAlignment="Bottom">
|
|
||||||
<Button
|
<Button
|
||||||
Click="ShowSelectedPathsButton_Click"
|
Click="ShowSelectedPathsButton_Click"
|
||||||
Content="{x:Bind ViewModel.Paths, Converter={StaticResource fileListToDescriptionConverter}}">
|
Content="{x:Bind ViewModel.Paths, Converter={StaticResource fileListToDescriptionConverter}}">
|
||||||
<Button.Template>
|
<Button.Template>
|
||||||
<ControlTemplate TargetType="Button">
|
<ControlTemplate TargetType="Button">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="0,8,0,0"
|
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Style="{ThemeResource BodyStrongTextBlockStyle}"
|
Style="{ThemeResource BodyStrongTextBlockStyle}"
|
||||||
Text="{TemplateBinding Content}" />
|
Text="{TemplateBinding Content}" />
|
||||||
@@ -57,23 +54,19 @@
|
|||||||
</Button.Template>
|
</Button.Template>
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Uid="PathsTooltipDescription"
|
x:Uid="PathsTooltipDescription"
|
||||||
TextWrapping="WrapWholeWords" />
|
TextWrapping="WrapWholeWords" />
|
||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Bottom"
|
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
Spacing="6">
|
Spacing="8">
|
||||||
<Button
|
<Button
|
||||||
Padding="0"
|
|
||||||
HorizontalAlignment="Right"
|
|
||||||
Command="{Binding LoadProcessesCommand}"
|
Command="{Binding LoadProcessesCommand}"
|
||||||
Style="{StaticResource SubtleButtonStyle}">
|
Style="{StaticResource SubtleButtonStyle}">
|
||||||
<FontIcon
|
<FontIcon
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
Glyph="" />
|
Glyph="" />
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
@@ -82,12 +75,10 @@
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
x:Name="RestartAsAdminBtn"
|
x:Name="RestartAsAdminBtn"
|
||||||
Padding="0"
|
|
||||||
Command="{Binding RestartElevatedCommand}"
|
Command="{Binding RestartElevatedCommand}"
|
||||||
Style="{StaticResource SubtleButtonStyle}"
|
Style="{StaticResource SubtleButtonStyle}"
|
||||||
Visibility="{x:Bind ViewModel.IsElevated, Converter={StaticResource boolToVisibilityConverter}}">
|
Visibility="{x:Bind ViewModel.IsElevated, Converter={StaticResource boolToVisibilityConverter}}">
|
||||||
<FontIcon
|
<FontIcon
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
|
||||||
FontSize="16"
|
FontSize="16"
|
||||||
Glyph="" />
|
Glyph="" />
|
||||||
<ToolTipService.ToolTip>
|
<ToolTipService.ToolTip>
|
||||||
@@ -101,23 +92,22 @@
|
|||||||
<Grid Visibility="{x:Bind ViewModel.IsLoading, Converter={StaticResource boolToVisibilityConverter}, Mode=OneWay}">
|
<Grid Visibility="{x:Bind ViewModel.IsLoading, Converter={StaticResource boolToVisibilityConverter}, Mode=OneWay}">
|
||||||
<ListView
|
<ListView
|
||||||
x:Name="ProcessesListView"
|
x:Name="ProcessesListView"
|
||||||
Grid.Row="1"
|
|
||||||
IncrementalLoadingThreshold="10"
|
IncrementalLoadingThreshold="10"
|
||||||
ItemsSource="{x:Bind ViewModel.Processes}"
|
ItemsSource="{x:Bind ViewModel.Processes}"
|
||||||
SelectionMode="None">
|
SelectionMode="None"
|
||||||
|
Padding="0,0,0,12">
|
||||||
<ListView.ItemTemplate>
|
<ListView.ItemTemplate>
|
||||||
<DataTemplate x:DataType="interop:ProcessResult">
|
<DataTemplate x:DataType="interop:ProcessResult">
|
||||||
<labs:SettingsExpander Margin="0,3,0,0">
|
<labs:SettingsExpander Margin="0,0,0,4">
|
||||||
<labs:SettingsExpander.Resources>
|
<labs:SettingsExpander.Resources>
|
||||||
<x:Double x:Key="SettingsCardWrapThreshold">0</x:Double>
|
<x:Double x:Key="SettingsCardWrapThreshold">0</x:Double>
|
||||||
</labs:SettingsExpander.Resources>
|
</labs:SettingsExpander.Resources>
|
||||||
<labs:SettingsExpander.Header>
|
<labs:SettingsExpander.Header>
|
||||||
<!-- We can't use the HeaderIcon because it only support a BitmapIcon, which only supports UriSource - not a direct BitmapImage -->
|
<!-- We can't use the HeaderIcon because it only support a BitmapIcon, which only supports UriSource - not a direct BitmapImage -->
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||||||
<Image
|
<Image
|
||||||
Width="16"
|
Width="16"
|
||||||
Height="16"
|
Height="16"
|
||||||
Margin="2,0,24,0"
|
|
||||||
Source="{x:Bind pid, Converter={StaticResource pidToIconConverter}}" />
|
Source="{x:Bind pid, Converter={StaticResource pidToIconConverter}}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
IsTextSelectionEnabled="True"
|
IsTextSelectionEnabled="True"
|
||||||
@@ -139,19 +129,17 @@
|
|||||||
</ToolTipService.ToolTip>
|
</ToolTipService.ToolTip>
|
||||||
</FontIcon>
|
</FontIcon>
|
||||||
<Button
|
<Button
|
||||||
MinWidth="132"
|
MinWidth="128"
|
||||||
Command="{Binding Path=DataContext.EndTaskCommand, ElementName=ProcessesListView}"
|
Command="{Binding Path=DataContext.EndTaskCommand, ElementName=ProcessesListView}"
|
||||||
CommandParameter="{Binding}">
|
CommandParameter="{Binding}">
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
Spacing="6">
|
Spacing="8">
|
||||||
<FontIcon
|
<FontIcon
|
||||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
FontSize="16"
|
||||||
FontSize="14"
|
|
||||||
Glyph="" />
|
Glyph="" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
x:Uid="EndTask"
|
x:Uid="EndTask"/>
|
||||||
FontSize="14" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -177,13 +165,10 @@
|
|||||||
</TextBlock>
|
</TextBlock>
|
||||||
</labs:SettingsCard.Header>
|
</labs:SettingsCard.Header>
|
||||||
<ItemsRepeater
|
<ItemsRepeater
|
||||||
Margin="-16,0,0,0"
|
|
||||||
ItemsSource="{x:Bind files}">
|
ItemsSource="{x:Bind files}">
|
||||||
<ItemsRepeater.ItemTemplate>
|
<ItemsRepeater.ItemTemplate>
|
||||||
<DataTemplate x:DataType="x:String">
|
<DataTemplate x:DataType="x:String">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="16,0,0,4"
|
|
||||||
FontSize="12"
|
|
||||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||||
IsTextSelectionEnabled="True"
|
IsTextSelectionEnabled="True"
|
||||||
Style="{StaticResource CaptionTextBlockStyle}"
|
Style="{StaticResource CaptionTextBlockStyle}"
|
||||||
@@ -200,6 +185,7 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ListView.ItemTemplate>
|
</ListView.ItemTemplate>
|
||||||
</ListView>
|
</ListView>
|
||||||
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
@@ -230,14 +216,12 @@
|
|||||||
Height="48"
|
Height="48"
|
||||||
IsActive="{x:Bind ViewModel.IsLoading, Mode=OneWay}" />
|
IsActive="{x:Bind ViewModel.IsLoading, Mode=OneWay}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Name="SelectedFilesListDialog"
|
x:Name="SelectedFilesListDialog"
|
||||||
x:Uid="SelectedFilesListDialog">
|
x:Uid="SelectedFilesListDialog">
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
HorizontalScrollBarVisibility="Auto"
|
Padding="0,0,16,0">
|
||||||
HorizontalScrollMode="Auto"
|
|
||||||
VerticalScrollBarVisibility="Auto"
|
|
||||||
VerticalScrollMode="Auto">
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
IsTextSelectionEnabled="True"
|
IsTextSelectionEnabled="True"
|
||||||
Text="{x:Bind ViewModel.PathsToString, Mode=OneWay}" />
|
Text="{x:Bind ViewModel.PathsToString, Mode=OneWay}" />
|
||||||
|
|||||||
Reference in New Issue
Block a user