Skip to content

Commit d528fcc

Browse files
committed
Req
1 parent fef579f commit d528fcc

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/Files.App/Actions/Content/Background/SetAsAppBackgroundAction.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public override RichGlyph Glyph
2222

2323
public override Task ExecuteAsync(object? parameter = null)
2424
{
25-
AppearanceSettingsService.AppThemeBackgroundImageSource = ContentPageContext.SelectedItem.ItemPath;
25+
if (IsExecutable && ContentPageContext.SelectedItem is ListedItem selectedItem)
26+
AppearanceSettingsService.AppThemeBackgroundImageSource = selectedItem.ItemPath;
2627

2728
return Task.CompletedTask;
2829
}

src/Files.App/Actions/Content/Background/SetAsLockscreenBackgroundAction.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@ public override RichGlyph Glyph
2424

2525
public override Task ExecuteAsync(object? parameter = null)
2626
{
27+
if (!IsExecutable || ContentPageContext.SelectedItem is not ListedItem selectedItem)
28+
return false;
29+
2730
try
2831
{
29-
return WindowsWallpaperService.SetLockScreenWallpaper(ContentPageContext.SelectedItem.ItemPath);
32+
return WindowsWallpaperService.SetLockScreenWallpaper(selectedItem.ItemPath);
3033
}
3134
catch (Exception ex)
3235
{
3336
ShowErrorDialog(ex.Message);
34-
App.Logger.LogWarning(ex, ex.Message);
3537

3638
return Task.CompletedTask;
3739
}

src/Files.App/Actions/Content/Background/SetAsSlideshowBackgroundAction.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ public override RichGlyph Glyph
2424

2525
public override Task ExecuteAsync(object? parameter = null)
2626
{
27+
if (!IsExecutable)
28+
return false;
29+
2730
try
2831
{
2932
var paths = ContentPageContext.SelectedItems.Select(item => item.ItemPath).ToArray();
@@ -32,7 +35,6 @@ public override Task ExecuteAsync(object? parameter = null)
3235
catch (Exception ex)
3336
{
3437
ShowErrorDialog(ex.Message);
35-
App.Logger.LogWarning(ex, ex.Message);
3638
}
3739

3840
return Task.CompletedTask;

src/Files.App/Actions/Content/Background/SetAsWallpaperBackgroundAction.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ public override RichGlyph Glyph
2222

2323
public override Task ExecuteAsync(object? parameter = null)
2424
{
25+
if (!IsExecutable || ContentPageContext.SelectedItem is not ListedItem selectedItem)
26+
return false;
27+
2528
try
2629
{
27-
WindowsWallpaperService.SetDesktopWallpaper(ContentPageContext.SelectedItem.ItemPath);
30+
WindowsWallpaperService.SetDesktopWallpaper(selectedItem.ItemPath);
2831
}
2932
catch (Exception ex)
3033
{
3134
ShowErrorDialog(ex.Message);
32-
App.Logger.LogWarning(ex, ex.Message);
3335
}
3436

3537
return Task.CompletedTask;

0 commit comments

Comments
 (0)