<Window x:Class="butterflow_ui.MainWindow"
        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:System="clr-namespace:System;assembly=mscorlib"
        xmlns:gu="https://github.com/JohanLarsson/Gu.Wpf.Media"
        xmlns:loc="clr-namespace:butterflow_ui.Localization"
        xmlns:butterflow_ui="clr-namespace:butterflow_ui"
        mc:Ignorable="d"
        x:Name="butterflowUIWindow"
        Title="{x:Static loc:Localization.Title}" Width="Auto" Height="Auto"
        Icon="./Icon/icon.ico">
    <Window.Resources>
        <ObjectDataProvider x:Key="enumRegionTypeDataProvider" MethodName="GetValues"
                            ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="butterflow_ui:RegionType"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider x:Key="enumFlowFilterTypeDataProvider" MethodName="GetValues"
                            ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="butterflow_ui:FlowFilterType"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <butterflow_ui:InverseBoolConverter x:Key="InverseBoolConverter" />
        <butterflow_ui:BoolVisibilityConverter x:Key="BoolVisibilityConverter" />
        <butterflow_ui:InverseBoolVisibilityConverter x:Key="InverseBoolVisibilityConverter" />
    </Window.Resources>
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="{x:Static loc:Localization.FileMenu}">
                <MenuItem Name="menuOpen" Header="{x:Static loc:Localization.OpenMenuItem}" Click="menuOpen_Click">
                    <MenuItem.Icon>
                        <ContentControl Template="{StaticResource OpenIcon}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="menuSaveConfiguration" Header="{x:Static loc:Localization.SaveMenuItem}" Click="menuSaveConfiguration_Click">
                    <MenuItem.Icon>
                        <ContentControl Template="{StaticResource SaveIcon}" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="{x:Static loc:Localization.EditMenu}">
                <MenuItem Name="menuCopyArguments" Header="{x:Static loc:Localization.CopyArgumentsMenu}" Click="btnCopyArguments_Click">
                    <MenuItem.Icon>
                        <ContentControl Template="{StaticResource CopyIcon}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Name="menuOptions" Header="{x:Static loc:Localization.OptionsMenu}" Click="menuOptions_Click">
                    <MenuItem.Icon>
                        <ContentControl Template="{StaticResource OptionsIcon}" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Header="{x:Static loc:Localization.HelpMenu}">
                <MenuItem Name="menuButterflowGithub" Header="{x:Static loc:Localization.AboutButterflowMenu}" Click="menuButterflowGithub_Click" >
                    <MenuItem.Icon>
                        <ContentControl Template="{StaticResource LinkIcon}" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="menuButterflowUIGithub" Header="{x:Static loc:Localization.AboutButterflowUIMenu}" Click="menuButterflowUIGithub_Click">
                    <MenuItem.Icon>
                        <ContentControl Template="{StaticResource LinkIcon}" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Name="menuAboutButterflowUI" Header="{x:Static loc:Localization.AboutMenu}" Click="menuAboutButterflowUI_Click">
                    <MenuItem.Icon>
                        <ContentControl Template="{StaticResource QuestionIcon}" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
        </Menu>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.5*" />
                <ColumnDefinition Width="0.5*"/>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <StackPanel Grid.ColumnSpan="3"  Grid.Row="0">
                <GroupBox  Header="{x:Static loc:Localization.FileInputGroupBox}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="0" Content="{x:Static loc:Localization.FileLabel}"/>
                        <TextBox Name="txtFileName" Grid.Column="1" IsReadOnly="True"/>
                        <Button Grid.Column="2" MinWidth="25" Name="btnFilePicker" Click="btnFilePicker_Click">...</Button>
                    </Grid>
                </GroupBox>
                <GroupBox  Header="{x:Static loc:Localization.FileOutputGroupBox}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Label Grid.Column="0" Content="{x:Static loc:Localization.FileLabel}"/>
                        <TextBox Name="txtFileOutputName" Grid.Column="1" IsReadOnly="True" Text="{Binding OptionsConfiguration.VideoOutput, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}"/>
                        <Button Grid.Column="2" MinWidth="25" Name="btnFileOutputPicker" Click="btnFileOutputPicker_Click">...</Button>
                    </Grid>
                </GroupBox>
            </StackPanel>
            <Grid Grid.Column="4" Grid.Row="0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Button Grid.Row="0" Name="btnProcess" ToolTip="{x:Static loc:Localization.ProcessTooltip}" IsEnabled="{Binding ButterflowWrapper.IsRunning, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource InverseBoolConverter}}" Click="btnProcess_Click">
                    <StackPanel Orientation="Horizontal">
                        <ContentControl MaxWidth="16" HorizontalAlignment="Center" Template="{StaticResource RadarIcon}" />
                        <Label Content="{x:Static loc:Localization.ProcessLabel}" />
                    </StackPanel>
                </Button>
                <Button Grid.Row="1" Name="btnCancel" ToolTip="{x:Static loc:Localization.CancelTooltip}" IsEnabled="{Binding ButterflowWrapper.IsRunning, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Click="btnCancel_Click">
                    <StackPanel Orientation="Horizontal">
                        <ContentControl MaxWidth="16" HorizontalAlignment="Center" Template="{StaticResource CancelIcon}" />
                        <Label Content="{x:Static loc:Localization.CancelLabel}" />
                    </StackPanel>
                </Button>
            </Grid>
            <GroupBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Header="{x:Static loc:Localization.CommonOptionsGroupBox}">
                <ScrollViewer>
                    <StackPanel>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.PlaybackRateLabel}" >
                            <StackPanel Orientation="Vertical">
                                <butterflow_ui:ButterflowOption LabelValue="">
                                    <RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._2xLabel}" Tag="2x" />
                                </butterflow_ui:ButterflowOption>
                                <butterflow_ui:ButterflowOption LabelValue="">
                                    <RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._3xLabel}" Tag="3x" />
                                </butterflow_ui:ButterflowOption>
                                <butterflow_ui:ButterflowOption LabelValue="">
                                    <RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._4xLabel}" Tag="4x" />
                                </butterflow_ui:ButterflowOption>
                                <butterflow_ui:ButterflowOption LabelValue="">
                                    <RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._24fpsLabel}" Tag="24"/>
                                </butterflow_ui:ButterflowOption>
                                <butterflow_ui:ButterflowOption LabelValue="">
                                    <RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._30fpsLabel}" Tag="30" />
                                </butterflow_ui:ButterflowOption>
                                <butterflow_ui:ButterflowOption LabelValue="">
                                    <RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._60fpsLabel}" Tag="60" />
                                </butterflow_ui:ButterflowOption>
                                <butterflow_ui:ButterflowOption LabelValue="">
                                    <RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._120fpsLabel}" Tag="120" />
                                </butterflow_ui:ButterflowOption>
                                <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.CustomPlaybackRateLabel}" DescriptionValue="{x:Static loc:Localization.PlaybackRateDescription}">
                                    <TextBox Name="txtPlaybackRate" Text="{Binding OptionsConfiguration.PlaybackRate, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" GotFocus="txtPlaybackRate_GotFocus"  />
                                </butterflow_ui:ButterflowOption>
                            </StackPanel>
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.RenderingLabel}">
                            <StackPanel>
                                <butterflow_ui:ButterflowOption DescriptionValue="{x:Static loc:Localization.KeepAudioDescription}">
                                    <CheckBox IsChecked="{Binding OptionsConfiguration.KeepAudio, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.KeepAudioLabel}" />
                                </butterflow_ui:ButterflowOption>
                                <butterflow_ui:ButterflowOption DescriptionValue="Renders the video with no compression.">
                                    <CheckBox IsChecked="{Binding OptionsConfiguration.LosslessQuality, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.LosslessLabel}" />
                                </butterflow_ui:ButterflowOption>
                            </StackPanel>
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.ResolutionLabel}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="16 " />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <butterflow_ui:ButterflowOption Grid.Column="0" LabelValue="{x:Static loc:Localization.WidthLabel}">
                                    <TextBox Text="{Binding OptionsConfiguration.Width, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
                                </butterflow_ui:ButterflowOption>
                                <ToggleButton Grid.Column="1" IsChecked="{Binding OptionsConfiguration.LockAspectRatio, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" Background="{x:Null}">
                                    <ToggleButton.Style>
                                        <Style TargetType="{x:Type ToggleButton}">
                                            <Setter Property="Content">
                                                <Setter.Value>
                                                    <ContentControl HorizontalAlignment="Center" Template="{StaticResource UnlockedIcon}" />
                                                </Setter.Value>
                                            </Setter>
                                            <Style.Triggers>
                                                <Trigger Property="IsChecked" Value="True">
                                                    <Setter Property="Content">
                                                        <Setter.Value>
                                                            <ContentControl HorizontalAlignment="Center" Template="{StaticResource LockedIcon}" />
                                                        </Setter.Value>
                                                    </Setter>
                                                </Trigger>
                                            </Style.Triggers>
                                        </Style>
                                    </ToggleButton.Style>
                                </ToggleButton>
                                <Button BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntVideoStop_Click">

                                </Button>
                                <butterflow_ui:ButterflowOption Grid.Column="2" LabelValue="{x:Static loc:Localization.HeightLabel}">
                                    <TextBox Text="{Binding OptionsConfiguration.Height, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" IsReadOnly="{Binding OptionsConfiguration.LockAspectRatio, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}">
                                        <TextBox.Style>
                                            <Style TargetType="{x:Type TextBox}">
                                                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlColor}}" />
                                                <Style.Triggers>
                                                    <Trigger Property="IsReadOnly" Value="True">
                                                        <Setter Property="Background" Value="Gray" />
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </TextBox.Style>
                                    </TextBox>
                                </butterflow_ui:ButterflowOption>
                            </Grid>
                        </butterflow_ui:ButterflowOption>
                    </StackPanel>
                </ScrollViewer>
            </GroupBox>
            <GroupBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Header="{x:Static loc:Localization.AdvancedOptionsGroupBox}">
                <ScrollViewer>
                    <StackPanel>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.SubregionsLabel}" DescriptionValue="{x:Static loc:Localization.SubregionsDescription}">
                            <ListView Name="listSubregions" MinHeight="25" ItemsSource="{Binding OptionsConfiguration.Subregions, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}">
                                <ListView.ItemTemplate>
                                    <DataTemplate>
                                        <DockPanel MaxHeight="24">
                                            <TextBlock VerticalAlignment="Center" Text="{x:Static loc:Localization.StartLabel}" />
                                            <TextBlock VerticalAlignment="Center" Text="{Binding Start, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" ToolTip="{Binding Start}"/>
                                            <TextBlock VerticalAlignment="Center" Text="{x:Static loc:Localization.EndLabel}" />
                                            <TextBlock VerticalAlignment="Center" Text="{Binding End, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" ToolTip="{Binding End}"/>
                                            <ComboBox VerticalAlignment="Center" ItemsSource="{Binding Source={StaticResource enumRegionTypeDataProvider}}" SelectedItem="{Binding SubregionType, Mode=TwoWay}"/>
                                            <TextBox VerticalAlignment="Center" MinWidth="35" Text="{Binding Value, Mode=TwoWay}" />
                                            <TextBlock VerticalAlignment="Center" Text="{x:Static loc:Localization.ToEndLabel}" />
                                            <CheckBox VerticalAlignment="Center" IsChecked="{Binding ToEnd, Mode=TwoWay}" />
                                            <Button VerticalAlignment="Center" HorizontalAlignment="Right" Name="btnRemoveSubregion" Click="btnRemoveSubregion_Click" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Tag="{Binding Identifier}">
                                                <ContentControl Template="{StaticResource CancelIcon}" />
                                            </Button>
                                        </DockPanel>
                                    </DataTemplate>
                                </ListView.ItemTemplate>
                            </ListView>
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption DescriptionValue="{x:Static loc:Localization.KeepSubregionsTooltip}">
                            <CheckBox IsChecked="{Binding OptionsConfiguration.KeepSubregions, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.KeepSubregionsLabel}" />
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption DescriptionValue="{x:Static loc:Localization.SmoothMotionTooltip}">
                            <CheckBox IsChecked="{Binding OptionsConfiguration.SmoothMotion, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.SmoothMotionLabel}" />
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption DescriptionValue="{x:Static loc:Localization.FastPyramidsTooltip}">
                            <CheckBox IsChecked="{Binding OptionsConfiguration.FastPyramid, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Content="{x:Static loc:Localization.FastPyramidsLabel}" />
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.PyramidScaleLabel}" DescriptionValue="{x:Static loc:Localization.PyramidScaleTooltip}">
                            <TextBox Text="{Binding OptionsConfiguration.PyramidScale, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.LevelsLabel}" DescriptionValue="{x:Static loc:Localization.LevelsTooltip}">
                            <TextBox Text="{Binding OptionsConfiguration.Levels, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.WindowSizeLabel}" DescriptionValue="{x:Static loc:Localization.WindowSizeTooltip}">
                            <TextBox Text="{Binding OptionsConfiguration.WindowSize, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.IterationsLabel}" DescriptionValue="{x:Static loc:Localization.IterationsTooltip}">
                            <TextBox Text="{Binding OptionsConfiguration.Iterations, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.PixelNeighborhoodLabel}" DescriptionValue="{x:Static loc:Localization.PixelNeighborhoodTooltip}">
                            <TextBox Text="{Binding OptionsConfiguration.PixelNeighborhood, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.SmoothDerivativeLabel}" DescriptionValue="{x:Static loc:Localization.SmoothDerivativeTooltip}">
                            <TextBox Text="{Binding OptionsConfiguration.SmoothDerivativeStandardDeviation, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=LostFocus}" />
                        </butterflow_ui:ButterflowOption>
                        <butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.FlowFilterLabel}" DescriptionValue="{x:Static loc:Localization.FlowFilterTooltip}">
                            <ComboBox ItemsSource="{Binding Source={StaticResource enumFlowFilterTypeDataProvider}}" SelectedItem="{Binding OptionsConfiguration.FlowFilterType, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}"/>
                        </butterflow_ui:ButterflowOption>
                    </StackPanel>
                </ScrollViewer>
            </GroupBox>
            <Grid Grid.Row="1" Grid.RowSpan="2" Grid.Column="2" Grid.ColumnSpan="2">
                <Grid.RowDefinitions>
                    <RowDefinition Height="0.3*" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid Grid.Row="0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" ScrollChanged="ScrollViewer_ScrollChanged">
                        <TextBlock  Name="txtConsoleOutput" Background="Black" Foreground="White" TextWrapping="Wrap" Text="{Binding ButterflowWrapper.ConsoleOutput, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" />
                    </ScrollViewer>
                    <ProgressBar Name="progressBar" Grid.Row="1" Height="10" Minimum="0" Maximum="100" IsEnabled="{Binding ButterflowWrapper.IsRunning, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" Value="{Binding ButterflowWrapper.ProgressPercentage, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}">
                        <ProgressBar.Style>
                            <Style TargetType="ProgressBar">
                                <Setter Property="Visibility" Value="Hidden" />
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="true">
                                        <Setter Property="Visibility" Value="Visible" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </ProgressBar.Style>
                    </ProgressBar>
                </Grid>
                <Canvas x:Name="canvas" Grid.Row="1" Grid.RowSpan="3" Visibility="{Binding OptionsConfiguration.MultipleFiles, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolVisibilityConverter}}">
                    <TextBlock TextAlignment="Center" VerticalAlignment="Center" Width="{Binding ActualWidth, ElementName=canvas}" Height="{Binding ActualHeight, ElementName=canvas}" TextWrapping="WrapWithOverflow" Text="{x:Static loc:Localization.MultipleFilesPreviewWarningLabel}" />
                </Canvas>
                <gu:MediaElementWrapper Grid.Row="1" Name="mediaPreview" Stretch="Uniform" ScrubbingEnabled="True" MediaEnded="mediaPreview_MediaEnded" Visibility="{Binding OptionsConfiguration.MultipleFiles, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource InverseBoolVisibilityConverter}}" />
                <Grid Grid.Row="2" Visibility="{Binding OptionsConfiguration.MultipleFiles, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource InverseBoolVisibilityConverter}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Column="0" Content="{Binding ElementName=mediaPreview, Path=Position, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" />
                    <Slider Grid.Column="1" Name="sliderMedia" 
                            Value="{Binding ElementName=mediaPreview, Path=Position, Converter={x:Static gu:NullableTimeSpanToSecondsConverter.Default}}" 
                            Maximum="{Binding Path=Length, ElementName=mediaPreview, Converter={x:Static gu:NullableTimeSpanToSecondsConverter.Default}}" />
                    <Label Grid.Column="2" Content="{Binding Path=Length, ElementName=mediaPreview, Converter={x:Static gu:TimeSpanToStringConverter.Default}}" />
                </Grid>
                <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Center" Visibility="{Binding OptionsConfiguration.MultipleFiles, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource InverseBoolVisibilityConverter}}">
                    <Button Name="bntVideoBackward" BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntVideoBackward_Click">
                        <ContentControl HorizontalAlignment="Center" Template="{StaticResource BackwardIcon}" />
                    </Button>
                    <Button Name="bntVideoPlay" BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntVideoPlay_Click">
                        <ContentControl HorizontalAlignment="Center" Name="PlayPauseButtonIcon" Template="{StaticResource PlayIcon}" />
                    </Button>
                    <Button Name="bntVideoStop" BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntVideoStop_Click">
                        <ContentControl HorizontalAlignment="Center" Template="{StaticResource StopIcon}" />
                    </Button>
                    <Button Name="bntVideoForward" BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntVideoForward_Click">
                        <ContentControl HorizontalAlignment="Center" Template="{StaticResource ForwardIcon}" />
                    </Button>
                    <Button Name="bntClip" BorderThickness="0" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Click="bntClip_Click">
                        <ContentControl HorizontalAlignment="Center" Name="ClippingButtonIcon" Template="{StaticResource SnipOpenIcon}" />
                    </Button>
                </StackPanel>
            </Grid>
            <StatusBar Grid.Row="3" Grid.ColumnSpan="4">
                <StatusBar.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                        </Grid>
                    </ItemsPanelTemplate>
                </StatusBar.ItemsPanel>
                <StatusBarItem Grid.Column="0">
                    <Button Name="btnCopyArguments" Click="btnCopyArguments_Click">
                        <ContentControl Template="{StaticResource CopyIcon}" />
                    </Button>
                </StatusBarItem>
                <StatusBarItem Grid.Column="1">
                    <TextBlock Text="{Binding OptionsConfiguration.CommandLineOutput, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}}"/>
                </StatusBarItem>
            </StatusBar>
        </Grid>
    </DockPanel>
</Window>
