fixed GSA writing, added always-edit button and search in file and for file
This commit is contained in:
@ -93,10 +93,61 @@
|
||||
<TextBlock DockPanel.Dock="Top" Text="Archive Contents"
|
||||
FontWeight="SemiBold" Padding="8,6" FontSize="13"
|
||||
Background="#EEEEEE"/>
|
||||
|
||||
<!-- Search area -->
|
||||
<StackPanel DockPanel.Dock="Top" Margin="6,6,6,0" Spacing="4"
|
||||
IsEnabled="{Binding HasArchive}">
|
||||
<TextBox Text="{Binding SearchQuery, Mode=TwoWay}"
|
||||
Watermark="Search...">
|
||||
<TextBox.KeyBindings>
|
||||
<KeyBinding Gesture="Enter" Command="{Binding SearchCommand}"/>
|
||||
</TextBox.KeyBindings>
|
||||
</TextBox>
|
||||
<DockPanel>
|
||||
<Button DockPanel.Dock="Right" Content="Search"
|
||||
Command="{Binding SearchCommand}"
|
||||
FontSize="12" Padding="8,3"
|
||||
IsVisible="{Binding SearchInContents}"/>
|
||||
<CheckBox Content="In contents (regex)"
|
||||
IsChecked="{Binding SearchInContents, Mode=TwoWay}"
|
||||
FontSize="12"/>
|
||||
</DockPanel>
|
||||
<TextBlock Text="{Binding SearchStatus}"
|
||||
FontSize="11" Foreground="#777777"
|
||||
IsVisible="{Binding SearchStatus, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Search results -->
|
||||
<ListBox DockPanel.Dock="Top"
|
||||
ItemsSource="{Binding SearchResults}"
|
||||
SelectedItem="{Binding SelectedSearchResult, Mode=TwoWay}"
|
||||
IsVisible="{Binding HasSearchResults}"
|
||||
MaxHeight="220" Margin="6,4,6,4"
|
||||
BorderThickness="1" BorderBrush="#DDDDDD">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Margin="0,1">
|
||||
<TextBlock Text="{Binding Alias}" FontSize="12"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
<TextBlock Text="{Binding Detail}" FontSize="11"
|
||||
Foreground="#777777"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
IsVisible="{Binding HasDetail}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<TreeView Name="ArchiveTree"
|
||||
ItemsSource="{Binding TreeRoots}"
|
||||
SelectionChanged="TreeView_SelectionChanged">
|
||||
|
||||
<TreeView.Styles>
|
||||
<Style Selector="TreeViewItem">
|
||||
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}"/>
|
||||
</Style>
|
||||
</TreeView.Styles>
|
||||
|
||||
<TreeView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<!-- File node operations -->
|
||||
@ -221,14 +272,21 @@
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Hex Dump Preview -->
|
||||
<TextBox IsVisible="{Binding IsHexPreview}"
|
||||
Text="{Binding HexDumpText}"
|
||||
IsReadOnly="True"
|
||||
FontFamily="Consolas, Courier New, monospace"
|
||||
FontSize="13"
|
||||
AcceptsReturn="True"
|
||||
TextWrapping="NoWrap"
|
||||
Margin="10"/>
|
||||
<DockPanel IsVisible="{Binding IsHexPreview}">
|
||||
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal"
|
||||
Spacing="5" Margin="10,6">
|
||||
<Button Content="Edit as Text"
|
||||
Command="{Binding OpenAsTextCommand}"
|
||||
IsVisible="{Binding HasSelectedEntry}"/>
|
||||
</StackPanel>
|
||||
<TextBox Text="{Binding HexDumpText}"
|
||||
IsReadOnly="True"
|
||||
FontFamily="Consolas, Courier New, monospace"
|
||||
FontSize="13"
|
||||
AcceptsReturn="True"
|
||||
TextWrapping="NoWrap"
|
||||
Margin="10,0,10,10"/>
|
||||
</DockPanel>
|
||||
</Panel>
|
||||
|
||||
</Grid>
|
||||
|
||||
@ -59,6 +59,19 @@ public partial class MainWindow : Window
|
||||
{
|
||||
ApplySyntaxHighlighting(vm);
|
||||
}
|
||||
|
||||
if (e.PropertyName == nameof(MainWindowViewModel.SelectedNode))
|
||||
{
|
||||
// Reflect programmatic selection (e.g. from search results) in the tree.
|
||||
// Posted so newly expanded parent containers are realized first.
|
||||
var tree = this.FindControl<TreeView>("ArchiveTree");
|
||||
if (tree != null && vm.SelectedNode != null && !ReferenceEquals(tree.SelectedItem, vm.SelectedNode))
|
||||
{
|
||||
Avalonia.Threading.Dispatcher.UIThread.Post(
|
||||
() => tree.SelectedItem = vm.SelectedNode,
|
||||
Avalonia.Threading.DispatcherPriority.Background);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplySyntaxHighlighting(MainWindowViewModel vm)
|
||||
|
||||
Reference in New Issue
Block a user