File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed
src/Files.App/Actions/Content/Background Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments