mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[TUI] Added window for images.
This commit is contained in:
39
Aaru.Tui/ViewModels/Windows/ImageWindowViewModel.cs
Normal file
39
Aaru.Tui/ViewModels/Windows/ImageWindowViewModel.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Windows.Input;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
namespace Aaru.Tui.ViewModels.Windows;
|
||||
|
||||
public sealed partial class ImageWindowViewModel : ViewModelBase
|
||||
{
|
||||
readonly string _filename;
|
||||
readonly IBaseImage _imageFormat;
|
||||
readonly Window _view;
|
||||
|
||||
public ImageWindowViewModel(Window view, IBaseImage imageFormat, string filename)
|
||||
{
|
||||
_imageFormat = imageFormat;
|
||||
_filename = filename;
|
||||
_view = view;
|
||||
|
||||
ExitCommand = new RelayCommand(Exit);
|
||||
BackCommand = new RelayCommand(Back);
|
||||
}
|
||||
|
||||
public ICommand BackCommand { get; }
|
||||
public ICommand ExitCommand { get; }
|
||||
|
||||
void Back()
|
||||
{
|
||||
_view.Close();
|
||||
}
|
||||
|
||||
void Exit()
|
||||
{
|
||||
var lifetime = Application.Current!.ApplicationLifetime as IControlledApplicationLifetime;
|
||||
lifetime!.Shutdown();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user