5d8327f071
- You can now add, remove, modify and move operations - FilterChangedAny was renamed to FilterChanged, the new event for the preview follows the same naming scheme with PreviewChanged - Operations now actually verify that they're enabled (This was originally supposed to be done in the loop in Preview(), but this way seems nicer since it also removes the error label when the operation is disabled) - The foundation has been laid to make it very easy to add more operations
163 lines
7.0 KiB
XML
163 lines
7.0 KiB
XML
<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"
|
|
xmlns:ops="clr-namespace:BFR.Operations;assembly=BFR"
|
|
mc:Ignorable="d" MinWidth="720" MinHeight="480"
|
|
x:Class="BFR.MainWindow"
|
|
Title="BFR">
|
|
<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"/>
|
|
<TextBox Grid.Column="1" IsEnabled="False" Text="{Binding WorkingDirectory}"/>
|
|
<Button Grid.Column="2" Content=" ... " Command="{Binding OpenDirectoryButtonClick}"/>
|
|
|
|
<!-- 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:"/>
|
|
<TextBox Grid.Column="1" Text="{Binding FilterExtension}" KeyUp="FilterChanged"/>
|
|
<TextBlock Grid.Column="2" Text="Name:"/>
|
|
<TextBox Grid.Column="3" Text="{Binding FilterPattern}" KeyUp="FilterChanged"/>
|
|
<TextBlock Grid.Column="4" Text="Full Name:"/>
|
|
<CheckBox Grid.Column="5" IsChecked="{Binding FilterFullName}" Click="FilterChanged"/>
|
|
<TextBlock Grid.Column="6" Text="Regex:"/>
|
|
<CheckBox Grid.Column="7" IsChecked="{Binding FilterRegex}" Click="FilterChanged" Margin="4,4,5,4"/>
|
|
</Grid>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- ListBox Headers -->
|
|
<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"/>
|
|
|
|
<!-- Current and Preview ListBoxes -->
|
|
<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>
|
|
|
|
<!-- Middle Section (Operations, Controls) -->
|
|
<Grid Grid.Row="2" Grid.Column="1" RowDefinitions="*,auto,auto" Classes="StyleBorders">
|
|
<!-- Operations ListBox -->
|
|
<ListBox Grid.Row="0" Items="{Binding Operations}" Name="OperationsListBox" SelectedIndex="{Binding SelectedOperation}"/>
|
|
|
|
<!-- Operations Controls -->
|
|
<Border Grid.Row="1" Classes="ConnectUp">
|
|
<Grid ColumnDefinitions="auto,*,auto,auto,auto">
|
|
<TextBlock Grid.Column="0" Text="New:"/>
|
|
<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"/>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<!-- Commit and Undo Buttons -->
|
|
<Border Grid.Row="2" Classes="ConnectUp">
|
|
<Grid ColumnDefinitions="*,*">
|
|
<Button Grid.Column="0" Content="Undo"/>
|
|
<Button Grid.Column="1" Content="Rename All"/>
|
|
</Grid>
|
|
</Border>
|
|
</Grid>
|
|
</Grid>
|
|
|
|
<Window.Styles>
|
|
<!-- General Styling-->
|
|
<Style Selector="Grid > Expander">
|
|
<Setter Property="Margin" Value="4"/>
|
|
</Style>
|
|
<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>
|
|
<Style Selector="Grid > CheckBox">
|
|
<Setter Property="Margin" Value="4"/>
|
|
<Setter Property="Grid.Column" Value="1"/>
|
|
</Style>
|
|
<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>
|
|
<Style Selector="Grid.StyleBorders > Border">
|
|
<Setter Property="Margin" Value="4"/>
|
|
<Setter Property="Padding" Value="4"/>
|
|
<Setter Property="BorderBrush" Value="Gray"/>
|
|
<Setter Property="BorderThickness" Value="1"/>
|
|
</Style>
|
|
<Style Selector="Border.ConnectUp">
|
|
<Setter Property="Margin" Value="4,-5,4,4"/>
|
|
</Style>
|
|
|
|
<!-- 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>
|
|
</Window.Styles>
|
|
|
|
<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:"/>
|
|
<TextBox Grid.Row="0" Text="{Binding Replacement}" KeyUp="PreviewChanged"/>
|
|
<TextBlock Grid.Row="1" Text="Full Name:"/>
|
|
<CheckBox Grid.Row="1" IsChecked="{Binding FullName}" Click="PreviewChanged"/>
|
|
</Grid>
|
|
</Expander>
|
|
</DataTemplate>
|
|
</Window.DataTemplates>
|
|
|
|
</Window>
|