/
githubmirror
/
PowerToys
Обзор
Документация
Войти
/
githubmirror
/
PowerToys
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker/Components/ContextMenuHelper.cs
45 строк
2 KB
Jiří Polášek
CmdPal: Remove dead code from Window Walker and cleanup (#45570)
24 фев 2026, 15:29
Не верифицирован
24 фев 2026, 15:29
07b8915
Код
Авторство
О чём код?
// 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.CmdPal.Ext.WindowWalker.Commands; using Microsoft.CmdPal.Ext.WindowWalker.Pages; using Windows.System; namespace Microsoft.CmdPal.Ext.WindowWalker.Components; internal static class ContextMenuHelper { internal static List<CommandContextItem> GetContextMenuResults(in WindowWalkerListItem listItem) { ArgumentNullException.ThrowIfNull(listItem); if (listItem.Window is null) { return []; } var windowData = listItem.Window; var contextMenu = new List<CommandContextItem> { new(new CloseWindowCommand(windowData)) { RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.F4), }, }; // Hide menu if Explorer.exe is the shell process or the process name is ApplicationFrameHost.exe // In the first case we would crash the windows ui and in the second case we would kill the generic process for uwp apps. if (!windowData.Process.IsShellProcess && !(windowData.Process.IsUwpAppFrameHost && string.Equals(windowData.Process.Name, "ApplicationFrameHost.exe", StringComparison.OrdinalIgnoreCase)) && !(windowData.Process.IsFullAccessDenied && SettingsManager.Instance.HideKillProcessOnElevatedProcesses)) { contextMenu.Add(new CommandContextItem(new EndTaskCommand(windowData)) { RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.Delete), IsCritical = true, }); } return contextMenu; } }