ae7c3a3fff
- OperationMode now designed and implemented in a way that allows serialization - Modes are now defined using an enumeration with with attributes decorated values - MainWindow.xaml.cs's event handlers now only listen for changes to certain properties - Property naming conventions fixed - AvaloniaProperties are now public + static + readonly
46 lines
2.0 KiB
C#
46 lines
2.0 KiB
C#
using System.Collections.Generic;
|
|
|
|
using Avalonia;
|
|
using Avalonia.Collections;
|
|
using Avalonia.Controls;
|
|
|
|
using BFR.DataModels;
|
|
using BFR.Operations;
|
|
|
|
namespace BFR
|
|
{
|
|
public partial class MainWindow : Window
|
|
{
|
|
public static readonly AvaloniaProperty<string> WorkingDirectoryProperty =
|
|
AvaloniaProperty.Register<MainWindow, string>(nameof(WorkingDirectory));
|
|
public string WorkingDirectory { get => GetValue(WorkingDirectoryProperty); set => SetValue(WorkingDirectoryProperty, value); }
|
|
|
|
public AvaloniaList<FileModel> AllFiles { get; } = new AvaloniaList<FileModel>();
|
|
public AvaloniaList<FileModel> Files { get; } = new AvaloniaList<FileModel>();
|
|
public AvaloniaList<Operation> Operations { get; } = new AvaloniaList<Operation>();
|
|
public int SelectedOperation { get; set; }
|
|
|
|
public int SelectedOperationType { get; set; } = 0;
|
|
public OperationType[] OperationTypes { get; } = new[]
|
|
{
|
|
OperationType.Make<Overwrite>(),
|
|
OperationType.Make<Replace>(),
|
|
OperationType.Make<Remove>(),
|
|
};
|
|
|
|
public static readonly AvaloniaProperty<bool> IsCommitButtonEnabledProperty =
|
|
AvaloniaProperty.Register<MainWindow, bool>("IsCommitButtonEnabled", defaultValue: false);
|
|
public bool IsCommitButtonEnabled { get => GetValue(IsCommitButtonEnabledProperty); set => SetValue(IsCommitButtonEnabledProperty, value); }
|
|
public static readonly AvaloniaProperty<int> UndoCountProperty =
|
|
AvaloniaProperty.Register<MainWindow, int>("UndoCount", defaultValue: 0);
|
|
public int UndoCount { get => GetValue(UndoCountProperty); set => SetValue(UndoCountProperty, value); }
|
|
private readonly Stack<List<FileModel>> UndoStack = new Stack<List<FileModel>>();
|
|
|
|
// Filters
|
|
public string FilterExtension { get; set; } = "";
|
|
public string FilterPattern { get; set; } = "";
|
|
public bool FilterFullName { get; set; } = false;
|
|
public bool FilterRegex { get; set; } = false;
|
|
}
|
|
}
|