<Window x:Class="ClipCMD.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:local="clr-namespace:ClipCMD"
        mc:Ignorable="d"
        d:DataContext ="{d:DesignInstance {x:Type local:MainWindow}, IsDesignTimeCreatable=True}"
        Title="ClipCMD" Height="450" Width="800"
        Closing="OnClose" StateChanged="OnStateChanged" Icon="logo.ico">

    <Window.Resources>
        <local:EnumBooleanConverter x:Key="EnumBooleanConverter" />
    </Window.Resources>

    <DockPanel>
        <Grid DockPanel.Dock="Top">

            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <StackPanel Grid.Column="0">
                <StackPanel Orientation="Horizontal">
                    <Label Content="Prefix:" Width="45" />
                    <TextBox Text="{Binding Settings.Prefix, UpdateSourceTrigger=PropertyChanged}" MinWidth="50" Height="20" />
                </StackPanel>

                <StackPanel Orientation="Horizontal">
                    <Label Content="Suffix:" Width="45" />
                    <TextBox Text="{Binding Settings.Suffix,UpdateSourceTrigger=PropertyChanged}" MinWidth="50" Height="20" />
                </StackPanel>
            </StackPanel>
            <StackPanel Grid.Column="1" Background="LightBlue" HorizontalAlignment="Right" Margin="10">
                <Label Margin="0" Padding="0">Mode:</Label>
                <StackPanel Orientation="Horizontal">
                    <RadioButton Content="ClipBoard" GroupName="Mode" IsChecked="{Binding Settings.Mode, Converter={StaticResource EnumBooleanConverter}, ConverterParameter=ClipBoard}" Margin="0,0,10,0" />
                    <StackPanel Orientation="Horizontal" IsEnabled="{Binding Settings.Mode, Converter={StaticResource EnumBooleanConverter}, ConverterParameter=ClipBoard}">
                        <CheckBox Content="AutoPaste" IsChecked="{Binding Settings.AutoPaste}" />
                    </StackPanel>
                </StackPanel>
                <Separator />
                <StackPanel Orientation="Horizontal">
                    <RadioButton Content="AutoType" GroupName="Mode" IsChecked="{Binding Settings.Mode, Converter={StaticResource EnumBooleanConverter}, ConverterParameter=AutoType}" Margin="0,0,10,0" />
                    <StackPanel Orientation="Horizontal" IsEnabled="{Binding Settings.Mode, Converter={StaticResource EnumBooleanConverter}, ConverterParameter=AutoType}">
                        <Label Padding="0,0,10,0">Delay:</Label>
                        <TextBox Text="{Binding Settings.AutoTypeDelay, UpdateSourceTrigger=PropertyChanged}" Width="50" Height="20" />
                    </StackPanel>
                </StackPanel>
                <Button Content="Cancel AutoType" Click="CancelAutoTypeButton_Click" IsEnabled="{Binding RuntimeData.AutoTypeRunning}" />
            </StackPanel>
        </Grid>
        <Grid DockPanel.Dock="Top" VerticalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <DockPanel Grid.Column="0">
                <Label DockPanel.Dock="Top" Content="Commands:" />

                <Grid DockPanel.Dock="Bottom">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="100" />
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Margin="4,0,0,3" Text="{Binding RuntimeData.CommandsInfo}" />
                    <Button Grid.Column="1" Background="AliceBlue" Content="Copy to clipboard" Click="CopyToClipboardButton_Click" />
                </Grid>
                <TextBox DockPanel.Dock="Top" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Text="{Binding RuntimeData.CommandsText, UpdateSourceTrigger=PropertyChanged}" Foreground="{Binding RuntimeData.CommandsTextColor}" TextChanged="StaticCommandsTextBox_TextChanged" AcceptsReturn="True" VerticalAlignment="Stretch" />
            </DockPanel>

            <DockPanel Visibility="{Binding RuntimeData.LogPanelVisible}" Grid.Column="1">
                <Label DockPanel.Dock="Top" Content="History:" />
                <ListBox DockPanel.Dock="Top" VerticalAlignment="Stretch" ItemsSource="{Binding RuntimeData.Logs}" />
            </DockPanel>

            <DockPanel Visibility="{Binding RuntimeData.ErrorPanelVisible}" Grid.Column="1">
                <Label DockPanel.Dock="Top" Content="Errors:" />
                <ListBox DockPanel.Dock="Top" Foreground="Red" VerticalAlignment="Stretch" ItemsSource="{Binding RuntimeData.Errors}" />
            </DockPanel>
        </Grid>
    </DockPanel>
</Window>