2019-11-13 19:26:04 +00:00
|
|
|
<Window xmlns="https://github.com/avaloniaui"
|
|
|
|
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"
|
2019-11-17 01:22:13 +00:00
|
|
|
xmlns:ops="clr-namespace:BFR.Operations;assembly=BFR"
|
2019-11-13 20:22:36 +00:00
|
|
|
mc:Ignorable="d" MinWidth="720" MinHeight="480"
|
2019-11-13 19:26:04 +00:00
|
|
|
x:Class="BFR.MainWindow"
|
|
|
|
Title="BFR">
|
2019-11-17 15:22:19 +00:00
|
|
|
|
2019-11-14 16:21:25 +00:00
|
|
|
<Grid RowDefinitions="auto,auto,*" ColumnDefinitions="*,*,*" Classes="StyleBorders">
|
|
|
|
<!-- Directory Selection + Filters -->
|
|
|
|
<Border Grid.Row="0" Grid.ColumnSpan="3">
|
|
|
|
<Grid RowDefinitions="*,auto" ColumnDefinitions="auto,*,auto">
|
|
|
|
<Expander Grid.Column="0" Name="FilterExpander" Header="Filter"/>
|
2019-11-14 18:08:21 +00:00
|
|
|
<TextBox Grid.Column="1" IsEnabled="False" Text="{Binding WorkingDirectory}"/>
|
|
|
|
<Button Grid.Column="2" Content=" ... " Command="{Binding OpenDirectoryButtonClick}"/>
|
2019-11-14 16:21:25 +00:00
|
|
|
|
|
|
|
<!-- Filters -->
|
|
|
|
<Grid Grid.Row="1" Grid.ColumnSpan="3" ColumnDefinitions="auto,*,auto,*,auto,auto,auto,auto" IsVisible="{Binding #FilterExpander.IsExpanded}">
|
|
|
|
<TextBlock Grid.Column="0" Text="Extension:"/>
|
2019-11-17 15:22:19 +00:00
|
|
|
<TextBox Grid.Column="1" Text="{Binding FilterExtension}" PropertyChanged="FilterChanged"/>
|
2019-11-14 16:21:25 +00:00
|
|
|
<TextBlock Grid.Column="2" Text="Name:"/>
|
2019-11-17 15:22:19 +00:00
|
|
|
<TextBox Grid.Column="3" Text="{Binding FilterPattern}" PropertyChanged="FilterChanged"/>
|
2019-11-14 16:21:25 +00:00
|
|
|
<TextBlock Grid.Column="4" Text="Full Name:"/>
|
2019-11-17 15:22:19 +00:00
|
|
|
<CheckBox Grid.Column="5" IsChecked="{Binding FilterFullName}" PropertyChanged="FilterChanged"/>
|
2019-11-14 16:21:25 +00:00
|
|
|
<TextBlock Grid.Column="6" Text="Regex:"/>
|
2019-11-17 15:22:19 +00:00
|
|
|
<CheckBox Grid.Column="7" IsChecked="{Binding FilterRegex}" PropertyChanged="FilterChanged" Margin="4,4,5,4"/>
|
2019-11-14 16:21:25 +00:00
|
|
|
</Grid>
|
|
|
|
</Grid>
|
|
|
|
</Border>
|
|
|
|
|
2019-11-13 20:22:36 +00:00
|
|
|
<!-- ListBox Headers -->
|
2019-11-13 22:01:08 +00:00
|
|
|
<TextBox Classes="HeaderTextBox" Grid.Row="1" Grid.Column="0" Text="Before"/>
|
|
|
|
<TextBox Classes="HeaderTextBox" Grid.Row="1" Grid.Column="1" Text="Operations"/>
|
|
|
|
<TextBox Classes="HeaderTextBox" Grid.Row="1" Grid.Column="2" Text="After"/>
|
2019-11-13 20:22:36 +00:00
|
|
|
|
|
|
|
<!-- Current and Preview ListBoxes -->
|
2019-11-14 18:08:21 +00:00
|
|
|
<ListBox Grid.Row="2" Grid.Column="0" Items="{Binding Files}" IsEnabled="False">
|
|
|
|
<ListBox.ItemTemplate>
|
|
|
|
<DataTemplate>
|
|
|
|
<TextBlock Text="{Binding OldFullName}"/>
|
|
|
|
</DataTemplate>
|
|
|
|
</ListBox.ItemTemplate>
|
|
|
|
</ListBox>
|
|
|
|
<ListBox Grid.Row="2" Grid.Column="2" Items="{Binding Files}" IsEnabled="False">
|
|
|
|
<ListBox.ItemTemplate>
|
|
|
|
<DataTemplate>
|
|
|
|
<TextBlock Text="{Binding FullName}"/>
|
|
|
|
</DataTemplate>
|
|
|
|
</ListBox.ItemTemplate>
|
|
|
|
</ListBox>
|
2019-11-13 20:22:36 +00:00
|
|
|
|
|
|
|
<!-- Middle Section (Operations, Controls) -->
|
2019-11-14 16:21:25 +00:00
|
|
|
<Grid Grid.Row="2" Grid.Column="1" RowDefinitions="*,auto,auto" Classes="StyleBorders">
|
2019-11-13 20:22:36 +00:00
|
|
|
<!-- Operations ListBox -->
|
2019-11-17 01:22:13 +00:00
|
|
|
<ListBox Grid.Row="0" Items="{Binding Operations}" Name="OperationsListBox" SelectedIndex="{Binding SelectedOperation}"/>
|
2019-11-13 20:22:36 +00:00
|
|
|
|
|
|
|
<!-- Operations Controls -->
|
2019-11-13 22:01:08 +00:00
|
|
|
<Border Grid.Row="1" Classes="ConnectUp">
|
|
|
|
<Grid ColumnDefinitions="auto,*,auto,auto,auto">
|
|
|
|
<TextBlock Grid.Column="0" Text="New:"/>
|
2019-11-17 01:22:13 +00:00
|
|
|
<ComboBox Grid.Column="1" Items="{Binding OperationTypes}" SelectedIndex="{Binding SelectedOperationType}"/>
|
|
|
|
<Button Grid.Column="2" Content=" + " Command="{Binding AddOperation}"/>
|
|
|
|
<Button Grid.Column="3" Content=" - " Command="{Binding RemoveOperation}"/>
|
|
|
|
<ButtonSpinner Grid.Column="4" Spin="MoveOperation"/>
|
2019-11-13 22:01:08 +00:00
|
|
|
</Grid>
|
|
|
|
</Border>
|
2019-11-13 20:22:36 +00:00
|
|
|
|
|
|
|
<!-- Commit and Undo Buttons -->
|
2019-11-13 22:01:08 +00:00
|
|
|
<Border Grid.Row="2" Classes="ConnectUp">
|
|
|
|
<Grid ColumnDefinitions="*,*">
|
2019-11-17 01:41:05 +00:00
|
|
|
<Button Grid.Column="0" Content="Undo" Command="{Binding Undo}" IsEnabled="{Binding !!UndoCount}"/>
|
|
|
|
<Button Grid.Column="1" Content="Rename All" Command="{Binding Commit}" IsEnabled="{Binding IsCommitButtonEnabled}"/>
|
2019-11-13 22:01:08 +00:00
|
|
|
</Grid>
|
|
|
|
</Border>
|
2019-11-13 20:22:36 +00:00
|
|
|
</Grid>
|
|
|
|
</Grid>
|
2019-11-13 22:01:08 +00:00
|
|
|
|
|
|
|
<Window.Styles>
|
2019-11-17 01:22:13 +00:00
|
|
|
<!-- General Styling-->
|
2019-11-14 16:21:25 +00:00
|
|
|
<Style Selector="Grid > Expander">
|
|
|
|
<Setter Property="Margin" Value="4"/>
|
|
|
|
</Style>
|
2019-11-13 22:01:08 +00:00
|
|
|
<Style Selector="Grid > ListBox">
|
|
|
|
<Setter Property="Margin" Value="4"/>
|
|
|
|
</Style>
|
|
|
|
<Style Selector="Grid > TextBox">
|
|
|
|
<Setter Property="Margin" Value="4"/>
|
|
|
|
<Setter Property="Grid.Column" Value="1"/>
|
|
|
|
</Style>
|
|
|
|
<Style Selector="Grid > Button">
|
|
|
|
<Setter Property="Margin" Value="4"/>
|
|
|
|
<Setter Property="Grid.Column" Value="1"/>
|
|
|
|
</Style>
|
|
|
|
<Style Selector="Grid > ButtonSpinner">
|
|
|
|
<Setter Property="Margin" Value="4"/>
|
|
|
|
<Setter Property="Grid.Column" Value="1"/>
|
|
|
|
</Style>
|
|
|
|
<Style Selector="Grid > ComboBox">
|
|
|
|
<Setter Property="Margin" Value="4"/>
|
|
|
|
<Setter Property="Grid.Column" Value="1"/>
|
|
|
|
</Style>
|
2019-11-17 15:22:19 +00:00
|
|
|
<Style Selector="Grid > NumericUpDown">
|
|
|
|
<Setter Property="Margin" Value="4"/>
|
|
|
|
<Setter Property="Grid.Column" Value="1"/>
|
|
|
|
</Style>
|
2019-11-14 16:21:25 +00:00
|
|
|
<Style Selector="Grid > CheckBox">
|
|
|
|
<Setter Property="Margin" Value="4"/>
|
|
|
|
<Setter Property="Grid.Column" Value="1"/>
|
|
|
|
</Style>
|
2019-11-13 22:01:08 +00:00
|
|
|
<Style Selector="Grid > TextBlock">
|
|
|
|
<Setter Property="Margin" Value="8"/>
|
|
|
|
<Setter Property="Grid.Column" Value="0"/>
|
|
|
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
|
|
|
</Style>
|
|
|
|
<Style Selector="Grid > TextBox.HeaderTextBox">
|
|
|
|
<Setter Property="Margin" Value="4,4,4,-5"/>
|
|
|
|
<Setter Property="TextAlignment" Value="Center"/>
|
|
|
|
<Setter Property="FontWeight" Value="Bold"/>
|
|
|
|
</Style>
|
2019-11-14 16:21:25 +00:00
|
|
|
<Style Selector="Grid.StyleBorders > Border">
|
2019-11-13 22:01:08 +00:00
|
|
|
<Setter Property="Margin" Value="4"/>
|
|
|
|
<Setter Property="Padding" Value="4"/>
|
|
|
|
<Setter Property="BorderBrush" Value="Gray"/>
|
|
|
|
<Setter Property="BorderThickness" Value="1"/>
|
|
|
|
</Style>
|
2019-11-14 16:21:25 +00:00
|
|
|
<Style Selector="Border.ConnectUp">
|
2019-11-13 22:01:08 +00:00
|
|
|
<Setter Property="Margin" Value="4,-5,4,4"/>
|
|
|
|
</Style>
|
2019-11-17 01:22:13 +00:00
|
|
|
|
|
|
|
<!-- Operation Styles -->
|
|
|
|
<Style Selector="Expander.OperationExpander">
|
|
|
|
<Setter Property="Header">
|
|
|
|
<Template>
|
|
|
|
<Grid ColumnDefinitions="auto,*,auto">
|
|
|
|
<CheckBox Grid.Column="0" Margin="0,0,8,0" IsChecked="{Binding IsEnabled}" Command="{Binding $parent[6].DataContext.Preview}"/>
|
|
|
|
<TextBlock Grid.Column="1" Margin="0,0,8,0" Text="{Binding Name}"/>
|
|
|
|
<Grid Grid.Column="2" ToolTip.Tip="{Binding Error}" IsVisible="{Binding !!Error.Length}">
|
|
|
|
<Ellipse Width="18" Height="18" Margin="0" Stroke="DarkRed" StrokeThickness="2"/>
|
|
|
|
<TextBlock Width="18" Height="18" Margin="0" Foreground="DarkRed" Text="!" FontWeight="Black" TextAlignment="Center"/>
|
|
|
|
</Grid>
|
|
|
|
</Grid>
|
|
|
|
</Template>
|
|
|
|
</Setter>
|
|
|
|
</Style>
|
2019-11-13 22:01:08 +00:00
|
|
|
</Window.Styles>
|
2019-11-17 01:22:13 +00:00
|
|
|
|
|
|
|
<Window.DataTemplates>
|
|
|
|
<!-- Operation Type (For the selector) -->
|
|
|
|
<DataTemplate DataType="{x:Type ops:OperationType}">
|
|
|
|
<TextBlock Text="{Binding Name}"/>
|
|
|
|
</DataTemplate>
|
|
|
|
|
|
|
|
<!-- Operations -->
|
|
|
|
<DataTemplate DataType="{x:Type ops:Overwrite}">
|
|
|
|
<Expander Classes="OperationExpander">
|
|
|
|
<Grid ColumnDefinitions="auto,*" RowDefinitions="*,*">
|
|
|
|
<TextBlock Grid.Row="0" Text="Replacement:"/>
|
2019-11-17 15:22:19 +00:00
|
|
|
<TextBox Grid.Row="0" Text="{Binding Replacement}" PropertyChanged="PreviewChanged"/>
|
2019-11-17 01:22:13 +00:00
|
|
|
<TextBlock Grid.Row="1" Text="Full Name:"/>
|
2019-11-17 15:22:19 +00:00
|
|
|
<CheckBox Grid.Row="1" IsChecked="{Binding FullName}" PropertyChanged="PreviewChanged"/>
|
|
|
|
</Grid>
|
|
|
|
</Expander>
|
|
|
|
</DataTemplate>
|
|
|
|
<DataTemplate DataType="{x:Type ops:Replace}">
|
|
|
|
<Expander Classes="OperationExpander">
|
|
|
|
<Grid ColumnDefinitions="auto,*" RowDefinitions="auto,auto,auto,auto,auto,auto,auto,auto,auto,auto,auto">
|
|
|
|
<TextBlock Grid.Row="0" Text="Mode:"/>
|
|
|
|
<ComboBox Grid.Row="0" Items="{Binding Modes}" SelectedItem="{Binding Mode}" PropertyChanged="PreviewChanged">
|
|
|
|
<ComboBox.ItemTemplate>
|
|
|
|
<DataTemplate>
|
|
|
|
<TextBlock Text="{Binding Name}"/>
|
|
|
|
</DataTemplate>
|
|
|
|
</ComboBox.ItemTemplate>
|
|
|
|
</ComboBox>
|
|
|
|
<TextBlock Grid.Row="1" Text="Pattern:" IsVisible="{Binding Mode.IsPatternMode}"/>
|
|
|
|
<TextBox Grid.Row="1" Text="{Binding Pattern}" IsVisible="{Binding Mode.IsPatternMode}" PropertyChanged="PreviewChanged"/>
|
|
|
|
<TextBlock Grid.Row="2" Text="Characters:" IsVisible="{Binding Mode.IsCharactersMode}"/>
|
|
|
|
<TextBox Grid.Row="2" Text="{Binding Characters}" IsVisible="{Binding Mode.IsCharactersMode}" PropertyChanged="PreviewChanged"/>
|
|
|
|
<TextBlock Grid.Row="3" Text="From N:" IsVisible="{Binding Mode.IsFromNToNMode}"/>
|
|
|
|
<NumericUpDown Grid.Row="3" Value="{Binding FromN}" IsVisible="{Binding Mode.IsFromNToNMode}" PropertyChanged="PreviewChanged"/>
|
|
|
|
<TextBlock Grid.Row="4" Text="To N:" IsVisible="{Binding Mode.IsFromNToNMode}"/>
|
|
|
|
<NumericUpDown Grid.Row="4" Value="{Binding ToN}" IsVisible="{Binding Mode.IsFromNToNMode}" PropertyChanged="PreviewChanged"/>
|
|
|
|
<TextBlock Grid.Row="5" Text="First N:" IsVisible="{Binding Mode.IsFirstNMode}"/>
|
|
|
|
<NumericUpDown Grid.Row="5" Value="{Binding FirstN}" IsVisible="{Binding Mode.IsFirstNMode}" PropertyChanged="PreviewChanged"/>
|
|
|
|
<TextBlock Grid.Row="6" Text="Last N:" IsVisible="{Binding Mode.IsLastNMode}"/>
|
|
|
|
<NumericUpDown Grid.Row="6" Value="{Binding LastN}" IsVisible="{Binding Mode.IsLastNMode}" PropertyChanged="PreviewChanged"/>
|
|
|
|
<TextBlock Grid.Row="7" Text="Replacement:"/>
|
|
|
|
<TextBox Grid.Row="7" Text="{Binding Replacement}" PropertyChanged="PreviewChanged"/>
|
|
|
|
<TextBlock Grid.Row="8" Text="Regex:" IsVisible="{Binding Mode.IsPatternMode}"/>
|
|
|
|
<CheckBox Grid.Row="8" IsChecked="{Binding UseRegex}" IsVisible="{Binding Mode.IsPatternMode}" PropertyChanged="PreviewChanged"/>
|
|
|
|
<TextBlock Grid.Row="9" Text="Replace Regex:" IsVisible="{Binding Mode.IsPatternMode}"/>
|
|
|
|
<CheckBox Grid.Row="9" IsChecked="{Binding UseRegexReplace}" IsVisible="{Binding Mode.IsPatternMode}" PropertyChanged="PreviewChanged"/>
|
|
|
|
<TextBlock Grid.Row="10" Text="Full Name:"/>
|
|
|
|
<CheckBox Grid.Row="10" IsChecked="{Binding FullName}" PropertyChanged="PreviewChanged"/>
|
2019-11-17 01:22:13 +00:00
|
|
|
</Grid>
|
|
|
|
</Expander>
|
|
|
|
</DataTemplate>
|
|
|
|
</Window.DataTemplates>
|
2019-11-13 19:26:04 +00:00
|
|
|
</Window>
|