bfr/BFR/MainWindowUIProperties.cs
adroslice c519147302 Added Replace-Operation, structuring and reworked event bindings
- Added Replace-Operation + UI
- Added OperationMode to make it easier to give operations different modes
- Replaced all specific-control-event-handlers with one general PropertyChanged-event-handler for each preview and filter
- TODO: Add Remove-Operation as a subclass of Replace
2019-11-17 16:22:19 +01:00

45 lines
1.9 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
{
private 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>()
};
public readonly AvaloniaProperty<bool> isCommitButtonEnabled =
AvaloniaProperty.Register<MainWindow, bool>("IsCommitButtonEnabled", defaultValue: false);
public bool IsCommitButtonEnabled { get => GetValue(isCommitButtonEnabled); set => SetValue(isCommitButtonEnabled, value); }
public readonly AvaloniaProperty<int> undoCount =
AvaloniaProperty.Register<MainWindow, int>("UndoCount", defaultValue: 0);
public int UndoCount { get => GetValue(undoCount); set => SetValue(undoCount, 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;
}
}