mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[TUI] Add status bar.
This commit is contained in:
@@ -29,7 +29,11 @@ public sealed partial class MainWindowViewModel : ViewModelBase
|
|||||||
ObservableCollection<FileModel> _files = [];
|
ObservableCollection<FileModel> _files = [];
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
string _informationalVersion;
|
string _informationalVersion;
|
||||||
|
[ObservableProperty]
|
||||||
|
bool _isStatusVisible;
|
||||||
FileModel? _selectedFile;
|
FileModel? _selectedFile;
|
||||||
|
[ObservableProperty]
|
||||||
|
string _status;
|
||||||
|
|
||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
{
|
{
|
||||||
@@ -43,6 +47,7 @@ public sealed partial class MainWindowViewModel : ViewModelBase
|
|||||||
"?.?.?";
|
"?.?.?";
|
||||||
|
|
||||||
Copyright = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyCopyrightAttribute>()?.Copyright ?? "";
|
Copyright = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyCopyrightAttribute>()?.Copyright ?? "";
|
||||||
|
Status = "Loading...";
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileModel? SelectedFile
|
public FileModel? SelectedFile
|
||||||
@@ -89,7 +94,9 @@ public sealed partial class MainWindowViewModel : ViewModelBase
|
|||||||
|
|
||||||
public void LoadFiles()
|
public void LoadFiles()
|
||||||
{
|
{
|
||||||
CurrentPath = Directory.GetCurrentDirectory();
|
IsStatusVisible = true;
|
||||||
|
Status = "Loading...";
|
||||||
|
CurrentPath = Directory.GetCurrentDirectory();
|
||||||
Files.Clear();
|
Files.Clear();
|
||||||
|
|
||||||
var parentDirectory = new FileModel
|
var parentDirectory = new FileModel
|
||||||
@@ -141,6 +148,9 @@ public sealed partial class MainWindowViewModel : ViewModelBase
|
|||||||
|
|
||||||
void Worker()
|
void Worker()
|
||||||
{
|
{
|
||||||
|
IsStatusVisible = true;
|
||||||
|
Status = "Loading file information...";
|
||||||
|
|
||||||
foreach(FileModel file in Files)
|
foreach(FileModel file in Files)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -260,6 +270,9 @@ public sealed partial class MainWindowViewModel : ViewModelBase
|
|||||||
SentrySdk.CaptureException(ex);
|
SentrySdk.CaptureException(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = "Done.";
|
||||||
|
IsStatusVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenSelectedFile()
|
void OpenSelectedFile()
|
||||||
|
|||||||
@@ -20,141 +20,147 @@
|
|||||||
<console:LineBrush LineStyle="DoubleLine"
|
<console:LineBrush LineStyle="DoubleLine"
|
||||||
Brush="Blue" />
|
Brush="Blue" />
|
||||||
</Border.BorderBrush>
|
</Border.BorderBrush>
|
||||||
<Grid ColumnDefinitions="*,*">
|
<Grid RowDefinitions="*,Auto">
|
||||||
<ListBox Grid.Column="0"
|
<Grid ColumnDefinitions="*,*"
|
||||||
ItemsSource="{Binding Files, Mode=OneWay}"
|
Grid.Row="0">
|
||||||
BorderThickness="1"
|
<ListBox Grid.Column="0"
|
||||||
Background="Transparent"
|
ItemsSource="{Binding Files, Mode=OneWay}"
|
||||||
SelectedItem="{Binding SelectedFile, Mode=TwoWay}"
|
BorderThickness="1"
|
||||||
KeyDown="ListBox_OnKeyDown">
|
Background="Transparent"
|
||||||
<ListBox.ItemTemplate>
|
SelectedItem="{Binding SelectedFile, Mode=TwoWay}"
|
||||||
<DataTemplate DataType="models:FileModel">
|
KeyDown="ListBox_OnKeyDown">
|
||||||
<TextBox Text="{Binding Filename, Mode=OneWay}"
|
<ListBox.ItemTemplate>
|
||||||
Foreground="{Binding ForegroundBrush, Mode=OneWay}"
|
<DataTemplate DataType="models:FileModel">
|
||||||
Background="Transparent" />
|
<TextBox Text="{Binding Filename, Mode=OneWay}"
|
||||||
</DataTemplate>
|
Foreground="{Binding ForegroundBrush, Mode=OneWay}"
|
||||||
</ListBox.ItemTemplate>
|
Background="Transparent" />
|
||||||
<ListBox.BorderBrush>
|
</DataTemplate>
|
||||||
<console:LineBrush LineStyle="DoubleLine"
|
</ListBox.ItemTemplate>
|
||||||
Brush="Blue" />
|
<ListBox.BorderBrush>
|
||||||
</ListBox.BorderBrush>
|
<console:LineBrush LineStyle="DoubleLine"
|
||||||
</ListBox>
|
Brush="Blue" />
|
||||||
<Border Grid.Column="1"
|
</ListBox.BorderBrush>
|
||||||
BorderThickness="1">
|
</ListBox>
|
||||||
<Border.BorderBrush>
|
<Border Grid.Column="1"
|
||||||
<console:LineBrush LineStyle="DoubleLine"
|
BorderThickness="1">
|
||||||
Brush="Blue" />
|
<Border.BorderBrush>
|
||||||
</Border.BorderBrush>
|
<console:LineBrush LineStyle="DoubleLine"
|
||||||
<Grid RowDefinitions="Auto,Auto,Auto,*"
|
Brush="Blue" />
|
||||||
VerticalAlignment="Top">
|
</Border.BorderBrush>
|
||||||
<Border Grid.Row="0"
|
<Grid RowDefinitions="Auto,Auto,Auto,*"
|
||||||
BorderThickness="1">
|
VerticalAlignment="Top">
|
||||||
<Border.BorderBrush>
|
<Border Grid.Row="0"
|
||||||
<console:LineBrush LineStyle="DoubleLine"
|
BorderThickness="1">
|
||||||
Brush="Blue" />
|
<Border.BorderBrush>
|
||||||
</Border.BorderBrush>
|
<console:LineBrush LineStyle="DoubleLine"
|
||||||
<StackPanel VerticalAlignment="Top"
|
Brush="Blue" />
|
||||||
HorizontalAlignment="Center">
|
</Border.BorderBrush>
|
||||||
<TextBlock Text="Aaru Data Preservation Suite"
|
|
||||||
Foreground="Red"
|
|
||||||
FontWeight="Bold" />
|
|
||||||
<TextBlock Text="{Binding InformationalVersion, Mode=OneWay}"
|
|
||||||
Foreground="Green"
|
|
||||||
FontWeight="Bold" />
|
|
||||||
<TextBlock Text="{Binding Copyright, Mode=OneWay}"
|
|
||||||
Foreground="Blue"
|
|
||||||
FontWeight="Bold" />
|
|
||||||
</StackPanel>
|
|
||||||
</Border>
|
|
||||||
<Border Grid.Row="1"
|
|
||||||
BorderThickness="1">
|
|
||||||
<Border.BorderBrush>
|
|
||||||
<console:LineBrush LineStyle="DoubleLine"
|
|
||||||
Brush="Blue" />
|
|
||||||
</Border.BorderBrush>
|
|
||||||
<Grid ColumnDefinitions="Auto, *">
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Text="Path: "
|
|
||||||
Foreground="SlateBlue" />
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Text="{Binding CurrentPath, Mode=OneWay}"
|
|
||||||
Foreground="Green" />
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
<Border Grid.Row="2"
|
|
||||||
BorderThickness="1"
|
|
||||||
IsVisible="{Binding IsFileInfoAvailable, Mode=OneWay}">
|
|
||||||
<Border.BorderBrush>
|
|
||||||
<console:LineBrush LineStyle="DoubleLine"
|
|
||||||
Brush="Blue" />
|
|
||||||
</Border.BorderBrush>
|
|
||||||
<Grid RowDefinitions="Auto, *, *, *, *, *">
|
|
||||||
<TextBlock Text="File information"
|
|
||||||
Grid.Row="0"
|
|
||||||
HorizontalAlignment="Center"
|
|
||||||
Foreground="SlateBlue" />
|
|
||||||
<Grid ColumnDefinitions="Auto, *"
|
|
||||||
Grid.Row="1"
|
|
||||||
IsVisible="{Binding SelectedFileIsNotDirectory, Mode=OneWay}">
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Text="Length: " />
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Text="{Binding SelectedFileLength, Mode=OneWay}"
|
|
||||||
Foreground="Aqua" />
|
|
||||||
</Grid>
|
|
||||||
<Grid ColumnDefinitions="Auto, *"
|
|
||||||
Grid.Row="2">
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Text="Creation time: " />
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Text="{Binding SelectedFileCreationTime, Mode=OneWay}"
|
|
||||||
Foreground="Aqua" />
|
|
||||||
</Grid>
|
|
||||||
<Grid ColumnDefinitions="Auto, *"
|
|
||||||
Grid.Row="3">
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Text="Last write time: " />
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Text="{Binding SelectedFileLastWriteTime, Mode=OneWay}"
|
|
||||||
Foreground="Aqua" />
|
|
||||||
</Grid>
|
|
||||||
<Grid ColumnDefinitions="Auto, *"
|
|
||||||
Grid.Row="4">
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Text="Attributes: " />
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Text="{Binding SelectedFileAttributes, Mode=OneWay}"
|
|
||||||
Foreground="Aqua" />
|
|
||||||
</Grid>
|
|
||||||
<Grid ColumnDefinitions="Auto, *"
|
|
||||||
Grid.Row="5">
|
|
||||||
<TextBlock Grid.Column="0"
|
|
||||||
Text="Mode: " />
|
|
||||||
<TextBlock Grid.Column="1"
|
|
||||||
Text="{Binding SelectedFileUnixMode, Mode=OneWay}"
|
|
||||||
Foreground="Aqua" />
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
<Border Grid.Row="3"
|
|
||||||
IsVisible="{Binding SelectedFileHasInformation, Mode=OneWay}"
|
|
||||||
BorderThickness="1">
|
|
||||||
<Border.BorderBrush>
|
|
||||||
<console:LineBrush LineStyle="DoubleLine"
|
|
||||||
Brush="Blue" />
|
|
||||||
</Border.BorderBrush>
|
|
||||||
<ScrollViewer>
|
|
||||||
<StackPanel VerticalAlignment="Top"
|
<StackPanel VerticalAlignment="Top"
|
||||||
HorizontalAlignment="Center">
|
HorizontalAlignment="Center">
|
||||||
<TextBlock Text="Image information"
|
<TextBlock Text="Aaru Data Preservation Suite"
|
||||||
Foreground="SlateBlue"
|
Foreground="Red"
|
||||||
|
FontWeight="Bold" />
|
||||||
|
<TextBlock Text="{Binding InformationalVersion, Mode=OneWay}"
|
||||||
|
Foreground="Green"
|
||||||
|
FontWeight="Bold" />
|
||||||
|
<TextBlock Text="{Binding Copyright, Mode=OneWay}"
|
||||||
|
Foreground="Blue"
|
||||||
FontWeight="Bold" />
|
FontWeight="Bold" />
|
||||||
<TextBlock Text="{Binding SelectedFileInformation, Mode=OneWay}" />
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ScrollViewer>
|
</Border>
|
||||||
</Border>
|
<Border Grid.Row="1"
|
||||||
</Grid>
|
BorderThickness="1">
|
||||||
</Border>
|
<Border.BorderBrush>
|
||||||
|
<console:LineBrush LineStyle="DoubleLine"
|
||||||
|
Brush="Blue" />
|
||||||
|
</Border.BorderBrush>
|
||||||
|
<Grid ColumnDefinitions="Auto, *">
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text="Path: "
|
||||||
|
Foreground="SlateBlue" />
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Text="{Binding CurrentPath, Mode=OneWay}"
|
||||||
|
Foreground="Green" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="2"
|
||||||
|
BorderThickness="1"
|
||||||
|
IsVisible="{Binding IsFileInfoAvailable, Mode=OneWay}">
|
||||||
|
<Border.BorderBrush>
|
||||||
|
<console:LineBrush LineStyle="DoubleLine"
|
||||||
|
Brush="Blue" />
|
||||||
|
</Border.BorderBrush>
|
||||||
|
<Grid RowDefinitions="Auto, *, *, *, *, *">
|
||||||
|
<TextBlock Text="File information"
|
||||||
|
Grid.Row="0"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
Foreground="SlateBlue" />
|
||||||
|
<Grid ColumnDefinitions="Auto, *"
|
||||||
|
Grid.Row="1"
|
||||||
|
IsVisible="{Binding SelectedFileIsNotDirectory, Mode=OneWay}">
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text="Length: " />
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Text="{Binding SelectedFileLength, Mode=OneWay}"
|
||||||
|
Foreground="Aqua" />
|
||||||
|
</Grid>
|
||||||
|
<Grid ColumnDefinitions="Auto, *"
|
||||||
|
Grid.Row="2">
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text="Creation time: " />
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Text="{Binding SelectedFileCreationTime, Mode=OneWay}"
|
||||||
|
Foreground="Aqua" />
|
||||||
|
</Grid>
|
||||||
|
<Grid ColumnDefinitions="Auto, *"
|
||||||
|
Grid.Row="3">
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text="Last write time: " />
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Text="{Binding SelectedFileLastWriteTime, Mode=OneWay}"
|
||||||
|
Foreground="Aqua" />
|
||||||
|
</Grid>
|
||||||
|
<Grid ColumnDefinitions="Auto, *"
|
||||||
|
Grid.Row="4">
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text="Attributes: " />
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Text="{Binding SelectedFileAttributes, Mode=OneWay}"
|
||||||
|
Foreground="Aqua" />
|
||||||
|
</Grid>
|
||||||
|
<Grid ColumnDefinitions="Auto, *"
|
||||||
|
Grid.Row="5">
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text="Mode: " />
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Text="{Binding SelectedFileUnixMode, Mode=OneWay}"
|
||||||
|
Foreground="Aqua" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Row="3"
|
||||||
|
IsVisible="{Binding SelectedFileHasInformation, Mode=OneWay}"
|
||||||
|
BorderThickness="1">
|
||||||
|
<Border.BorderBrush>
|
||||||
|
<console:LineBrush LineStyle="DoubleLine"
|
||||||
|
Brush="Blue" />
|
||||||
|
</Border.BorderBrush>
|
||||||
|
<ScrollViewer>
|
||||||
|
<StackPanel VerticalAlignment="Top"
|
||||||
|
HorizontalAlignment="Center">
|
||||||
|
<TextBlock Text="Image information"
|
||||||
|
Foreground="SlateBlue"
|
||||||
|
FontWeight="Bold" />
|
||||||
|
<TextBlock Text="{Binding SelectedFileInformation, Mode=OneWay}" />
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Grid.Row="1"
|
||||||
|
Text="{Binding Status, Mode=OneWay}"
|
||||||
|
IsVisible="{Binding IsStatusVisible, Mode=OneWay}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|||||||
Reference in New Issue
Block a user