mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Merge remote-tracking branch 'origin/ivan/file-locksmith' into ivan/file-locksmith
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
namespace PowerToys.FileLocksmithUI.Converters
|
||||
{
|
||||
using System;
|
||||
using FileLocksmith.Interop;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
|
||||
public sealed class FileListToDescriptionConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
var paths = (string[])value;
|
||||
if (paths.Length == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
else if (paths.Length == 1)
|
||||
{
|
||||
return paths[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
return paths[0] + "; +" + (paths.Length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,6 +132,9 @@
|
||||
<data name="Files.Text" xml:space="preserve">
|
||||
<value>Files</value>
|
||||
</data>
|
||||
<data name="NoFilesSelected.Text" xml:space="preserve">
|
||||
<value>No files selected</value>
|
||||
</data>
|
||||
<data name="ProcessID.Header" xml:space="preserve">
|
||||
<value>Process ID</value>
|
||||
</data>
|
||||
|
||||
@@ -59,6 +59,16 @@ namespace PowerToys.FileLocksmithUI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public string[] Paths
|
||||
{
|
||||
get => paths;
|
||||
set
|
||||
{
|
||||
paths = value;
|
||||
OnPropertyChanged(nameof(Paths));
|
||||
}
|
||||
}
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
paths = NativeMethods.ReadPathsFromFile();
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
<converters:FileCountConverter x:Key="fileCountConverter" />
|
||||
<converters:PidToIconConverter x:Key="pidToIconConverter" />
|
||||
<converters:PidToUserConverter x:Key="pidToUserConverter" />
|
||||
<converters:FileListToDescriptionConverter x:Key="fileListToDescriptionConverter" />
|
||||
</Page.Resources>
|
||||
|
||||
<interactivity:Interaction.Behaviors>
|
||||
@@ -42,7 +43,13 @@
|
||||
|
||||
<Grid Padding="18,0,18,4" VerticalAlignment="Bottom">
|
||||
<!--<TextBlock Margin="0,2,0,0" Text="Current proccesses:" Style="{ThemeResource BodyStrongTextBlockStyle}"/>-->
|
||||
|
||||
<TextBlock
|
||||
Margin="0,8,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{ThemeResource BodyStrongTextBlockStyle}"
|
||||
Text="{x:Bind ViewModel.Paths, Converter={StaticResource fileListToDescriptionConverter}}">
|
||||
</TextBlock>
|
||||
|
||||
<StackPanel
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.5 MiB |
Reference in New Issue
Block a user