Skip to content

Code Quality: Added 'object? parameter' to every rich commands #15325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public BaseCompressArchiveAction()
context.PropertyChanged += Context_PropertyChanged;
}

public abstract Task ExecuteAsync();
public abstract Task ExecuteAsync(object? parameter = null);

private bool IsContextPageTypeAdaptedToCommand()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public CompressIntoArchiveAction()
{
}

public override async Task ExecuteAsync()
public override async Task ExecuteAsync(object? parameter = null)
{
if (context.ShellPage is null)
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public CompressIntoSevenZipAction()
{
}

public override Task ExecuteAsync()
public override Task ExecuteAsync(object? parameter = null)
{
if (context.ShellPage is null)
return Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public CompressIntoZipAction()
{
}

public override Task ExecuteAsync()
public override Task ExecuteAsync(object? parameter = null)
{
if (context.ShellPage is null)
return Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public BaseDecompressArchiveAction()
context.PropertyChanged += Context_PropertyChanged;
}

public abstract Task ExecuteAsync();
public abstract Task ExecuteAsync(object? parameter = null);

protected bool IsContextPageTypeAdaptedToCommand()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public DecompressArchive()
{
}

public override Task ExecuteAsync()
public override Task ExecuteAsync(object? parameter = null)
{
if (context.ShellPage is null)
return Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public DecompressArchiveHere()
{
}

public override Task ExecuteAsync()
public override Task ExecuteAsync(object? parameter = null)
{
return DecompressHelper.DecompressArchiveHereAsync(context.ShellPage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public DecompressArchiveHereSmart()
{
}

public override Task ExecuteAsync()
public override Task ExecuteAsync(object? parameter = null)
{
return DecompressHelper.DecompressArchiveHereAsync(context.ShellPage, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public DecompressArchiveToChildFolderAction()
{
}

public override Task ExecuteAsync()
public override Task ExecuteAsync(object? parameter = null)
{
return DecompressHelper.DecompressArchiveToChildFolderAsync(context.ShellPage);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public BaseSetAsAction()
context.PropertyChanged += Context_PropertyChanged;
}

public abstract Task ExecuteAsync();
public abstract Task ExecuteAsync(object? parameter = null);

private void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public override RichGlyph Glyph
base.IsExecutable &&
context.SelectedItem is not null;

public override Task ExecuteAsync()
public override Task ExecuteAsync(object? parameter = null)
{
if (context.SelectedItem is not null)
AppearanceSettingsService.AppThemeBackgroundImageSource = context.SelectedItem.ItemPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public override RichGlyph Glyph
base.IsExecutable &&
context.SelectedItem is not null;

public override Task ExecuteAsync()
public override Task ExecuteAsync(object? parameter = null)
{
if (context.SelectedItem is not null)
return WallpaperHelpers.SetAsBackgroundAsync(WallpaperType.LockScreen, context.SelectedItem.ItemPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public override RichGlyph Glyph
base.IsExecutable &&
context.SelectedItems.Count > 1;

public override Task ExecuteAsync()
public override Task ExecuteAsync(object? parameter = null)
{
var paths = context.SelectedItems.Select(item => item.ItemPath).ToArray();
WallpaperHelpers.SetSlideshow(paths);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public override RichGlyph Glyph
base.IsExecutable &&
context.SelectedItem is not null;

public override Task ExecuteAsync()
public override Task ExecuteAsync(object? parameter = null)
{
if (context.SelectedItem is not null)
return WallpaperHelpers.SetAsBackgroundAsync(WallpaperType.Desktop, context.SelectedItem.ItemPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public BaseRotateAction()
context.PropertyChanged += Context_PropertyChanged;
}

public async Task ExecuteAsync()
public async Task ExecuteAsync(object? parameter = null)
{
await Task.WhenAll(context.SelectedItems.Select(image => BitmapHelper.RotateAsync(PathNormalization.NormalizePath(image.ItemPath), Rotation)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public InstallCertificateAction()
context.PropertyChanged += Context_PropertyChanged;
}

public async Task ExecuteAsync()
public async Task ExecuteAsync(object? parameter = null)
{
await ContextMenu.InvokeVerb("add", context.SelectedItems.Select(x => x.ItemPath).ToArray());
}
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/Content/Install/InstallFontAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public InstallFontAction()
context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
var paths = context.SelectedItems.Select(item => item.ItemPath).ToArray();
return Win32Helper.InstallFontsAsync(paths, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public InstallInfDriverAction()
context.PropertyChanged += Context_PropertyChanged;
}

public async Task ExecuteAsync()
public async Task ExecuteAsync(object? parameter = null)
{
await Task.WhenAll(context.SelectedItems.Select(selectedItem => Win32Helper.InstallInf(selectedItem.ItemPath)));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/Content/PlayAllAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public PlayAllAction()
context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
return NavigationHelpers.OpenSelectedItemsAsync(context.ShellPage!);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public LaunchPreviewPopupAction()
context.PropertyChanged += Context_PropertyChanged;
}

public async Task ExecuteAsync()
public async Task ExecuteAsync(object? parameter = null)
{
var provider = await previewPopupService.GetProviderAsync();
if (provider is null)
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/Content/RefreshItemsAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public RefreshItemsAction()
context.PropertyChanged += Context_PropertyChanged;
}

public async Task ExecuteAsync()
public async Task ExecuteAsync(object? parameter = null)
{
if (context.ShellPage is null)
return;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/Content/Run/BaseRunAsAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public BaseRunAsAction(string verb)
_context.PropertyChanged += Context_PropertyChanged;
}

public async Task ExecuteAsync()
public async Task ExecuteAsync(object? parameter = null)
{
await ContextMenu.InvokeVerb(_verb, _context.SelectedItem!.ItemPath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public RunWithPowershellAction()
context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
return Win32Helper.RunPowershellCommandAsync($"{context.ShellPage?.SlimContentPage?.SelectedItem?.ItemPath}", false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ClearSelectionAction()
context = Ioc.Default.GetRequiredService<IContentPageContext>();
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.ShellPage?.SlimContentPage?.ItemManipulationModel?.ClearSelection();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public InvertSelectionAction()
context = Ioc.Default.GetRequiredService<IContentPageContext>();
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context?.ShellPage?.SlimContentPage?.ItemManipulationModel?.InvertSelection();

Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/Content/Selection/SelectAllAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public SelectAllAction()
context = Ioc.Default.GetRequiredService<IContentPageContext>();
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.ShellPage?.SlimContentPage?.ItemManipulationModel?.SelectAllItems();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public HotKey HotKey
public bool IsExecutable
=> GetFocusedElement() is not null;

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
if (GetFocusedElement() is SelectorItem item)
item.IsSelected = !item.IsSelected;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/Content/Share/ShareItemAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ShareItemAction()
context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
return ShareItemHelpers.ShareItemsAsync(context.SelectedItems);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/Content/Tags/OpenAllTaggedActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public OpenAllTaggedActions()
_tagsContext.PropertyChanged += Context_PropertyChanged;
}

public async Task ExecuteAsync()
public async Task ExecuteAsync(object? parameter = null)
{
var filePaths = _tagsContext.TaggedItems
.Where(item => !item.isFolder)
Expand Down
16 changes: 8 additions & 8 deletions src/Files.App/Actions/Display/GroupAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public GroupByAction()
DisplayContext.PropertyChanged += DisplayContext_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
DisplayContext.GroupOption = GroupOption;

Expand Down Expand Up @@ -375,7 +375,7 @@ public GroupByDateAction()
DisplayContext.PropertyChanged += DisplayContext_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
DisplayContext.GroupOption = GroupOption;
DisplayContext.GroupByDateUnit = GroupByDateUnit;
Expand Down Expand Up @@ -424,7 +424,7 @@ public GroupAscendingAction()
context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.GroupDirection = SortDirection.Ascending;

Expand Down Expand Up @@ -468,7 +468,7 @@ public GroupDescendingAction()
context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.GroupDirection = SortDirection.Descending;

Expand Down Expand Up @@ -504,7 +504,7 @@ public ToggleGroupDirectionAction()
context = Ioc.Default.GetRequiredService<IDisplayPageContext>();
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.GroupDirection = context.SortDirection is SortDirection.Descending ? SortDirection.Ascending : SortDirection.Descending;

Expand Down Expand Up @@ -535,7 +535,7 @@ public GroupByYearAction()
context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.GroupByDateUnit = GroupByDateUnit.Year;

Expand Down Expand Up @@ -579,7 +579,7 @@ public GroupByMonthAction()
context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.GroupByDateUnit = GroupByDateUnit.Month;

Expand Down Expand Up @@ -615,7 +615,7 @@ public ToggleGroupByDateUnitAction()
context = Ioc.Default.GetRequiredService<IDisplayPageContext>();
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.GroupByDateUnit = context.GroupByDateUnit switch
{
Expand Down
6 changes: 3 additions & 3 deletions src/Files.App/Actions/Display/LayoutAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public ToggleLayoutAction()
Context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
Context.LayoutType = LayoutType;

Expand Down Expand Up @@ -233,7 +233,7 @@ private void UserSettingsService_PropertyChanged(object? sender, PropertyChanged
}
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
switch (DisplayPageContext.LayoutType)
{
Expand Down Expand Up @@ -326,7 +326,7 @@ private void UserSettingsService_PropertyChanged(object? sender, PropertyChanged
}
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
switch (DisplayPageContext.LayoutType)
{
Expand Down
8 changes: 4 additions & 4 deletions src/Files.App/Actions/Display/SortAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public SortByAction()
displayContext.PropertyChanged += DisplayContext_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
displayContext.SortOption = SortOption;

Expand Down Expand Up @@ -206,7 +206,7 @@ public SortAscendingAction()
context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.SortDirection = SortDirection.Ascending;

Expand Down Expand Up @@ -240,7 +240,7 @@ public SortDescendingAction()
context.PropertyChanged += Context_PropertyChanged;
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.SortDirection = SortDirection.Descending;

Expand Down Expand Up @@ -269,7 +269,7 @@ public ToggleSortDirectionAction()
context = Ioc.Default.GetRequiredService<IDisplayPageContext>();
}

public Task ExecuteAsync()
public Task ExecuteAsync(object? parameter = null)
{
context.SortDirection =
context.SortDirection is SortDirection.Descending
Expand Down
Loading