mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-03 09:46:54 +02:00
Remove redundant code
This commit is contained in:
@@ -57,16 +57,13 @@ internal sealed partial class SwitchToWindowCommand : InvokableCommand
|
||||
else
|
||||
{
|
||||
var p = Process.GetProcessById((int)_window.Process.ProcessID);
|
||||
if (p is not null)
|
||||
try
|
||||
{
|
||||
var processFileName = p.MainModule?.FileName;
|
||||
Icon = new IconInfo(processFileName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
try
|
||||
{
|
||||
var processFileName = p.MainModule?.FileName;
|
||||
Icon = new IconInfo(processFileName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ internal static class ContextMenuHelper
|
||||
{
|
||||
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))
|
||||
{
|
||||
RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.Delete, 0),
|
||||
RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.Delete),
|
||||
IsCritical = true,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,6 +12,4 @@ namespace Microsoft.CmdPal.Ext.WindowWalker.Helpers;
|
||||
/// </summary>
|
||||
[ComImport]
|
||||
[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);
|
||||
|
||||
_cancellationTokenSource?.Cancel();
|
||||
_cancellationTokenSource?.Dispose();
|
||||
_cancellationTokenSource.Cancel();
|
||||
_cancellationTokenSource.Dispose();
|
||||
_cancellationTokenSource = new System.Threading.CancellationTokenSource();
|
||||
|
||||
WindowWalkerCommandsProvider.VirtualDesktopHelperInstance.UpdateDesktopList();
|
||||
@@ -54,7 +54,7 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl
|
||||
{
|
||||
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];
|
||||
@@ -73,7 +73,7 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl
|
||||
private static int ScoreFunction(string q, Window window)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_cancellationTokenSource?.Dispose();
|
||||
_cancellationTokenSource.Dispose();
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user