mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[TUI] Implement changing path.
This commit is contained in:
@@ -24,10 +24,12 @@
|
||||
<ListBox Grid.Column="0"
|
||||
ItemsSource="{Binding Files, Mode=OneWay}"
|
||||
BorderThickness="1"
|
||||
Background="Transparent">
|
||||
Background="Transparent"
|
||||
SelectedItem="{Binding SelectedFile, Mode=TwoWay}"
|
||||
KeyDown="ListBox_OnKeyDown">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="models:FileModel">
|
||||
<TextBox Text="{Binding Filename}"
|
||||
<TextBox Text="{Binding Filename, Mode=OneWay}"
|
||||
Foreground="{Binding ForegroundBrush, Mode=OneWay}"
|
||||
Background="Transparent" />
|
||||
</DataTemplate>
|
||||
@@ -56,10 +58,10 @@
|
||||
<TextBlock Text="Aaru Data Preservation Suite"
|
||||
Foreground="Red"
|
||||
FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding InformationalVersion}"
|
||||
<TextBlock Text="{Binding InformationalVersion, Mode=OneWay}"
|
||||
Foreground="Green"
|
||||
FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding Copyright}"
|
||||
<TextBlock Text="{Binding Copyright, Mode=OneWay}"
|
||||
Foreground="Blue"
|
||||
FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
@@ -75,7 +77,7 @@
|
||||
Text="Path: "
|
||||
Foreground="SlateBlue" />
|
||||
<TextBlock Grid.Column="1"
|
||||
Text="{Binding CurrentPath}"
|
||||
Text="{Binding CurrentPath, Mode=OneWay}"
|
||||
Foreground="Green" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Aaru.Tui.ViewModels.Windows;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace Aaru.Tui.Views.Windows;
|
||||
@@ -11,6 +12,18 @@ public partial class MainWindow : Window
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ListBox_OnKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if(e.Key == Key.Enter)
|
||||
{
|
||||
if(DataContext is MainWindowViewModel vm && vm.OpenSelectedFileCommand.CanExecute(null))
|
||||
{
|
||||
vm.OpenSelectedFileCommand.Execute(null);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void OnLoaded(RoutedEventArgs e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user