<local:RelhaxCustomFeatureWindow x:Class="RelhaxModpack.Windows.DatabaseAutomationRunner"
        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:RelhaxModpack.Windows"
        mc:Ignorable="d"
        Title="Database Automation Runner" Height="520" Width="1000" MinHeight="480" MinWidth="800"
        Closed="RelhaxWindow_Closed" Loaded="RelhaxWindow_Loaded"
        LocalizeWindow="False" ApplyToolTips="False" EscapeKeyClosesWindow="False">
    <Window.Resources>
        <Style TargetType="Grid" BasedOn="{StaticResource DarkThemeGrid}"/>
    </Window.Resources>
    <Grid>
        <TabControl x:Name="MainTabView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="0" SelectionChanged="MainTabView_SelectionChanged">
            <TabItem x:Name="TabItemRunSequences" Header="Run Sequences">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="2*"/>
                        <ColumnDefinition Width="30"/>
                        <ColumnDefinition Width="2*"/>
                        <ColumnDefinition Width="80"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="15"/>
                        <RowDefinition Height="1*"/>
                        <RowDefinition Height="23"/>
                        <RowDefinition Height="23"/>
                        <RowDefinition Height="3"/>
                    </Grid.RowDefinitions>
                    <TextBlock x:Name="SequencesAvailableTextBlock" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="NoWrap" Grid.Column="0" Grid.Row="0" Text="Sequences available"/>
                    <TextBlock x:Name="SequencesToRunTextBlock" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="NoWrap" Grid.Column="2" Grid.Row="0" Text="Sequences selected to run"/>
                    <ListBox x:Name="SequencesAvailableListBox" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="1" ScrollViewer.CanContentScroll="True" Margin="0,2,2,0"
                             ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Auto" SelectionMode="Extended" MouseDoubleClick="SequencesAvailableListBox_MouseDoubleClick"/>
                    <ListBox x:Name="SequencesToRunListBox" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="2" Grid.Row="1" ScrollViewer.CanContentScroll="True" Margin="2,2,2,0"
                             ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Auto" SelectionMode="Extended" KeyUp="SequencesToRunListBox_KeyUp"/>
                    <Button x:Name="MoveSequencesToRunListButton" Content="&gt;&gt;" HorizontalAlignment="Stretch" VerticalAlignment="Center" Width="30" Height="20" Grid.Column="1" Grid.Row="1" Click="MoveSequencesToRunListButton_Click"/>
                    <Button x:Name="MoveUpSelectedSequenceButton" HorizontalAlignment="Stretch" Margin="0,0,0,100" VerticalAlignment="Center" Height="40" Grid.Column="3" Grid.Row="1" Click="MoveUpSelectedSequenceButton_Click">
                        <TextBlock Text="Move up selected" TextWrapping="Wrap" TextAlignment="Center"/>
                    </Button>
                    <Button x:Name="MoveDownSelectedSequenceButton" HorizontalAlignment="Stretch" Margin="0,0,0,0" VerticalAlignment="Center" Height="45" Grid.Column="3" Grid.Row="1" Click="MoveDownSelectedSequenceButton_Click">
                        <TextBlock Text="Move down selected" TextWrapping="Wrap" TextAlignment="Center"/>
                    </Button>
                    <Button x:Name="RemoveSelectedSequenceButton" HorizontalAlignment="Stretch" Margin="0,100,0,0" VerticalAlignment="Center" Height="40" Grid.Column="3" Grid.Row="1" Click="RemoveSelectedSequenceButton_Click">
                        <TextBlock Text="Remove selected" TextWrapping="Wrap" TextAlignment="Center"/>
                    </Button>
                    <Button x:Name="RemoveAllSequenceButton" HorizontalAlignment="Stretch" Margin="0,200,0,0" VerticalAlignment="Center" Height="40" Grid.Column="3" Grid.Row="1" Click="RemoveAllSequenceButton_Click">
                        <TextBlock Text="Remove all" TextWrapping="Wrap" TextAlignment="Center"/>
                    </Button>
                    <StackPanel Orientation="Horizontal" FlowDirection="RightToLeft" Grid.Row="2" Grid.Column="2" Margin="0,0,2,0">
                        <Button x:Name="ReloadSequencesButton" HorizontalAlignment="Right" Margin="0,3,0,0" VerticalAlignment="Stretch" Padding="3,1,3,1" Click="ReloadSequencesButton_Click">
                            <TextBlock Text="Reload Sequences"/>
                        </Button>
                        <Button x:Name="OpenLogfileViewerButton" HorizontalAlignment="Right" Margin="10,3,0,0" VerticalAlignment="Stretch" Padding="3,1,3,1" Click="OpenLogfileViewerButton_Click">
                            <TextBlock Text="Open Logfile Viewer"/>
                        </Button>
                        <Button x:Name="OpenHtmlPathSelectorButton" HorizontalAlignment="Right" Margin="10,3,0,0" VerticalAlignment="Stretch" Padding="3,1,3,1" Click="OpenHtmlPathSelectorButton_Click">
                            <TextBlock Text="Open HtmlPath Selector"/>
                        </Button>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal" FlowDirection="RightToLeft" Grid.Row="3" Grid.Column="2" Margin="0,0,2,0">
                        <Button x:Name="CleanWorkingDirectoriesButton" HorizontalAlignment="Right" Margin="0,3,0,0" VerticalAlignment="Stretch" Padding="3,1,3,1" Click="CleanWorkingDirectoriesButton_Click">
                            <TextBlock Text="Clean Working Directories"/>
                        </Button>
                    </StackPanel>
                    <Button x:Name="RunSequencesButton" HorizontalAlignment="Stretch" Margin="3,3,2,0" VerticalAlignment="Stretch" Grid.Row="3" Grid.Column="3" Click="RunSequencesButton_Click">
                        <TextBlock Text="Run" TextWrapping="Wrap" TextAlignment="Center"/>
                    </Button>
                    <ProgressBar x:Name="AutomationTaskProgressBar" HorizontalAlignment="Stretch" Grid.Row="2" Grid.Column="0" VerticalAlignment="Stretch" Visibility="Hidden" Margin="0,0,2,0"/>
                    <TextBlock x:Name="AutomationTaskProgressTextBlock" HorizontalAlignment="Stretch" Margin="0,0,2,0" Grid.Row="2" Grid.Column="0" VerticalAlignment="Stretch" Visibility="Hidden" Text="Test" TextAlignment="Center"/>
                </Grid>
            </TabItem>
            <TabItem x:Name="TabItemSettings" Header="Settings">
                <Grid Style="{StaticResource DarkThemeStyleBackgroundGridInTabItem}">
                    <Grid Margin="0,0,0,20" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <Grid.RowDefinitions>
                            <!-- Bigmods user/pass -->
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <!-- Checkboxes -->
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <!-- Package db save/load -->
                            <RowDefinition Height="40"/>
                            <!-- Automation repo branch selection -->
                            <RowDefinition Height="40"/>
                            <!-- Use local automation repo on disk -->
                            <RowDefinition Height="20"/>
                            <!-- Select wot location for {clientPath} macro -->
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="150"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock x:Name="BigmodsUsernameTextBox" HorizontalAlignment="Stretch" TextWrapping="Wrap" Text="Bigmods Username" VerticalAlignment="Center" Grid.Column="0" Grid.Row="0"
                                       ToolTip="Enter your FTP account user name to be able to run package upload/download tasks"/>
                        <TextBox x:Name="BigmodsUsernameSetting" HorizontalAlignment="Stretch" TextWrapping="Wrap" VerticalAlignment="Center" Grid.Column="1" Grid.Row="0" TextChanged="BigmodsUsernameSetting_TextChanged" Margin="2,0,0,0"/>
                        <TextBlock x:Name="BigmodsPasswordTextBox" HorizontalAlignment="Stretch" TextWrapping="Wrap" Text="Bigmods Password" VerticalAlignment="Center" Grid.Column="0" Grid.Row="1"
                                       ToolTip="Enter your FTP account password to be able to run package upload/download tasks"/>
                        <TextBox x:Name="BigmodsPasswordSetting" HorizontalAlignment="Stretch" TextWrapping="Wrap" VerticalAlignment="Center" Grid.Column="1" Grid.Row="1" TextChanged="BigmodsPasswordSetting_TextChanged" Margin="2,0,0,0"/>
                        <CheckBox x:Name="OpenLogWindowOnStartupSetting" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Column="1" Grid.Row="2" Content="Open log window on startup" Margin="2,0,0,0"
                                      Click="OpenLogWindowOnStartupSetting_Click" ToolTip="When checked, the log window will start when you launch the application in this mode"/>
                        <CheckBox x:Name="DumpParsedMacrosPerSequenceRunSetting" Grid.Column="1" HorizontalAlignment="Left"  Grid.Row="3" VerticalAlignment="Center" Content="Dump parsed macros for each sequence during run" Margin="2,0,0,0"
                                      Click="DumpParsedMacrosPerSequenceRunSetting_Click" ToolTip="When checked, the list of macros will be dumped to the logfile at the start of each sequence"/>
                        <CheckBox x:Name="DumpEnvironmentVariablesAtSequenceStartSetting" Grid.Column="1" HorizontalAlignment="Left"  Grid.Row="4" VerticalAlignment="Center" Content="Dump environment variables at the start of the sequencer" Margin="2,0,0,0"
                                      Click="DumpEnvironmentVariablesAtSequenceStartSetting_Click" ToolTip="When checked, the list of system environment variables will be dumped to the logfile at the start of the sequencer"/>
                        <CheckBox x:Name="SuppressDebugMessagesSetting" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="5" VerticalAlignment="Center" Content="Suppress debug messages in the log window" Margin="2,0,0,0"
                                      Click="SuppressDebugMessagesSetting_Click" ToolTip="When enabled, DEBUG level messages will NOT be put out to the log window"/>
                        <CheckBox x:Name="ClearLogWindowOnSequenceRunSetting" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="6" VerticalAlignment="Center" Content="Clear log window on sequence start" Margin="2,0,0,0"
                                      Click="ClearLogWindowOnSequenceRunSetting_Click" ToolTip="When enabled, DEBUG level messages will NOT be put out to the log window"/>
                        <CheckBox x:Name="ClearLogFileOnSequenceRunSetting" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="7" VerticalAlignment="Center" Content="Clear log file on sequence start" Margin="2,0,0,0"
                                      Click="ClearLogFileOnSequenceRunSetting_Click" ToolTip="When enabled, DEBUG level messages will NOT be put out to the log window"/>
                        <Button x:Name="SelectDBSaveLocationButton" HorizontalAlignment="Stretch" Grid.Row="8" VerticalAlignment="Center" Click="SelectDBSaveLocationButton_Click"
                                    ToolTip="Select the location to use for loading and saving the database for automation runs. This path *must* go to the root database xml file!">
                            <TextBlock Text="Package database load/save root xml" TextWrapping="Wrap"/>
                        </Button>
                        <TextBox x:Name="SelectDBSaveLocationSetting" Grid.Column="1" HorizontalAlignment="Stretch" Grid.Row="8" TextWrapping="Wrap" VerticalAlignment="Center" TextChanged="SelectDBSaveLocationSetting_TextChanged" Margin="2,0,0,0"/>
                        <TextBlock x:Name="AutomamtionDatabaseSelectedBranchTextBox" HorizontalAlignment="Stretch" TextWrapping="Wrap" Text="Automation repository selected branch" VerticalAlignment="Center" Grid.Column="0" Grid.Row="9" TextAlignment="Left"
                                       ToolTip="Enter the target branch to use for the automation repo. If 'Use local repo database on disk' is checked, this setting has no effect. The default is 'master'."/>
                        <TextBox x:Name="AutomamtionDatabaseSelectedBranchSetting" Grid.Column="1" HorizontalAlignment="Stretch" Grid.Row="9" TextWrapping="Wrap" VerticalAlignment="Center" TextChanged="AutomamtionDatabaseSelectedBranchSetting_TextChanged" Margin="2,0,0,0"/>
                        <CheckBox x:Name="UseLocalRunnerDatabaseSetting" Grid.Column="1" HorizontalAlignment="Left"  Grid.Row="10" VerticalAlignment="Center" Content="Use local automation repository on disk" Margin="2,0,0,0"
                                      Click="UseLocalRunnerDatabaseSetting_Click" ToolTip="Toggle using a local copy of the automation sequence repo, or the server version"/>
                        <Button x:Name="LocalRunnerDatabaseRootButton" HorizontalAlignment="Stretch" Grid.Row="11" VerticalAlignment="Center" Click="SelectLocalRunnerDatabaseRootButton_Click"
                                    ToolTip="Select the location to use for loading the local copy of the automation repo on disk. This path *must* go to the root database xml file!">
                            <TextBlock Text="Automation database root xml" TextWrapping="Wrap"/>
                        </Button>
                        <TextBox x:Name="LocalRunnerDatabaseRootSetting" Grid.Column="1" HorizontalAlignment="Stretch" Grid.Row="11" TextWrapping="Wrap" VerticalAlignment="Center" TextChanged="LocalRunnerDatabaseRootSetting_TextChanged" Margin="2,0,0,0"/>
                        <Button x:Name="SelectWoTInstallLocationButton" HorizontalAlignment="Stretch" Grid.Row="12" VerticalAlignment="Center" Click="SelectWoTInstallLocationButton_Click"
                                    ToolTip="Select the location to use for the {clientPath} macro">
                            <TextBlock Text="Select WoT install location" TextWrapping="Wrap"/>
                        </Button>
                        <TextBox x:Name="SelectWoTInstallLocationSetting" Grid.Column="1" HorizontalAlignment="Stretch" Grid.Row="12" TextWrapping="Wrap" VerticalAlignment="Center" TextChanged="SelectWoTInstallLocationSetting_TextChanged" Margin="2,0,0,0"/>
                        <TextBlock Text="User Macro 1" ToolTip="Put the name of the macro in the left box, the value in the right box" HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.Column="0" Grid.Row="13"/>
                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="13">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="1*"/>
                                <ColumnDefinition Width="1*"/>
                            </Grid.ColumnDefinitions>
                            <TextBox x:Name="UserMacro1Name" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,1,0" TextChanged="UserMacro1Name_TextChanged"/>
                            <TextBox x:Name="UserMacro1Value" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="1,0,1,0" TextChanged="UserMacro1Value_TextChanged"/>
                        </Grid>
                        <TextBlock Text="User Macro 2" ToolTip="Put the name of the macro in the left box, the value in the right box" HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.Column="0" Grid.Row="14"/>
                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="14">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="1*"/>
                                <ColumnDefinition Width="1*"/>
                            </Grid.ColumnDefinitions>
                            <TextBox x:Name="UserMacro2Name" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,1,0" TextChanged="UserMacro2Name_TextChanged"/>
                            <TextBox x:Name="UserMacro2Value" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="1,0,1,0" TextChanged="UserMacro2Value_TextChanged"/>
                        </Grid>
                        <TextBlock Text="User Macro 3" ToolTip="Put the name of the macro in the left box, the value in the right box" HorizontalAlignment="Stretch" VerticalAlignment="Top" Grid.Column="0" Grid.Row="15"/>
                        <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="15">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="1*"/>
                                <ColumnDefinition Width="1*"/>
                            </Grid.ColumnDefinitions>
                            <TextBox x:Name="UserMacro3Name" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,1,0" TextChanged="UserMacro3Name_TextChanged"/>
                            <TextBox x:Name="UserMacro3Value" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="1,0,1,0" TextChanged="UserMacro3Value_TextChanged"/>
                        </Grid>
                    </Grid>
                    <Button x:Name="SaveSettingsButton" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="SaveSettingsButton_Click">
                        <TextBlock Text="Save Settings"/>
                    </Button>
                </Grid>
            </TabItem>
        </TabControl>
    </Grid>
</local:RelhaxCustomFeatureWindow>
