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
|
||||
{
|
||||
readonly string _filename;
|
||||
readonly IMediaImage _imageFormat;
|
||||
readonly Window _parent;
|
||||
readonly Window _view;
|
||||
[ObservableProperty]
|
||||
public string _filePath;
|
||||
[ObservableProperty]
|
||||
bool _isStatusVisible;
|
||||
[ObservableProperty]
|
||||
ObservableCollection<FileSystemModelNode> _nodes;
|
||||
[ObservableProperty]
|
||||
string? _status;
|
||||
|
||||
public ImageWindowViewModel(Window parent, Window view, IMediaImage imageFormat, string filename)
|
||||
public ImageWindowViewModel(Window parent, Window view, IMediaImage imageFormat, string filePath)
|
||||
{
|
||||
_imageFormat = imageFormat;
|
||||
_filename = filename;
|
||||
FilePath = filePath;
|
||||
_view = view;
|
||||
_parent = parent;
|
||||
|
||||
@@ -60,7 +61,7 @@ public sealed partial class ImageWindowViewModel : ViewModelBase
|
||||
IsStatusVisible = true;
|
||||
Status = "Loading partitions...";
|
||||
|
||||
Nodes = new ObservableCollection<FileSystemModelNode>();
|
||||
Nodes = [];
|
||||
|
||||
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(fs is null) continue;
|
||||
|
||||
var fsNode = new FileSystemModelNode(fs.Name);
|
||||
fsNode.Filesystem = fs;
|
||||
var fsNode = new FileSystemModelNode(fs.Name)
|
||||
{
|
||||
Filesystem = fs
|
||||
};
|
||||
|
||||
subNodes.Add(fsNode);
|
||||
}
|
||||
|
||||
|
||||
@@ -305,8 +305,7 @@ public sealed partial class MainWindowViewModel : ViewModelBase
|
||||
|
||||
var imageWindow = new ImageWindow();
|
||||
|
||||
var imageViewModel =
|
||||
new ImageWindowViewModel(_view, imageWindow, SelectedFile.ImageFormat, SelectedFile.Filename);
|
||||
var imageViewModel = new ImageWindowViewModel(_view, imageWindow, SelectedFile.ImageFormat, SelectedFile.Path);
|
||||
|
||||
imageWindow.DataContext = imageViewModel;
|
||||
imageWindow.Show();
|
||||
|
||||
@@ -27,9 +27,13 @@
|
||||
<brushes:LineBrush LineStyle="DoubleLine"
|
||||
Brush="Blue" />
|
||||
</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.Row="0">
|
||||
Grid.Row="1">
|
||||
<TreeView Grid.Column="0"
|
||||
ItemsSource="{Binding Nodes, Mode=OneWay}"
|
||||
BorderThickness="1">
|
||||
@@ -44,7 +48,7 @@
|
||||
</TreeView.ItemTemplate>
|
||||
</TreeView>
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="1"
|
||||
<TextBlock Grid.Row="2"
|
||||
Text="{Binding Status, Mode=OneWay}"
|
||||
IsVisible="{Binding IsStatusVisible, Mode=OneWay}" />
|
||||
</Grid>
|
||||
|
||||
@@ -5,7 +5,7 @@ using Avalonia.Interactivity;
|
||||
|
||||
namespace Aaru.Tui.Views.Windows;
|
||||
|
||||
public class MainWindow : Window
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user