This commit is contained in:
Wiesław Šoltés 2021-07-21 22:16:53 +02:00
Родитель 51751c8363
Коммит de25f2220d
1 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -15,6 +15,7 @@ namespace TypefaceUtil.Avalonia.ViewModels
{
public class MainWindowViewModel : ViewModelBase
{
private bool _isLoading;
private string? _inputFile;
private string? _familyName;
private ObservableCollection<string>? _fontFamilies;
@ -22,6 +23,12 @@ namespace TypefaceUtil.Avalonia.ViewModels
private string? _brush;
private TypefaceViewModel? _typeface;
public bool IsLoading
{
get => _isLoading;
set => this.RaiseAndSetIfChanged(ref _isLoading, value);
}
public string? InputFile
{
get => _inputFile;
@ -66,7 +73,7 @@ namespace TypefaceUtil.Avalonia.ViewModels
public ICommand CloseCommand { get; }
public ICommand CopyAllAsCommand { get; }
public ICommand CopyAsCommand { get; }
public MainWindowViewModel()
{
@ -92,12 +99,16 @@ namespace TypefaceUtil.Avalonia.ViewModels
LoadInputFileCommand = ReactiveCommand.CreateFromTask(async () =>
{
IsLoading = true;
await Task.Run(LoadInputFile);
IsLoading = false;
});
LoadFamilyNameCommand = ReactiveCommand.CreateFromTask(async () =>
{
IsLoading = true;
await Task.Run(LoadFamilyName);
IsLoading = false;
});
CloseCommand = ReactiveCommand.Create(() =>
@ -105,7 +116,7 @@ namespace TypefaceUtil.Avalonia.ViewModels
Typeface = null;
});
CopyAllAsCommand = ReactiveCommand.CreateFromTask<string>(async (format) =>
CopyAsCommand = ReactiveCommand.CreateFromTask<string>(async (format) =>
{
if (Typeface?.Glyphs is { })
{