<UserControl x:Class="MECF.Framework.UI.Client.CenterViews.Maintain.ViewModels.MaintainerSettingView"
             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:MECF.Framework.UI.Client.CenterViews.Maintain"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:micro="clr-namespace:Caliburn.Micro"
             xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
             xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
             xmlns:enum="clr-namespace:MECF.Framework.Common.Aitex.Core.RT.EMS;assembly=MECF.Framework.Common"
             d:DesignHeight="1024"
             d:DesignWidth="1900"
             mc:Ignorable="d">
    <Border Height="480" Width="1000" BorderBrush="{DynamicResource Color_BD_Logoff}" BorderThickness="5" Background="{DynamicResource Color_BG_Logoff}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="3*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
                <RowDefinition Height="2*"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*"/>
                    <ColumnDefinition Width="5*"/>
                    <ColumnDefinition Width="3*"/>
                    <ColumnDefinition Width="5*"/>
                    <ColumnDefinition Width="2*"/>
                    <ColumnDefinition Width="5*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center">
    <!--不要换行否则文本会有间距-->
    <Run Text="Type" Typography.Variants="Subscript"/><Run FontSize="16" Text="*" BaselineAlignment="TextTop" Foreground="Red"/><Run Text=":" Typography.Variants="Subscript"/>
                </TextBlock>
                <ComboBox Grid.Column="1" Margin="0,5,0,5" FontSize="24" SelectedItem="{Binding MaInfo.Type,UpdateSourceTrigger=PropertyChanged}"
          VerticalAlignment="Center" IsEnabled="{Binding AddingMode}" ItemsSource="{Binding TypeList}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectionChanged">
                            <micro:ActionMessage MethodName="SelectionChanged"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding }" FontSize="24" VerticalAlignment="Center"/>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <TextBlock Grid.Column="2" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center">
                    <!--不要换行否则文本会有间距-->
                    <Run Text="PlanName" Typography.Variants="Subscript"/><Run FontSize="16" Text="*" BaselineAlignment="TextTop" Foreground="Red"/><Run Text=":" Typography.Variants="Subscript"/>
                </TextBlock>
                <ComboBox Grid.Column="3" Margin="0,5,0,5" FontSize="20" Text="{Binding MaInfo.Name,UpdateSourceTrigger=PropertyChanged}"
                          VerticalAlignment="Center" IsEditable="True" ItemsSource="{Binding PlanNames}" IsEnabled="{Binding AddingMode}">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding }" FontSize="24" VerticalAlignment="Center"/>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <TextBlock Grid.Column="4" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center">
                    <!--不要换行否则文本会有间距-->
                    <Run Text="Module" Typography.Variants="Subscript"/><Run FontSize="16" Text="*" BaselineAlignment="TextTop" Foreground="Red"/><Run Text=":" Typography.Variants="Subscript"/>
                </TextBlock>
                <TextBox Grid.Column="5" Text="{Binding MaInfo.Module}" 
                         Width="{Binding RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=1},Path=ColumnDefinitions[3].ActualWidth}"
                         Margin="0,10,0,10"
                         Background="White" Foreground="Black" FontSize="16" HorizontalAlignment="Center"/>
            </Grid>
            <Grid Grid.Row="1" DataContext="{Binding MaInfo}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="6*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="Description:" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBox Grid.Column="1" Text="{Binding Description}" Margin="0,10,0,10"
                     Width="{Binding RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=1},Path=ColumnDefinitions[1].ActualWidth}"
                     Background="White" Foreground="Black" FontSize="16" HorizontalAlignment="Center" TextWrapping="Wrap" AcceptsReturn="True"/>
            </Grid>
            <Grid Grid.Row="2" DataContext="{Binding MaInfo}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="Enable:" Margin="10 0 10 0" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <CheckBox Grid.Column="1" Margin="10 0 10 0" IsChecked="{Binding Enable}" HorizontalAlignment="Left" VerticalAlignment="Center">
                    <CheckBox.LayoutTransform>
                        <ScaleTransform ScaleX="2" ScaleY="2"/>
                    </CheckBox.LayoutTransform>
                </CheckBox>
                <TextBlock Grid.Column="2" Text="Index:" Margin="10 0 10 0" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBlock Grid.Column="3" Margin="10" Text="{Binding Index}" Width="90" Foreground="Black" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
            </Grid>
            <Grid Grid.Row="3">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="8*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="20*"/>
                    <ColumnDefinition Width="40*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="StartDate:" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <wfi:WindowsFormsHost Grid.Column="2" 
                                      Width="{Binding RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=1},Path=ColumnDefinitions[2].ActualWidth}" 
                                      Margin="0,10,0,10" VerticalAlignment="Center" FontFamily="Arial" FontSize="18">
                    <wf:DateTimePicker x:Name="wfTimeStart" CustomFormat="yyyy/MM/dd HH:mm:ss" Format="Custom" Value="2020/1/1"/>
                </wfi:WindowsFormsHost>
            </Grid>
            <Grid Grid.Row="4" DataContext="{Binding MaInfo}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*"/>
                    <ColumnDefinition Width="3*"/>
                    <ColumnDefinition Width="1*"/>
                    <ColumnDefinition Width="3*"/>
                    <ColumnDefinition Width="3*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="Threshold:" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <TextBox Grid.Column="1" Text="{Binding Threshold}" Margin="0,10,0,10"
                     Width="{Binding RelativeSource={RelativeSource AncestorType=Grid,AncestorLevel=1},Path=ColumnDefinitions[1].ActualWidth}"
                     Background="White" Foreground="Black" FontSize="20" HorizontalAlignment="Center"/>
                <TextBlock Grid.Column="2" Text="Unit:" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=1},Path=DataContext.Visible}"/>
                <TextBlock Grid.Column="3" Text="mm" FontSize="20" HorizontalAlignment="Left" VerticalAlignment="Center" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=1},Path=DataContext.Visible}"/>
            </Grid>
            <Grid Grid.Row="5" DataContext="{Binding MaInfo}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="TimeDisplayUnit:" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <ComboBox Grid.Column="1" Margin="10" Width="200" FontSize="20" SelectedValue="{Binding TimeDisplayUnit}"
                          ItemsSource="{Binding Source={local:EnumBindingSource {x:Type enum:TimeUnit}}}"/>
            </Grid>
            <Grid Grid.Row="6">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Button Content="Cancel" Grid.Column="0" Width="120" Height="50">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="NGExit"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button Content="OK" Grid.Column="1" Width="120" Height="50">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="OKExit"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
            </Grid>
        </Grid>
    </Border>
</UserControl>
