1
-
1
+ // Copyright (c) 2023 Files Community
2
+ // Licensed under the MIT License. See the LICENSE.
3
+
2
4
using Files . App . Commands ;
3
5
using Files . App . Contexts ;
4
6
using Files . App . Shell ;
5
7
using Files . Backend . Helpers ;
6
8
7
- namespace Files . App . Actions ;
8
-
9
- internal class InstallCertificateAction : ObservableObject , IAction
9
+ namespace Files . App . Actions
10
10
{
11
- private readonly IContentPageContext context = Ioc . Default . GetRequiredService < IContentPageContext > ( ) ;
11
+ internal class InstallCertificateAction : ObservableObject , IAction
12
+ {
13
+ private readonly IContentPageContext context = Ioc . Default . GetRequiredService < IContentPageContext > ( ) ;
12
14
13
- public string Label => "Install" . GetLocalizedResource ( ) ;
15
+ public string Label => "Install" . GetLocalizedResource ( ) ;
14
16
15
- public string Description => "InstallCertificateDescription" . GetLocalizedResource ( ) ;
17
+ public string Description => "InstallCertificateDescription" . GetLocalizedResource ( ) ;
16
18
17
- public RichGlyph Glyph { get ; } = new ( "\uEB95 " ) ;
19
+ public RichGlyph Glyph { get ; } = new ( "\uEB95 " ) ;
18
20
19
- public bool IsExecutable => context . SelectedItems . Any ( ) &&
20
- context . SelectedItems . All ( x => FileExtensionHelpers . IsCertificateFile ( x . FileExtension ) ) &&
21
- context . PageType is not ContentPageTypes . RecycleBin and not ContentPageTypes . ZipFolder ;
21
+ public bool IsExecutable => context . SelectedItems . Any ( ) &&
22
+ context . SelectedItems . All ( x => FileExtensionHelpers . IsCertificateFile ( x . FileExtension ) ) &&
23
+ context . PageType is not ContentPageTypes . RecycleBin and not ContentPageTypes . ZipFolder ;
22
24
23
- public InstallCertificateAction ( )
24
- {
25
- context . PropertyChanged += Context_PropertyChanged ;
26
- }
25
+ public InstallCertificateAction ( )
26
+ {
27
+ context . PropertyChanged += Context_PropertyChanged ;
28
+ }
27
29
28
- public async Task ExecuteAsync ( )
29
- {
30
- await ContextMenu . InvokeVerb ( "add" , context . SelectedItems . Select ( x => x . ItemPath ) . ToArray ( ) ) ;
31
- }
30
+ public async Task ExecuteAsync ( )
31
+ {
32
+ await ContextMenu . InvokeVerb ( "add" , context . SelectedItems . Select ( x => x . ItemPath ) . ToArray ( ) ) ;
33
+ }
32
34
33
- private void Context_PropertyChanged ( object ? sender , PropertyChangedEventArgs e )
34
- {
35
- if ( e . PropertyName == nameof ( IContentPageContext . SelectedItems ) )
35
+ private void Context_PropertyChanged ( object ? sender , PropertyChangedEventArgs e )
36
36
{
37
- OnPropertyChanged ( nameof ( IsExecutable ) ) ;
37
+ if ( e . PropertyName == nameof ( IContentPageContext . SelectedItems ) )
38
+ {
39
+ OnPropertyChanged ( nameof ( IsExecutable ) ) ;
40
+ }
38
41
}
39
42
}
40
- }
43
+ }
0 commit comments