File tree Expand file tree Collapse file tree 7 files changed +51
-0
lines changed
Actions/Content/Background Expand file tree Collapse file tree 7 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2024 Files Community
2
+ // Licensed under the MIT License. See the LICENSE.
3
+
4
+ namespace Files . App . Actions
5
+ {
6
+ internal sealed class SetAsAppBackgroundAction : BaseSetAsAction
7
+ {
8
+ private IAppearanceSettingsService AppearanceSettingsService { get ; } = Ioc . Default . GetRequiredService < IAppearanceSettingsService > ( ) ;
9
+
10
+ public override string Label
11
+ => "SetAsAppBackground" . GetLocalizedResource ( ) ;
12
+
13
+ public override string Description
14
+ => "SetAsAppBackgroundDescription" . GetLocalizedResource ( ) ;
15
+
16
+ public override RichGlyph Glyph
17
+ => new ( "\uE91B " ) ;
18
+
19
+ public override bool IsExecutable =>
20
+ base . IsExecutable &&
21
+ context . SelectedItem is not null ;
22
+
23
+ public override Task ExecuteAsync ( )
24
+ {
25
+ if ( context . SelectedItem is not null )
26
+ AppearanceSettingsService . AppThemeBackgroundImageSource = context . SelectedItem . ItemPath ;
27
+
28
+ return Task . CompletedTask ;
29
+ }
30
+ }
31
+ }
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ public enum CommandCodes
71
71
SetAsWallpaperBackground ,
72
72
SetAsSlideshowBackground ,
73
73
SetAsLockscreenBackground ,
74
+ SetAsAppBackground ,
74
75
75
76
// Install
76
77
InstallFont ,
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ public IRichCommand this[HotKey hotKey]
76
76
public IRichCommand SetAsWallpaperBackground => commands [ CommandCodes . SetAsWallpaperBackground ] ;
77
77
public IRichCommand SetAsSlideshowBackground => commands [ CommandCodes . SetAsSlideshowBackground ] ;
78
78
public IRichCommand SetAsLockscreenBackground => commands [ CommandCodes . SetAsLockscreenBackground ] ;
79
+ public IRichCommand SetAsAppBackground => commands [ CommandCodes . SetAsAppBackground ] ;
79
80
public IRichCommand CopyItem => commands [ CommandCodes . CopyItem ] ;
80
81
public IRichCommand CopyPath => commands [ CommandCodes . CopyPath ] ;
81
82
public IRichCommand CopyPathWithQuotes => commands [ CommandCodes . CopyPathWithQuotes ] ;
@@ -249,6 +250,7 @@ public IEnumerator<IRichCommand> GetEnumerator() =>
249
250
[ CommandCodes . SetAsWallpaperBackground ] = new SetAsWallpaperBackgroundAction ( ) ,
250
251
[ CommandCodes . SetAsSlideshowBackground ] = new SetAsSlideshowBackgroundAction ( ) ,
251
252
[ CommandCodes . SetAsLockscreenBackground ] = new SetAsLockscreenBackgroundAction ( ) ,
253
+ [ CommandCodes . SetAsAppBackground ] = new SetAsAppBackgroundAction ( ) ,
252
254
[ CommandCodes . CopyItem ] = new CopyItemAction ( ) ,
253
255
[ CommandCodes . CopyPath ] = new CopyPathAction ( ) ,
254
256
[ CommandCodes . CopyPathWithQuotes ] = new CopyPathWithQuotesAction ( ) ,
Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ public interface ICommandManager : IEnumerable<IRichCommand>
67
67
IRichCommand SetAsWallpaperBackground { get ; }
68
68
IRichCommand SetAsSlideshowBackground { get ; }
69
69
IRichCommand SetAsLockscreenBackground { get ; }
70
+ IRichCommand SetAsAppBackground { get ; }
70
71
71
72
IRichCommand InstallFont { get ; }
72
73
IRichCommand InstallInfDriver { get ; }
Original file line number Diff line number Diff line change @@ -411,6 +411,7 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseItemMenuItems(
411
411
new ContextMenuFlyoutItemViewModelBuilder ( Commands . SetAsWallpaperBackground ) . Build ( ) ,
412
412
new ContextMenuFlyoutItemViewModelBuilder ( Commands . SetAsLockscreenBackground ) . Build ( ) ,
413
413
new ContextMenuFlyoutItemViewModelBuilder ( Commands . SetAsSlideshowBackground ) . Build ( ) ,
414
+ new ContextMenuFlyoutItemViewModelBuilder ( Commands . SetAsAppBackground ) . Build ( ) ,
414
415
]
415
416
} ,
416
417
new ContextMenuFlyoutItemViewModelBuilder ( Commands . RotateLeft )
Original file line number Diff line number Diff line change 339
339
<data name =" SetAsLockscreen" xml : space =" preserve" >
340
340
<value >Set as lockscreen background</value >
341
341
</data >
342
+ <data name =" SetAsAppBackground" xml : space =" preserve" >
343
+ <value >Set as app background</value >
344
+ </data >
342
345
<data name =" AccessDeniedDeleteDialog.Text" xml : space =" preserve" >
343
346
<value >We weren't able to delete this item</value >
344
347
</data >
2463
2466
<data name =" SetAsLockscreenBackgroundDescription" xml : space =" preserve" >
2464
2467
<value >Set selected picture as lockscreen background</value >
2465
2468
</data >
2469
+ <data name =" SetAsAppBackgroundDescription" xml : space =" preserve" >
2470
+ <value >Set selected picture as the app background</value >
2471
+ </data >
2466
2472
<data name =" InstallFontDescription" xml : space =" preserve" >
2467
2473
<value >Install selected font(s)</value >
2468
2474
</data >
Original file line number Diff line number Diff line change 384
384
<FontIcon Glyph =" {x:Bind Commands.SetAsLockscreenBackground.Glyph.BaseGlyph}" />
385
385
</MenuFlyoutItem .Icon>
386
386
</MenuFlyoutItem >
387
+ <MenuFlyoutItem
388
+ x:Name=" SetAsAppBackgroundFlyoutItem"
389
+ Command=" {x:Bind Commands.SetAsAppBackground}"
390
+ KeyboardAcceleratorTextOverride=" {x:Bind Commands.SetAsAppBackground.HotKeyText, Mode=OneWay}"
391
+ Text=" {helpers:ResourceString Name=Application}" >
392
+ <MenuFlyoutItem .Icon>
393
+ <FontIcon Glyph =" {x:Bind Commands.SetAsAppBackground.Glyph.BaseGlyph}" />
394
+ </MenuFlyoutItem .Icon>
395
+ </MenuFlyoutItem >
387
396
</MenuFlyout >
388
397
</AppBarButton .Flyout>
389
398
You can’t perform that action at this time.
0 commit comments