<Window x:Class="WebSocketTool.Client.ClientWindow"
        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:WebSocketTool.Client"
        mc:Ignorable="d" WindowStartupLocation="CenterScreen"
        Closed="ClientWindow_OnClosed"
        d:DataContext="{d:DesignInstance d:Type=local:ClientViewModel}"
        Title="ClientWindow" Height="450" Width="800">
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="36"/>
            <RowDefinition Height="40"/>
            <RowDefinition Height="120"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid x:Name="WsGrid">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="100"/>
                <ColumnDefinition Width="100"/>
            </Grid.ColumnDefinitions>
            <TextBox x:Name="WsUrlTb" Grid.Column="0" Margin="0,0,10,0" VerticalContentAlignment="Center"
                Text="{Binding WsUrl}"/>
            <Button x:Name="ConnectBtn" Grid.Column="1" Content="连接" Click="ConnectBtn_OnClick" Width="80" Height="32"
                HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand" IsEnabled="{Binding IsConnectEnable, Mode=OneWay}"/>
            <Button x:Name="DisconnectBtn" Grid.Column="2" Content="断开" Click="DisconnectBtn_OnClick" Width="80" Height="32"
                HorizontalAlignment="Center" VerticalAlignment="Center" Cursor="Hand"  IsEnabled="{Binding IsCloseEnable, Mode=OneWay}"/>
        </Grid>
        
        <Grid Grid.Row="1" VerticalAlignment="Center" Height="32" Margin="0,4,0,0">
           <Grid.ColumnDefinitions>
               <ColumnDefinition Width="Auto" />
               <ColumnDefinition Width="2*"/>
               <ColumnDefinition Width="Auto"/>
               <ColumnDefinition Width="*"/>
               <ColumnDefinition Width="Auto"/>
               <ColumnDefinition Width="*"/>
               <ColumnDefinition Width="64"/>
           </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" Text="代理地址:" VerticalAlignment="Center"/>
            <TextBox Grid.Column="1"  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center"
                Text="{Binding ProxyAddress}"/>
            <TextBlock Grid.Column="2" Text="用户名:"  VerticalAlignment="Center" Margin="4,0,0,0"/>
            <TextBox Grid.Column="3"  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center"
                Text="{Binding ProxyUserName}"/>
            <TextBlock Grid.Column="4" Text="密码:"  VerticalAlignment="Center" Margin="4,0,0,0"/>
            <TextBox Grid.Column="5"  VerticalAlignment="Center" Height="32" VerticalContentAlignment="Center"
                Text="{Binding ProxyPassword}"/>
            <CheckBox x:Name="ProxyCb" Grid.Column="6" Content="代理" HorizontalAlignment="Right" VerticalAlignment="Center"
                IsChecked="{Binding IsProxyChecked}"/>
        </Grid>

        <Grid x:Name="OperateGrid" Grid.Row="2" Margin="0,10,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="200"/>
            </Grid.ColumnDefinitions>
            <TextBox x:Name="SendContentTb" Grid.Column="0"  Margin="0,0,10,0" TextWrapping="Wrap"
                VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Text="{Binding SendContent}"/>
            <Grid Grid.Column="1">
                <Grid.RowDefinitions>
                    <RowDefinition Height="36"/>
                    <RowDefinition Height="36"/>
                </Grid.RowDefinitions>
                <TextBlock Text="&lt;---------------------" VerticalAlignment="Center"/>
                <Button Grid.Row="0" x:Name="SendContentBtn" Width="80" Height="32" Content="发送" Click="SendContentBtn_OnClick" 
                    HorizontalAlignment="Right" Cursor="Hand" IsEnabled="{Binding IsCloseEnable, Mode=OneWay}"/>
                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.Row="1" HorizontalAlignment="Left">
                    <TextBlock Text="时间间隔:"></TextBlock>
                    <TextBox x:Name="PingTimeTb" Text="{Binding PingTime}" Width="48" BorderThickness="1" Foreground="Red" Margin="2,0,2,0"/>
                    <TextBlock Text="ms" Foreground="Red"></TextBlock>
                </StackPanel>
                <CheckBox x:Name="SendPingBtn" Grid.Row="1" Content="Ping" Cursor="Hand"
                    IsEnabled="{Binding IsPingEnable, Mode=OneWay}" IsChecked="{Binding IsPingChecked}" 
                    Checked="SendPingBtn_OnChecked" Unchecked="SendPingBtn_OnUnchecked"
                    HorizontalAlignment="Right" VerticalAlignment="Center" VerticalContentAlignment="Center"/>
            </Grid>
        </Grid>

        <TextBox x:Name="InfoTb" Grid.Row="3" Margin="0,10,0,0" TextWrapping="Wrap"
            HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto"/>
    </Grid>
</Window>
