<UserControl x:Class="DeviceScanner.Controls.NewDevicePlot"
             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:local="clr-namespace:DeviceScanner.Controls"
             mc:Ignorable="d" 
             x:Name="This"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <local:DeviceImageConverter x:Key="ImageConverter"/>
    </UserControl.Resources>
    <Border BorderBrush="DarkGray" Background="#f2f2f2" CornerRadius="16" BorderThickness="1" Margin="8">
        <Grid Margin="12,8">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid Margin="0,8">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="4"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="8"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="4"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0" FontSize="18" Text="{Binding ElementName=This, Path=DeviceInfo.DeviceModel}"/>
                <TextBlock Grid.Row="2" VerticalAlignment="Center" Text="{Binding ElementName=This, Path=DeviceInfo.DeviceSubModel}"/>

                <TextBlock Grid.Row="4" VerticalAlignment="Center" Text="{Binding ElementName=This, Path=DeviceInfo.IP}"/>

                <TextBlock Grid.Row="6" VerticalAlignment="Center" >
                    <Run>Ver:</Run>
                    <Run Text="{Binding ElementName=This, Path=DeviceInfo.SoftwareVersion}"/>
                </TextBlock>

                <Button Grid.Row="8" Height="32" Background="Transparent" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Width="120" BorderBrush="{StaticResource ThemeColor}"
                        Command="{Binding ElementName=This, Path=CreateCommand}" CommandParameter="{Binding ElementName=This, Path=DeviceInfo}">
                    <TextBlock Foreground="{StaticResource ThemeColor}" Margin="8,0">添加设备</TextBlock>
                </Button>
            </Grid>
            <Image Grid.Column="1" Width="180" Source="{Binding ElementName=This, Path=DeviceInfo.DeviceModel, Converter={StaticResource ImageConverter}}" Stretch="Uniform"/>
        </Grid>
    </Border>
</UserControl>
