mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[TUI] Show currently opened image.
This commit is contained in:
@@ -13,21 +13,22 @@ namespace Aaru.Tui.ViewModels.Windows;
|
|||||||
|
|
||||||
public sealed partial class ImageWindowViewModel : ViewModelBase
|
public sealed partial class ImageWindowViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
readonly string _filename;
|
|
||||||
readonly IMediaImage _imageFormat;
|
readonly IMediaImage _imageFormat;
|
||||||
readonly Window _parent;
|
readonly Window _parent;
|
||||||
readonly Window _view;
|
readonly Window _view;
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
|
public string _filePath;
|
||||||
|
[ObservableProperty]
|
||||||
bool _isStatusVisible;
|
bool _isStatusVisible;
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
ObservableCollection<FileSystemModelNode> _nodes;
|
ObservableCollection<FileSystemModelNode> _nodes;
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
string? _status;
|
string? _status;
|
||||||
|
|
||||||
public ImageWindowViewModel(Window parent, Window view, IMediaImage imageFormat, string filename)
|
public ImageWindowViewModel(Window parent, Window view, IMediaImage imageFormat, string filePath)
|
||||||
{
|
{
|
||||||
_imageFormat = imageFormat;
|
_imageFormat = imageFormat;
|
||||||
_filename = filename;
|
FilePath = filePath;
|
||||||
_view = view;
|
_view = view;
|
||||||
_parent = parent;
|
_parent = parent;
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
|||||||
IsStatusVisible = true;
|
IsStatusVisible = true;
|
||||||
Status = "Loading partitions...";
|
Status = "Loading partitions...";
|
||||||
|
|
||||||
Nodes = new ObservableCollection<FileSystemModelNode>();
|
Nodes = [];
|
||||||
|
|
||||||
List<Partition>? partitionsList = Core.Partitions.GetAll(_imageFormat);
|
List<Partition>? partitionsList = Core.Partitions.GetAll(_imageFormat);
|
||||||
|
|
||||||
@@ -98,8 +99,11 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
|||||||
if(!plugins.Filesystems.TryGetValue(pluginName, out IFilesystem? fs)) continue;
|
if(!plugins.Filesystems.TryGetValue(pluginName, out IFilesystem? fs)) continue;
|
||||||
if(fs is null) continue;
|
if(fs is null) continue;
|
||||||
|
|
||||||
var fsNode = new FileSystemModelNode(fs.Name);
|
var fsNode = new FileSystemModelNode(fs.Name)
|
||||||
fsNode.Filesystem = fs;
|
{
|
||||||
|
Filesystem = fs
|
||||||
|
};
|
||||||
|
|
||||||
subNodes.Add(fsNode);
|
subNodes.Add(fsNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -305,8 +305,7 @@ public sealed partial class MainWindowViewModel : ViewModelBase
|
|||||||
|
|
||||||
var imageWindow = new ImageWindow();
|
var imageWindow = new ImageWindow();
|
||||||
|
|
||||||
var imageViewModel =
|
var imageViewModel = new ImageWindowViewModel(_view, imageWindow, SelectedFile.ImageFormat, SelectedFile.Path);
|
||||||
new ImageWindowViewModel(_view, imageWindow, SelectedFile.ImageFormat, SelectedFile.Filename);
|
|
||||||
|
|
||||||
imageWindow.DataContext = imageViewModel;
|
imageWindow.DataContext = imageViewModel;
|
||||||
imageWindow.Show();
|
imageWindow.Show();
|
||||||
|
|||||||
@@ -27,9 +27,13 @@
|
|||||||
<brushes:LineBrush LineStyle="DoubleLine"
|
<brushes:LineBrush LineStyle="DoubleLine"
|
||||||
Brush="Blue" />
|
Brush="Blue" />
|
||||||
</Border.BorderBrush>
|
</Border.BorderBrush>
|
||||||
<Grid RowDefinitions="*,Auto">
|
<Grid RowDefinitions="Auto,*,Auto">
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Text="{Binding FilePath, Mode=OneWay}"
|
||||||
|
Foreground="Green"
|
||||||
|
HorizontalAlignment="Center" />
|
||||||
<Grid ColumnDefinitions="*,*"
|
<Grid ColumnDefinitions="*,*"
|
||||||
Grid.Row="0">
|
Grid.Row="1">
|
||||||
<TreeView Grid.Column="0"
|
<TreeView Grid.Column="0"
|
||||||
ItemsSource="{Binding Nodes, Mode=OneWay}"
|
ItemsSource="{Binding Nodes, Mode=OneWay}"
|
||||||
BorderThickness="1">
|
BorderThickness="1">
|
||||||
@@ -44,7 +48,7 @@
|
|||||||
</TreeView.ItemTemplate>
|
</TreeView.ItemTemplate>
|
||||||
</TreeView>
|
</TreeView>
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock Grid.Row="1"
|
<TextBlock Grid.Row="2"
|
||||||
Text="{Binding Status, Mode=OneWay}"
|
Text="{Binding Status, Mode=OneWay}"
|
||||||
IsVisible="{Binding IsStatusVisible, Mode=OneWay}" />
|
IsVisible="{Binding IsStatusVisible, Mode=OneWay}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using Avalonia.Interactivity;
|
|||||||
|
|
||||||
namespace Aaru.Tui.Views.Windows;
|
namespace Aaru.Tui.Views.Windows;
|
||||||
|
|
||||||
public class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user