mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[New PowerToy] File Locksmith (#20930)
* Imported offline solution * Make solution compile * Add Windows sample, doesn't work? * Added new project to implement the dll * Remove unneeded header * Implemented IUnknown part of ExplorerCommand * Implemented IExplorerCommand methods * Implemented ClassFactory * Implemented DLL register/unregister * Implemented other DLL exports, not working? * Implemented IShellExtInit inferface * Implemented IContextMenu, it works! * Implement command data fetching * Make sample project compile on VS 2022 * Add plan * Implement Lib as separate project * Implemented IPC, not tested * Console UI project skeleton * Implemented basic console UI * Implemented piping, there are bugs * Prototype works * Remove old project * Added GUI project skeleton * Mitigate issue with WinUI3 * Added a control for displaying results * Add button * Implement core functions in lib project * Call new library function from console main * Implement showing results * Improve UI * Implemented subdirectory search * Remove useless code * Set window size * UI adjustments * Implement killing process * Rename variable * Add lib project to main solution * Add Ext and GUI projects to solution * Tweak packages for GUI project * Add a settings page * Add a few resource strings * Add one more resources string * VS keeps trying to correct this * Add references to File Locksmith in /,github * Implement some parts of FileLocksmithModule * Change output directory * Change target name and add to runner * Add logger * Started implementing settings backend * Fix log folder * Settings work * Add some basic tracing * Attempt at adding resources * Remove junk files * Added missing defines * Replaced some constants with resources Something's not working * Move resources to the Ext project * Remove experiment * Add binaries for signing * Improve tracing * Remove old Settings calls * Show something when there are no results * Change window title * Move computation to another thread, improve UX * Increase font size for default text * Remove entries for killed processes * Show user name * Remove nonrecursive implementation * Implement back end for getting file names * Show list of files, UI tweaks * Remove useless includes * Implement back end for getting full process path * Dark title bar on dark themes * Using Expander, other UI adjustments * Show "No results" after killing all processes * Show progress ring * Update configuration mapping * Revert "Update configuration mapping" This reverts commit d8e13206f3c7de3c6dbf880299bfff3bf9f27a37. * Fixed solution configuration, ARM64 should build * Backend for refreshing * Variable window size * Add refresh button * New WinUI3 C# project for FL * Started porting functionality * Add Interop project * Move IPC to Ext project * Ported native functions to Interop * Ported finding processes * Ported most of Main Window functionality * Display paths of files * Implement killing processes * Use resource string for "End Task" * Remove entries for terminated processes * Show User name * Set default window size * Make the new UI the default * Reading paths from stdin, completed port to C# * Fix small bug * Moving to MVVM * Adding Labs * Merge branch 'ivan/file-locksmith' of https://github.com/microsoft/PowerToys into ivan/file-locksmith Removing one parent commit for cleaner history Co-Authored-By: Niels Laute <niels.laute@live.nl> * Reintroducing features * Moving UI strings to resources file * Restored functionality * Add missing dlls * Add FIle Locksmith to publish.cmd * Rebase fixes * Try updating nuget.config * Fix copy-paste blunder * Add File Locksmith UI for publishing * Add .pubxml file in FileLocksmith * Change build output folder * Fix installer build issues Remove old projects from solution so MSBuild doesn't build them. Downgrade target framework to what most other projects are using. Fix publishing profile and project runtimes. Remove unused CsWinRT references. * [CI] Add clear to nuget packages * Fix module reference counting * Fix nuget for release CI * Fix version and signing * Fix path for resources * Fix incorrect results when running 2 instances * Fix default nuget source * Windows 10 icon and fallback for UI * Code clean-up and spaces instead of tabs * Add gif showcasing FL * Add screenshot of File Locksmith for Settings * Add new files to the installer * Add OOBE page * Showing selected paths in the header * Tweak path list * Added new, wider gif * Add GPO * Add some logs * [CI]Get CommunityToolkit.Labs from BigPark feed * [CI]Use azure package feed for Nuget in release * [CI]Another try for the labs source * Revert changes to feed * Use RestoreAdditionalProjectSources * Add tooltip to file list * Change tooltip to not trim the lines * Add Tips and tricks section mentioning elevated * Add some more logs messages. * Grammar fix * Add to bug report tool * Fix UI virtualization not working * Disable virtualization to avoid crashes * Get better virtualization * Add dialog instead of tooltip to show list of items * No results refresh icon is now a button too * Use managed methods for handling processes * Remove registry code from Ext. * Support drives too Co-authored-by: Niels Laute <niels.laute@live.nl> Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
This commit is contained in:
@@ -303,6 +303,22 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
}
|
||||
}
|
||||
|
||||
private bool fileLocksmith = true;
|
||||
|
||||
[JsonPropertyName("File Locksmith")]
|
||||
public bool FileLocksmith
|
||||
{
|
||||
get => fileLocksmith;
|
||||
set
|
||||
{
|
||||
if (fileLocksmith != value)
|
||||
{
|
||||
LogTelemetryEvent(value);
|
||||
fileLocksmith = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
|
||||
@@ -118,6 +118,7 @@ namespace Microsoft.PowerToys.Settings.UI
|
||||
case "Awake": StartupPage = typeof(Views.AwakePage); break;
|
||||
case "ColorPicker": StartupPage = typeof(Views.ColorPickerPage); break;
|
||||
case "FancyZones": StartupPage = typeof(Views.FancyZonesPage); break;
|
||||
case "FileLocksmith": StartupPage = typeof(Views.FileLocksmithPage); break;
|
||||
case "Run": StartupPage = typeof(Views.PowerLauncherPage); break;
|
||||
case "ImageResizer": StartupPage = typeof(Views.ImageResizerPage); break;
|
||||
case "KBM": StartupPage = typeof(Views.KeyboardManagerPage); break;
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
BIN
src/settings-ui/Settings.UI/Assets/Modules/FileLocksmith.png
Normal file
BIN
src/settings-ui/Settings.UI/Assets/Modules/FileLocksmith.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 419 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
@@ -11,6 +11,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Enums
|
||||
Awake,
|
||||
ColorPicker,
|
||||
FancyZones,
|
||||
FileLocksmith,
|
||||
FileExplorer,
|
||||
ImageResizer,
|
||||
KBM,
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<Page x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeFileLocksmith"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:toolkitcontrols="using:CommunityToolkit.WinUI.UI.Controls"
|
||||
mc:Ignorable="d">
|
||||
<controls:OOBEPageControl x:Uid="Oobe_FileLocksmith"
|
||||
HeroImage="ms-appx:///Assets/Modules/OOBE/FileLocksmith.gif">
|
||||
|
||||
<controls:OOBEPageControl.PageContent>
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
<TextBlock x:Uid="Oobe_HowToUse"
|
||||
Style="{ThemeResource OobeSubtitleStyle}" />
|
||||
|
||||
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_FileLocksmith_HowToUse" />
|
||||
|
||||
<TextBlock x:Uid="Oobe_TipsAndTricks"
|
||||
Style="{ThemeResource OobeSubtitleStyle}"/>
|
||||
|
||||
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_FileLocksmith_TipsAndTricks" />
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
|
||||
<Button x:Uid="OOBE_Settings"
|
||||
Click="SettingsLaunchButton_Click"/>
|
||||
<HyperlinkButton NavigateUri="https://aka.ms/PowerToysOverview_FileLocksmith" Style="{StaticResource TextButtonStyle}">
|
||||
<TextBlock x:Uid="LearnMore_FileLocksmith"
|
||||
TextWrapping="Wrap" />
|
||||
</HyperlinkButton>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</controls:OOBEPageControl.PageContent>
|
||||
</controls:OOBEPageControl>
|
||||
</Page>
|
||||
@@ -0,0 +1,47 @@
|
||||
// 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.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
|
||||
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
|
||||
using Microsoft.PowerToys.Settings.UI.Views;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class OobeFileLocksmith : Page
|
||||
{
|
||||
public OobePowerToysModule ViewModel { get; set; }
|
||||
|
||||
public OobeFileLocksmith()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModules.FileLocksmith]);
|
||||
DataContext = ViewModel;
|
||||
}
|
||||
|
||||
private void SettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
if (OobeShellPage.OpenMainWindowCallback != null)
|
||||
{
|
||||
OobeShellPage.OpenMainWindowCallback(typeof(FileLocksmithPage));
|
||||
}
|
||||
|
||||
ViewModel.LogOpeningSettingsEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogOpeningModuleEvent();
|
||||
}
|
||||
|
||||
protected override void OnNavigatedFrom(NavigationEventArgs e)
|
||||
{
|
||||
ViewModel.LogClosingModuleEvent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,11 @@
|
||||
<BitmapIcon ShowAsMonochrome="False" UriSource="ms-appx:///Assets/FluentIcons/FluentIconsFancyZones.png" />
|
||||
</NavigationViewItem.Icon>
|
||||
</NavigationViewItem>
|
||||
<NavigationViewItem x:Uid="Shell_FileLocksmith" Tag="FileLocksmith">
|
||||
<NavigationViewItem.Icon>
|
||||
<BitmapIcon ShowAsMonochrome="False" UriSource="ms-appx:///Assets/FluentIcons/FluentIconsFileLocksmith.png" />
|
||||
</NavigationViewItem.Icon>
|
||||
</NavigationViewItem>
|
||||
<NavigationViewItem x:Uid="Shell_PowerPreview" Tag="FileExplorer">
|
||||
<NavigationViewItem.Icon>
|
||||
<BitmapIcon ShowAsMonochrome="False" UriSource="ms-appx:///Assets/FluentIcons/FluentIconsFileExplorerPreview.png" />
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
Modules.Insert((int)PowerToysModules.AlwaysOnTop, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "AlwaysOnTop",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.Awake, new OobePowerToysModule()
|
||||
{
|
||||
@@ -81,6 +81,11 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
ModuleName = "FancyZones",
|
||||
IsNew = false,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.FileLocksmith, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "FileLocksmith",
|
||||
IsNew = true,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.FileExplorer, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "FileExplorer",
|
||||
@@ -99,7 +104,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
Modules.Insert((int)PowerToysModules.MouseUtils, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "MouseUtils",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.PowerRename, new OobePowerToysModule()
|
||||
{
|
||||
@@ -114,7 +119,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
Modules.Insert((int)PowerToysModules.QuickAccent, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "QuickAccent",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
Modules.Insert((int)PowerToysModules.ShortcutGuide, new OobePowerToysModule()
|
||||
{
|
||||
@@ -124,19 +129,19 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
Modules.Insert((int)PowerToysModules.TextExtractor, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "TextExtractor",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.VideoConference, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "VideoConference",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.MeasureTool, new OobePowerToysModule()
|
||||
{
|
||||
ModuleName = "MeasureTool",
|
||||
IsNew = true,
|
||||
IsNew = false,
|
||||
});
|
||||
|
||||
Modules.Insert((int)PowerToysModules.Hosts, new OobePowerToysModule()
|
||||
@@ -187,6 +192,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
|
||||
case "Awake": NavigationFrame.Navigate(typeof(OobeAwake)); break;
|
||||
case "ColorPicker": NavigationFrame.Navigate(typeof(OobeColorPicker)); break;
|
||||
case "FancyZones": NavigationFrame.Navigate(typeof(OobeFancyZones)); break;
|
||||
case "FileLocksmith": NavigationFrame.Navigate(typeof(OobeFileLocksmith)); break;
|
||||
case "Run": NavigationFrame.Navigate(typeof(OobeRun)); break;
|
||||
case "ImageResizer": NavigationFrame.Navigate(typeof(OobeImageResizer)); break;
|
||||
case "KBM": NavigationFrame.Navigate(typeof(OobeKBM)); break;
|
||||
|
||||
@@ -1469,6 +1469,9 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
|
||||
<data name="Oobe_FancyZones.Description" xml:space="preserve">
|
||||
<value>FancyZones is a window manager that makes it easy to create complex window layouts and quickly position windows into those layouts.</value>
|
||||
</data>
|
||||
<data name="Oobe_FileLocksmith.Description" xml:space="preserve">
|
||||
<value>File Locksmith lists which processes are using the selected files or directories and allows closing those processes.</value>
|
||||
</data>
|
||||
<data name="Oobe_FileExplorer.Description" xml:space="preserve">
|
||||
<value>PowerToys introduces add-ons to the Windows File Explorer that will enable files like Markdown (.md), PDF (.pdf), SVG (.svg), STL (.stl), G-code (.gcode) and developer files to be viewed in the preview pane. It introduces File Explorer thumbnail support for a number of these file types as well.</value>
|
||||
</data>
|
||||
@@ -1523,6 +1526,12 @@ Take a moment to preview the various utilities listed or view our comprehensive
|
||||
<data name="Oobe_FancyZones_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>Snap a window to multiple zones by holding the **Ctrl** key (while also holding **Shift**) when dragging a window.</value>
|
||||
</data>
|
||||
<data name="Oobe_FileLocksmith_HowToUse.Text" xml:space="preserve">
|
||||
<value>In File Explorer, **right-clicking one or more selected files** and **clicking on "What's using this file?"** from the context menu.</value>
|
||||
</data>
|
||||
<data name="Oobe_FileLocksmith_TipsAndTricks.Text" xml:space="preserve">
|
||||
<value>Press the Restart Elevated button from the File Locksmith UI to also get information on elevated processes that might be using the files.</value>
|
||||
</data>
|
||||
<data name="Oobe_FileExplorer_HowToEnable.Text" xml:space="preserve">
|
||||
<value>Open File Explorer, **select the View tab** in the File Explorer ribbon, then **select Preview Pane**.
|
||||
From there, simply click on one of the supported files in the File Explorer and observe the content on the preview pane!</value>
|
||||
@@ -1596,6 +1605,9 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<value>FancyZones</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
</data>
|
||||
<data name="Oobe_FileLocksmith.Title" xml:space="preserve">
|
||||
<value>File Locksmith</value>
|
||||
</data>
|
||||
<data name="Oobe_ImageResizer.Title" xml:space="preserve">
|
||||
<value>Image Resizer</value>
|
||||
<comment>Do not localize this string</comment>
|
||||
@@ -1807,6 +1819,9 @@ From there, simply click on one of the supported files in the File Explorer and
|
||||
<value>Learn more about FancyZones</value>
|
||||
<comment>FancyZones is a product name, do not loc</comment>
|
||||
</data>
|
||||
<data name="LearnMore_FileLocksmith.Text" xml:space="preserve">
|
||||
<value>Learn more about File Locksmith</value>
|
||||
</data>
|
||||
<data name="LearnMore_ImageResizer.Text" xml:space="preserve">
|
||||
<value>Learn more about Image Resizer</value>
|
||||
<comment>Image Resizer is a product name, do not loc</comment>
|
||||
@@ -2646,6 +2661,20 @@ Activate by holding the key for the character you want to add an accent to, then
|
||||
<data name="Hosts_Toggle_LaunchAdministrator.Header" xml:space="preserve">
|
||||
<value>Launch as administrator</value>
|
||||
</data>
|
||||
<data name="FileLocksmith.ModuleDescription" xml:space="preserve">
|
||||
<value>A Windows shell extension to find out which processes are using the selected files and directories.</value>
|
||||
</data>
|
||||
<data name="FileLocksmith.ModuleTitle" xml:space="preserve">
|
||||
<value>File Locksmith</value>
|
||||
</data>
|
||||
<data name="Shell_FileLocksmith.Content" xml:space="preserve">
|
||||
<value>File Locksmith</value>
|
||||
<comment>Product name: Navigation view item name for FileLocksmith</comment>
|
||||
</data>
|
||||
<data name="FileLocksmith_Enable_FileLocksmith.Header" xml:space="preserve">
|
||||
<value>Enable File Locksmith</value>
|
||||
<comment>File Locksmith is the name of the utility</comment>
|
||||
</data>
|
||||
<data name="GPO_IsSettingForced.Title" xml:space="preserve">
|
||||
<value>The systems administrator is forcing this setting.</value>
|
||||
</data>
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
public class FileLocksmithViewModel : Observable
|
||||
{
|
||||
private GeneralSettings GeneralSettingsConfig { get; set; }
|
||||
|
||||
public FileLocksmithViewModel(ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
|
||||
{
|
||||
// To obtain the general settings configurations of PowerToys Settings.
|
||||
if (settingsRepository == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(settingsRepository));
|
||||
}
|
||||
|
||||
GeneralSettingsConfig = settingsRepository.SettingsConfig;
|
||||
|
||||
_enabledGpoRuleConfiguration = GPOWrapper.GetConfiguredFileLocksmithEnabledValue();
|
||||
if (_enabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled)
|
||||
{
|
||||
// Get the enabled state from GPO.
|
||||
_enabledStateIsGPOConfigured = true;
|
||||
_isFileLocksmithEnabled = _enabledGpoRuleConfiguration == GpoRuleConfigured.Enabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isFileLocksmithEnabled = GeneralSettingsConfig.Enabled.FileLocksmith;
|
||||
}
|
||||
|
||||
// set the callback functions value to hangle outgoing IPC message.
|
||||
SendConfigMSG = ipcMSGCallBackFunc;
|
||||
}
|
||||
|
||||
public bool IsFileLocksmithEnabled
|
||||
{
|
||||
get => _isFileLocksmithEnabled;
|
||||
set
|
||||
{
|
||||
if (_enabledStateIsGPOConfigured)
|
||||
{
|
||||
// If it's GPO configured, shouldn't be able to change this state.
|
||||
return;
|
||||
}
|
||||
|
||||
if (_isFileLocksmithEnabled != value)
|
||||
{
|
||||
_isFileLocksmithEnabled = value;
|
||||
|
||||
GeneralSettingsConfig.Enabled.FileLocksmith = value;
|
||||
OnPropertyChanged(nameof(IsFileLocksmithEnabled));
|
||||
|
||||
OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(GeneralSettingsConfig);
|
||||
SendConfigMSG(outgoing.ToString());
|
||||
|
||||
// TODO: Implement when this module has properties.
|
||||
// NotifyPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEnabledGpoConfigured
|
||||
{
|
||||
get => _enabledStateIsGPOConfigured;
|
||||
}
|
||||
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
private GpoRuleConfigured _enabledGpoRuleConfiguration;
|
||||
private bool _enabledStateIsGPOConfigured;
|
||||
private bool _isFileLocksmithEnabled;
|
||||
}
|
||||
}
|
||||
42
src/settings-ui/Settings.UI/Views/FileLocksmithPage.xaml
Normal file
42
src/settings-ui/Settings.UI/Views/FileLocksmithPage.xaml
Normal file
@@ -0,0 +1,42 @@
|
||||
<Page
|
||||
x:Class="Microsoft.PowerToys.Settings.UI.Views.FileLocksmithPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
AutomationProperties.LandmarkType="Main">
|
||||
|
||||
<Page.Resources>
|
||||
<converters:BoolNegationConverter x:Key="BoolNegationConverter"/>
|
||||
</Page.Resources>
|
||||
|
||||
<controls:SettingsPageControl x:Uid="FileLocksmith"
|
||||
ModuleImageSource="ms-appx:///Assets/Modules/FileLocksmith.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
<StackPanel Orientation="Vertical">
|
||||
|
||||
<controls:Setting x:Uid="FileLocksmith_Enable_FileLocksmith" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}">
|
||||
<controls:Setting.Icon>
|
||||
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsPowerToys.png" ShowAsMonochrome="False" />
|
||||
</controls:Setting.Icon>
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.IsFileLocksmithEnabled, Mode=TwoWay}" HorizontalAlignment="Right"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
<InfoBar x:Uid="GPO_IsSettingForced"
|
||||
Severity="Informational"
|
||||
IsClosable="False"
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}" />
|
||||
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
<controls:SettingsPageControl.PrimaryLinks>
|
||||
<controls:PageLink x:Uid="LearnMore_FileLocksmith" Link="https://aka.ms/PowerToysOverview_FileLocksmith"/>
|
||||
</controls:SettingsPageControl.PrimaryLinks>
|
||||
</controls:SettingsPageControl>
|
||||
</Page>
|
||||
23
src/settings-ui/Settings.UI/Views/FileLocksmithPage.xaml.cs
Normal file
23
src/settings-ui/Settings.UI/Views/FileLocksmithPage.xaml.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
// 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.
|
||||
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
{
|
||||
public sealed partial class FileLocksmithPage : Page
|
||||
{
|
||||
private FileLocksmithViewModel ViewModel { get; set; }
|
||||
|
||||
public FileLocksmithPage()
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
ViewModel = new FileLocksmithViewModel(SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
|
||||
DataContext = ViewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,12 @@
|
||||
</NavigationViewItem.Icon>
|
||||
</NavigationViewItem>
|
||||
|
||||
<NavigationViewItem x:Uid="Shell_FileLocksmith" helpers:NavHelper.NavigateTo="views:FileLocksmithPage">
|
||||
<NavigationViewItem.Icon>
|
||||
<BitmapIcon ShowAsMonochrome="False" UriSource="ms-appx:///Assets/FluentIcons/FluentIconsFileLocksmith.png" />
|
||||
</NavigationViewItem.Icon>
|
||||
</NavigationViewItem>
|
||||
|
||||
<NavigationViewItem x:Uid="Shell_PowerPreview" helpers:NavHelper.NavigateTo="views:PowerPreviewPage">
|
||||
<NavigationViewItem.Icon>
|
||||
<BitmapIcon ShowAsMonochrome="False" UriSource="ms-appx:///Assets/FluentIcons/FluentIconsFileExplorerPreview.png" />
|
||||
|
||||
Reference in New Issue
Block a user