mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
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));
|
|
}
|
|
}
|
|
}
|