-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
DecompressArchiveToChildFolderAction.cs
50 lines (42 loc) · 1.37 KB
/
DecompressArchiveToChildFolderAction.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) 2024 Files Community
// Licensed under the MIT License. See the LICENSE.
namespace Files.App.Actions
{
internal sealed class DecompressArchiveToChildFolderAction : BaseDecompressArchiveAction
{
public override string Label
=> ComputeLabel();
public override string Description
=> "DecompressArchiveToChildFolderDescription".GetLocalizedResource();
public DecompressArchiveToChildFolderAction()
{
}
public override Task ExecuteAsync()
{
return DecompressHelper.DecompressArchiveToChildFolderAsync(context.ShellPage);
}
protected override void Context_PropertyChanged(object? sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case nameof(IContentPageContext.SelectedItems):
{
if (IsContextPageTypeAdaptedToCommand())
{
OnPropertyChanged(nameof(Label));
OnPropertyChanged(nameof(IsExecutable));
}
break;
}
}
}
private string ComputeLabel()
{
if (context.SelectedItems == null || context.SelectedItems.Count == 0)
return string.Empty;
return context.SelectedItems.Count > 1
? string.Format("BaseLayoutItemContextFlyoutExtractToChildFolder".GetLocalizedResource(), "*")
: string.Format("BaseLayoutItemContextFlyoutExtractToChildFolder".GetLocalizedResource(), SystemIO.Path.GetFileNameWithoutExtension(context.SelectedItems.First().Name));
}
}
}