mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 18:57:19 +02:00
[settings] Show uneditable shortcut in CmdPal page (#38060)
* [settings] Show CmdPal shortcut * show in dashboard as well   As noted in #37908
This commit is contained in:
@@ -53,6 +53,27 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
|
||||
return sendCustomAction.ToJsonString();
|
||||
}
|
||||
|
||||
public static IFileSystemWatcher GetFileWatcher(string path, Action onChangedCallback, IFileSystem fileSystem = null)
|
||||
{
|
||||
fileSystem ??= FileSystem;
|
||||
|
||||
var dirPath = Path.GetDirectoryName(path);
|
||||
if (!fileSystem.Directory.Exists(dirPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var watcher = fileSystem.FileSystemWatcher.New();
|
||||
watcher.Path = dirPath;
|
||||
watcher.Filter = Path.GetFileName(path);
|
||||
watcher.NotifyFilter = NotifyFilters.LastWrite;
|
||||
watcher.EnableRaisingEvents = true;
|
||||
|
||||
watcher.Changed += (o, e) => onChangedCallback();
|
||||
|
||||
return watcher;
|
||||
}
|
||||
|
||||
public static IFileSystemWatcher GetFileWatcher(string moduleName, string fileName, Action onChangedCallback, IFileSystem fileSystem = null)
|
||||
{
|
||||
fileSystem ??= FileSystem;
|
||||
|
||||
Reference in New Issue
Block a user