<UserControl x:Class="_1RM.View.Settings.ProtocolConfig.KittyRunnerSettings"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:controls="clr-namespace:Shawn.Utils.Wpf.Controls;assembly=Shawn.Utils.Wpf"
             xmlns:default="clr-namespace:_1RM.Model.ProtocolRunner.Default"
             mc:Ignorable="d" 
             d:DataContext="{d:DesignInstance default:KittyRunner}"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ProtocolConfiogDictionary.xaml"></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid Style="{StaticResource Block}">
        <Grid.OpacityMask>
            <VisualBrush Visual="{Binding ElementName=Border1}" />
        </Grid.OpacityMask>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Border Name="Border1" Grid.Row="0" Grid.RowSpan="2" 
                Background="{DynamicResource BackgroundBrush}"
                CornerRadius="10" BorderThickness="0">
        </Border>
        <Grid Grid.Row="0" Background="{DynamicResource PrimaryMidBrush}">
            <TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource PrimaryTextBrush}" FontSize="{DynamicResource HeadFontSize}" 
                       Text="{Binding Name}" Margin="5"></TextBlock>
        </Grid>
        <StackPanel Grid.Row="1">
            <Grid Height="20"></Grid>

            <Grid Style="{StaticResource GridOneRow}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="ExternalRunnerColumn1"></ColumnDefinition>
                    <ColumnDefinition Width="290"></ColumnDefinition>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="ExternalRunnerColumn3"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <Grid Width="100" Margin="20 0 10 0" >
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                        <TextBlock Style="{StaticResource TextBlockTitleColumn}" Margin="0 0 5 0" Width="Auto" Text="KiTTY"></TextBlock>
                        <TextBlock Style="{StaticResource TextBlockTitleColumn}" Margin="0" Width="Auto" Text="{DynamicResource 'Exe path'}"></TextBlock>
                    </StackPanel>
                </Grid>
                <TextBox Grid.Column="1" Text="{Binding PuttyExePath, UpdateSourceTrigger=PropertyChanged}" 
                         VerticalContentAlignment="Center"
                         TextWrapping="Wrap"
                         ></TextBox>
                <Button Grid.Column="2" 
                        Style="{StaticResource ButtonPrimaryStyle}" 
                        Margin="5 0 50 0" VerticalAlignment="Top" HorizontalAlignment="Left"
                        Content="{DynamicResource Select}" 
                        Command="{Binding CmdSelectExePath}"></Button>
            </Grid>

            <Grid Style="{StaticResource GridOneRow}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="ExternalRunnerColumn1"></ColumnDefinition>
                    <ColumnDefinition Width="290"></ColumnDefinition>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="ExternalRunnerColumn3"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <TextBlock Style="{StaticResource TextBlockTitleColumn}" Text="{DynamicResource 'Font size'}"></TextBlock>
                <TextBox Grid.Column="1" Text="{Binding PuttyFontSize, UpdateSourceTrigger=PropertyChanged}" VerticalContentAlignment="Center"></TextBox>
            </Grid>

            <Grid Style="{StaticResource GridOneRow}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="ExternalRunnerColumn1"></ColumnDefinition>
                    <ColumnDefinition Width="290"></ColumnDefinition>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="ExternalRunnerColumn3"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <TextBlock Style="{StaticResource TextBlockTitleColumn}" Text="{DynamicResource Themes}"></TextBlock>

                <ComboBox Grid.Column="1" ItemsSource="{Binding PuttyThemeNames}"
                          SelectedItem="{Binding PuttyThemeName}">
                </ComboBox>

                <TextBlock Grid.Column="2" VerticalAlignment="Center" Margin="2 0">
                    <Hyperlink NavigateUri="https://putty.org.ru/themes/" TextDecorations="{x:Null}" controls:HyperlinkHelper.IsOpenExternal="True">
                        (?)
                    </Hyperlink>
                </TextBlock>
            </Grid>

            <Grid Style="{StaticResource GridOneRow}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="ExternalRunnerColumn1"></ColumnDefinition>
                    <ColumnDefinition Width="290"></ColumnDefinition>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="ExternalRunnerColumn3"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <TextBlock Style="{StaticResource TextBlockTitleColumn}" Text="Character set"></TextBlock>

                <ComboBox Grid.Column="1" ItemsSource="{Binding CodePages}"
                          SelectedItem="{Binding LineCodePage}">
                </ComboBox>

                <TextBlock Grid.Column="2" VerticalAlignment="Center" Margin="2 0">
                    <Hyperlink NavigateUri="https://putty.org.ru/themes/" TextDecorations="{x:Null}" controls:HyperlinkHelper.IsOpenExternal="True">
                        (?)
                    </Hyperlink>
                </TextBlock>
            </Grid>
        </StackPanel>
    </Grid>
</UserControl>
