-
-
Notifications
You must be signed in to change notification settings - Fork 616
Expand file tree
/
Copy pathCustomExplorerViewModel.cs
More file actions
38 lines (34 loc) · 1.3 KB
/
Copy pathCustomExplorerViewModel.cs
File metadata and controls
38 lines (34 loc) · 1.3 KB
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
using System.Text.Json.Serialization;
using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.Infrastructure.UserSettings
{
public class CustomExplorerViewModel : BaseModel
{
// We should not initialize API in static constructor because it will create another API instance
private static IPublicAPI api = null;
private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService<IPublicAPI>();
public string Name { get; set; }
[JsonIgnore]
public string DisplayName => Name == "Explorer" ? API.GetTranslation("fileManagerExplorer") : Name;
public string Path { get; set; }
public string FileArgument { get; set; } = "\"%d\"";
public string DirectoryArgument { get; set; } = "\"%d\"";
public bool Editable { get; init; } = true;
public CustomExplorerViewModel Copy()
{
return new CustomExplorerViewModel
{
Name = Name,
Path = Path,
FileArgument = FileArgument,
DirectoryArgument = DirectoryArgument,
Editable = Editable
};
}
public void OnDisplayNameChanged()
{
OnPropertyChanged(nameof(DisplayName));
}
}
}