<Window x:Class="EEMSUIClient.Views.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:EEMSUIClient.Views"
        xmlns:prism="http://prismlibrary.com/"
        prism:ViewModelLocator.AutoWireViewModel="True"
        mc:Ignorable="d"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:GeneralData="clr-namespace:GeneralData;assembly=GeneralData"
        xmlns:Convert="clr-namespace:EEMSUIClient.Converter"
        Title="EEMS Client" Height="450" Width="900"
        WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" WindowStyle="SingleBorderWindow">
    <Window.Resources>
        <ObjectDataProvider x:Key="DeviceModelProvider" MethodName="GetNames" ObjectType="{x:Type sys:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="GeneralData:DeviceModel"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider x:Key="DeviceStatusProvider" MethodName="GetNames" ObjectType="{x:Type sys:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="GeneralData:DeviceStatus"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <ObjectDataProvider x:Key="RecipeTypeProvider" MethodName="GetNames" ObjectType="{x:Type sys:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="GeneralData:RecipeType"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <Convert:DeviceModelEnumConvert x:Key="EnumConverter"/>
        <Convert:DeviceStatusEnumConvert x:Key="StatusEnumConverter"/>
        <Convert:RecipeTypeEnumConvert x:Key="RecipeEnumConverter"/>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="4"/>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="4"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Background="#FFCECECE">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="0"/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <Grid Margin="8"  IsEnabled="{Binding IsNotConnected}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="8"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="8"/>

                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="8"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="8"/>

                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="8"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="8"/>

                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>

                <Label Grid.Column="0" Content="IP:" />
                <TextBox Grid.Column="2" Text="{Binding Address.Ip}" VerticalContentAlignment="Center" />

                <Label Grid.Column="4" Content="Port:" />
                <TextBox Grid.Column="6" Text="{Binding Address.Port}" VerticalContentAlignment="Center" />

                <Label Grid.Column="8" Content="HubName:" />
                <TextBox Grid.Column="10" Text="{Binding Address.HubName}"  VerticalContentAlignment="Center" />

                <Button Grid.Column="12" Content="Connect" Command="{Binding ConnectCommand}"/>

            </Grid>
            <Button Grid.Column="2" Width="120" Margin="8" Command="{Binding DisconnectCommand}">Disconnect</Button>
        </Grid>

        <Border Grid.Row="2" Background="#FFCECECE">
            <Grid Margin="8" Height="30">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="60"/>
                    <ColumnDefinition Width="8"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="16"/>

                    <ColumnDefinition Width="60"/>
                    <ColumnDefinition Width="8"/>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="8"/>

                </Grid.ColumnDefinitions>
                <Button Content="Recipe" Command="{Binding SelectRecipeCommand}" />
                <TextBox Grid.Column="2" Text="{Binding LocalFilePathInfo.RecipePath}" IsReadOnly="True" VerticalContentAlignment="Center" />
                <Button Grid.Column="4" Content="Config" Command="{Binding SelectConfigCommand}" />
                <TextBox Grid.Column="6" Text="{Binding LocalFilePathInfo.ConfigPath}" IsReadOnly="True" VerticalContentAlignment="Center" />
            </Grid>
        </Border>

        <Grid Grid.Row="4" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="420"/>
                <ColumnDefinition Width="8"/>
                <ColumnDefinition Width="300"/>
                <ColumnDefinition Width="8"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Border Background="#FFCECECE">
                <Grid  Margin="8">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="8"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0" Grid.Column="0" Content="Device Model:" VerticalAlignment="Center"/>
                    <ComboBox Grid.Row="0" Grid.Column="2" VerticalContentAlignment="Center"
                          ItemsSource="{Binding Source={StaticResource DeviceModelProvider} }" SelectedItem="{Binding Running.DeviceInfo.DeviceModel, Converter={StaticResource EnumConverter}}"/>

                    <Label Grid.Row="2" Grid.Column="0" Content="Device SubModel:"  VerticalAlignment="Center"/>
                    <TextBox Grid.Row="2" Grid.Column="2" Text="{Binding Running.DeviceInfo.DeviceSubModel}" VerticalContentAlignment="Center"/>

                    <Label Grid.Row="4" Grid.Column="0" Content="Device Name:" VerticalAlignment="Center" />
                    <TextBox Grid.Row="4" Grid.Column="2" Text="{Binding Running.DeviceInfo.DeviceName}" VerticalContentAlignment="Center"/>

                    <Label Grid.Row="6" Grid.Column="0" Content="Position:"  VerticalAlignment="Center"/>
                    <TextBox Grid.Row="6" Grid.Column="2" Text="{Binding Running.DeviceInfo.Position}" VerticalContentAlignment="Center"/>

                    <Label Grid.Row="8" Grid.Column="0" Content="Software Version:"  VerticalAlignment="Center"/>
                    <TextBox Grid.Row="8" Grid.Column="2" Text="{Binding Running.DeviceInfo.SoftwareVersion}" VerticalContentAlignment="Center"/>

                    <Label Grid.Row="10" Grid.Column="0" Content="DB Connection String:"  VerticalAlignment="Center"/>
                    <TextBox Grid.Row="10" Grid.Column="2" Text="{Binding Running.DeviceInfo.DBConnectionString}" VerticalContentAlignment="Center"/>

                    <Label Grid.Row="12" Grid.Column="0" Content="Guid:"  VerticalAlignment="Center"/>
                    <TextBox Grid.Row="12" Grid.Column="2" Text="{Binding Running.DeviceInfo.Guid}" IsReadOnly="True" VerticalContentAlignment="Center"/>

                    <Button Grid.Row="14" Grid.ColumnSpan="3" Height="28" Content="Register" Command="{Binding RegisterCommand}"/>
                </Grid>
            </Border>

            <Border Grid.Column="2" Background="#FFCECECE">
                <Grid Margin="8">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="8"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <Label Grid.Row="0" Grid.Column="0" Content="Device Status:" VerticalAlignment="Center"/>
                    <ComboBox Grid.Row="0" Grid.Column="2" VerticalContentAlignment="Center"
                        ItemsSource="{Binding Source={StaticResource DeviceStatusProvider} }"  SelectedItem="{Binding TempTest.DeviceStatus, Converter={StaticResource StatusEnumConverter}}"/>

                    <Label Grid.Row="2" Grid.Column="0" Content="PJob ID:"  VerticalAlignment="Center"/>
                    <TextBox Grid.Row="2" Grid.Column="2" Text="{Binding TempTest.PJobID}" VerticalContentAlignment="Center"/>

                    <Label Grid.Row="4" Grid.Column="0" Content="CJob ID:" VerticalAlignment="Center" />
                    <TextBox Grid.Row="4" Grid.Column="2" Text="{Binding TempTest.CJobID}" VerticalContentAlignment="Center"/>

                    <Label Grid.Row="6" Grid.Column="0" Content="Recipe Type:"  VerticalAlignment="Center"/>
                    <ComboBox Grid.Row="6" Grid.Column="2" VerticalContentAlignment="Center"
                        ItemsSource="{Binding Source={StaticResource RecipeTypeProvider} }"   SelectedItem="{Binding TempTest.RecipeType, Converter={StaticResource RecipeEnumConverter}}"/>

                    <Button Grid.Row="8" Grid.ColumnSpan="3" Content="Update" Command="{Binding TriggerCommand}" Height="28"/>
                </Grid>
            </Border>

            <Border Grid.Column="4" Background="#FFCECECE">

                <Grid Margin="8">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="4"/>
                        <RowDefinition Height="auto"/>
                    </Grid.RowDefinitions>
                    <Button Grid.Row="2" Height="28" Content="Start Data Service" Command="{Binding StartDataServiceCommand}"/>
                </Grid>
            </Border>
        </Grid>
    </Grid>
</Window>
