mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 17:56:44 +02:00
Remove redundant code
This commit is contained in:
@@ -57,8 +57,6 @@ internal sealed partial class SwitchToWindowCommand : InvokableCommand
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var p = Process.GetProcessById((int)_window.Process.ProcessID);
|
var p = Process.GetProcessById((int)_window.Process.ProcessID);
|
||||||
if (p is not null)
|
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var processFileName = p.MainModule?.FileName;
|
var processFileName = p.MainModule?.FileName;
|
||||||
@@ -70,7 +68,6 @@ internal sealed partial class SwitchToWindowCommand : InvokableCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public override ICommandResult Invoke()
|
public override ICommandResult Invoke()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ internal static class ContextMenuHelper
|
|||||||
{
|
{
|
||||||
new(new CloseWindowCommand(windowData))
|
new(new CloseWindowCommand(windowData))
|
||||||
{
|
{
|
||||||
RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.F4, 0),
|
RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.F4),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ internal static class ContextMenuHelper
|
|||||||
{
|
{
|
||||||
contextMenu.Add(new CommandContextItem(new EndTaskCommand(windowData))
|
contextMenu.Add(new CommandContextItem(new EndTaskCommand(windowData))
|
||||||
{
|
{
|
||||||
RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.Delete, 0),
|
RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.Delete),
|
||||||
IsCritical = true,
|
IsCritical = true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,4 @@ namespace Microsoft.CmdPal.Ext.WindowWalker.Helpers;
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[ComImport]
|
[ComImport]
|
||||||
[Guid("aa509086-5ca9-4c25-8f95-589d3c07b48a")]
|
[Guid("aa509086-5ca9-4c25-8f95-589d3c07b48a")]
|
||||||
internal class CVirtualDesktopManager
|
internal class CVirtualDesktopManager;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -41,8 +41,8 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl
|
|||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(query);
|
ArgumentNullException.ThrowIfNull(query);
|
||||||
|
|
||||||
_cancellationTokenSource?.Cancel();
|
_cancellationTokenSource.Cancel();
|
||||||
_cancellationTokenSource?.Dispose();
|
_cancellationTokenSource.Dispose();
|
||||||
_cancellationTokenSource = new System.Threading.CancellationTokenSource();
|
_cancellationTokenSource = new System.Threading.CancellationTokenSource();
|
||||||
|
|
||||||
WindowWalkerCommandsProvider.VirtualDesktopHelperInstance.UpdateDesktopList();
|
WindowWalkerCommandsProvider.VirtualDesktopHelperInstance.UpdateDesktopList();
|
||||||
@@ -54,7 +54,7 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl
|
|||||||
{
|
{
|
||||||
if (!SettingsManager.Instance.InMruOrder)
|
if (!SettingsManager.Instance.InMruOrder)
|
||||||
{
|
{
|
||||||
windows.Sort(static (a, b) => string.Compare(a?.Title, b?.Title, StringComparison.OrdinalIgnoreCase));
|
windows.Sort(static (a, b) => string.Compare(a.Title, b.Title, StringComparison.OrdinalIgnoreCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = new Scored<Window>[windows.Count];
|
var results = new Scored<Window>[windows.Count];
|
||||||
@@ -73,7 +73,7 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl
|
|||||||
private static int ScoreFunction(string q, Window window)
|
private static int ScoreFunction(string q, Window window)
|
||||||
{
|
{
|
||||||
var titleScore = FuzzyStringMatcher.ScoreFuzzy(q, window.Title);
|
var titleScore = FuzzyStringMatcher.ScoreFuzzy(q, window.Title);
|
||||||
var processNameScore = FuzzyStringMatcher.ScoreFuzzy(q, window.Process?.Name ?? string.Empty);
|
var processNameScore = FuzzyStringMatcher.ScoreFuzzy(q, window.Process.Name ?? string.Empty);
|
||||||
return Math.Max(titleScore, processNameScore);
|
return Math.Max(titleScore, processNameScore);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl
|
|||||||
{
|
{
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
_cancellationTokenSource?.Dispose();
|
_cancellationTokenSource.Dispose();
|
||||||
_disposed = true;
|
_disposed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user