1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-05 03:49:53 +00:00
6502bench/SourceGen/Tools/WpfGui/FileConcatenator.xaml

101 lines
5.0 KiB
Plaintext
Raw Normal View History

<!--
Copyright 2019 faddenSoft
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Window x:Class="SourceGen.Tools.WpfGui.FileConcatenator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SourceGen.Tools.WpfGui"
xmlns:system="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="File Concatenator"
SizeToContent="WidthAndHeight" ResizeMode="NoResize"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner">
<Window.Resources>
<system:String x:Key="str_FileAccessFailedCaption">File Access Error</system:String>
<system:String x:Key="str_FileAccessFailedFmt">Unable to access file: {0}</system:String>
<system:String x:Key="str_FileCrcFailed">CRC failed</system:String>
<system:String x:Key="str_SelectFileTitle">Select File</system:String>
<system:String x:Key="str_SuccessCaption">Success</system:String>
<system:String x:Key="str_SuccessMsgFmt">All files were concatenated successfully.&#x0d;&#x0d;Total length is {0}, overall CRC-32 is {1}.</system:String>
</Window.Resources>
<Grid Margin="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Margin="0,0,0,4"
Text="{Binding ConcatItems.Count, StringFormat={}File list ({0} items):}"/>
<DataGrid Name="concatGrid" Grid.Row="1" Height="300" Width="480"
IsReadOnly="True"
ItemsSource="{Binding ConcatItems}"
FontFamily="{StaticResource GeneralMonoFont}"
SnapsToDevicePixels="True"
GridLinesVisibility="All"
VerticalGridLinesBrush="#FF7F7F7F"
HorizontalGridLinesBrush="#FFE2E2E2"
AutoGenerateColumns="False"
HeadersVisibility="Column"
CanUserReorderColumns="False"
CanUserSortColumns="False"
SelectionMode="Single"
VerticalScrollBarVisibility="Visible"
SelectionChanged="ConcatGrid_SelectionChanged">
<DataGrid.Resources>
<!-- make the no-focus color the same as the in-focus color -->
<!-- thanks: https://stackoverflow.com/a/13053511/294248 -->
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}"
Color="{x:Static SystemColors.HighlightColor}"/>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}"
Color="{x:Static SystemColors.HighlightTextColor}"/>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="Filename" Width="298" Binding="{Binding FileName}"/>
<DataGridTextColumn Header="Length" Width="102" Binding="{Binding Length}"/>
<DataGridTextColumn Header="CRC-32" Width="60" Binding="{Binding Crc32}"/>
</DataGrid.Columns>
</DataGrid>
<StackPanel Grid.Row="1" Grid.Column="1" Margin="4,0,0,0">
<Button Width="90" Content="Add Files..." Click="AddButton_Click"/>
<Button Width="90" Margin="0,4,0,0" Content="Remove File"
IsEnabled="{Binding IsRemoveEnabled}" Click="RemoveButton_Click"/>
<Button Width="90" Margin="0,12,0,0" Content="Up"
IsEnabled="{Binding IsUpEnabled}" Click="UpButton_Click"/>
<Button Width="90" Margin="0,4,0,0" Content="Down"
IsEnabled="{Binding IsDownEnabled}" Click="DownButton_Click"/>
</StackPanel>
<StackPanel Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,10,0,0">
<Button Content="Save..." IsDefault="True" Width="70"
IsEnabled="{Binding IsSaveEnabled}" Click="SaveButton_Click"/>
<Button Content="Cancel" IsCancel="True" Width="70" Margin="4,0,0,0"/>
</StackPanel>
</Grid>
</Window>