Refactor application to remove Windows Forms dependencies and transition to Avalonia UI

- Deleted MainWindow.xaml.cs, which contained the WPF implementation of the main window.
- Updated Program.cs to remove Windows Forms initialization and support only Avalonia UI.
- Removed Windows Forms specific code from ViewModelBase, including control marshalling logic.
This commit is contained in:
MaddoScientisto 2026-05-09 14:04:21 +02:00
commit d6b778a648
16 changed files with 64 additions and 4415 deletions

View file

@ -1,53 +0,0 @@
using System;
using System.Windows.Forms;
using System.Windows.Input;
namespace ImageCatalog_2.Commands
{
/// <summary>
/// Helper class to bind WinForms Button controls to ICommand implementations
/// </summary>
public static class ButtonCommandBinder
{
/// <summary>
/// Binds a Button's Click event to an ICommand
/// </summary>
/// <param name="button">The button to bind</param>
/// <param name="command">The command to execute</param>
/// <param name="commandParameter">Optional parameter to pass to the command</param>
public static void BindCommand(this Button button, ICommand command, object commandParameter = null)
{
if (button == null) throw new ArgumentNullException(nameof(button));
if (command == null) throw new ArgumentNullException(nameof(command));
// Wire up the Click event to execute the command
button.Click += (sender, e) =>
{
if (command.CanExecute(commandParameter))
{
command.Execute(commandParameter);
}
};
// Wire up CanExecuteChanged to enable/disable the button
command.CanExecuteChanged += (sender, e) =>
{
button.Enabled = command.CanExecute(commandParameter);
};
// Set initial enabled state
button.Enabled = command.CanExecute(commandParameter);
}
/// <summary>
/// Binds multiple buttons to commands at once
/// </summary>
public static void BindCommands(params (Button button, ICommand command, object parameter)[] bindings)
{
foreach (var (button, command, parameter) in bindings)
{
button.BindCommand(command, parameter);
}
}
}
}