<Window x:Class="FLYAD7_Simulation_Wpf.WindowBlowing"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
      
        Title="吹膜模拟" MinWidth="500" Loaded="Window_Loaded" SizeToContent="WidthAndHeight">
    <Window.Resources>
        <ResourceDictionary>
            <Style TargetType="TextBlock" x:Key="TitleStyle">
                <Setter Property="FontWeight" Value="Bold"/>
                <Setter Property="FontSize" Value="18"/>
                <Setter Property="Margin" Value="2"/>
            </Style>
            <Style TargetType="TextBlock" x:Key="H3Style">
                <Setter Property="FontWeight" Value="Bold"/>
                <Setter Property="FontSize" Value="12"/>
                <Setter Property="Margin" Value="2"/>
            </Style>
            <Style TargetType="TextBlock" x:Key="FieldNameStyle">
                <Setter Property="FontWeight" Value="Bold"/>
                <Setter Property="FontSize" Value="12"/>
                <Setter Property="Width" Value="120"/>
                <Setter Property="Margin" Value="2"/>
            </Style>
            <Style TargetType="TextBlock" x:Key="FieldValueStyle">
                <Setter Property="FontSize" Value="12"/>
                <Setter Property="Width" Value="120"/>
                <Setter Property="Margin" Value="2"/>
            </Style>
            <Style TargetType="TextBox" x:Key="InputStyle">
                <Setter Property="Height" Value="23"/>
                <Setter Property="Width" Value="120"/>
                <Setter Property="Margin" Value="2"/>
            </Style>
            <Style TargetType="Button" x:Key="ButtonStyle">
                <Setter Property="Padding" Value="10,5"/>
                <Setter Property="Margin" Value="5"/>
            </Style>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="auto"/>
        </Grid.ColumnDefinitions>
        <StackPanel>
            <StackPanel Orientation="Horizontal" Margin="2">
                <StackPanel Margin="2">
                    <StackPanel Orientation="Horizontal">
                        <StackPanel Margin="2">
                            <TextBlock Style="{StaticResource TitleStyle}" Text="线速度(m/min)" />
                            <TextBox Style="{StaticResource InputStyle}" Text="{Binding FilmVelocity, StringFormat={}{0:F1}}"/>
                        </StackPanel>
                        <StackPanel Margin="2">
                            <TextBlock Style="{StaticResource TitleStyle}" Text="旋转速度(min/R)" />
                            <TextBox Style="{StaticResource InputStyle}" Text="{Binding AngleVelocity, StringFormat={}{0:F1}}"/>
                        </StackPanel>
                    </StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <StackPanel Margin="2">
                            <TextBlock Style="{StaticResource TitleStyle}" Text="均值(um)" />
                            <TextBox Style="{StaticResource InputStyle}" Text="{Binding Avg}"/>
                        </StackPanel>
                        <StackPanel Margin="2">
                            <TextBlock Style="{StaticResource TitleStyle}" Text="当前角度(°)" />
                            <TextBlock Style="{StaticResource FieldValueStyle}" Text="{Binding CurrAngle,StringFormat={}{0:F1}}"/>
                        </StackPanel>
                        <StackPanel Margin="2">
                            <TextBlock Style="{StaticResource TitleStyle}" Text="当前纵向位置(m)" />
                            <TextBlock Style="{StaticResource FieldValueStyle}" Text="{Binding CurrFilmLength,StringFormat={}{0:F1}}"/>
                        </StackPanel>
                        
                    </StackPanel>
                </StackPanel>
                <GroupBox Header="电柜" Margin="2" >
                    <StackPanel >
                        <StackPanel x:Name="spPlc">
                            <CheckBox Content="电流计" Height="16" Margin="5" IsChecked="{Binding HasElectricCurrent}" IsEnabled="False"/>
                            <CheckBox Content="风机开" Height="16" Margin="5" IsChecked="{Binding HasFan}" />
                        </StackPanel>
                        <CheckBox Content="屏蔽I9" Height="16" Margin="5" IsChecked="{Binding IsShieldI9}" />
                    </StackPanel>
                </GroupBox>
            </StackPanel>

            <StackPanel Margin="2">
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource TitleStyle}" Text="厚度改变"  />
                    <Button Style="{StaticResource ButtonStyle}" Content="应用" Click="button1_Click" />
                </StackPanel>
                <Grid Margin="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Style="{StaticResource H3Style}" Width="100" >
                        <TextBlock.Inlines>
                            <Run Text="位置:"/>
                            <Run Text="{Binding TestPos}"/>
                        </TextBlock.Inlines>
                    </TextBlock>
                    <Slider Grid.Column="1" Margin="2" Minimum="0" Maximum="999" Value="{Binding TestPos}"/>
                </Grid>
                <Grid Margin="2">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Style="{StaticResource H3Style}" Width="100" >
                        <TextBlock.Inlines>
                            <Run Text="加热功率:"/>
                            <Run Text="{Binding TestHeat}"/>
                        </TextBlock.Inlines>
                    </TextBlock>
                    <Slider Grid.Column="1" Margin="2" Value="{Binding TestHeat}" Minimum="0" Maximum="100"/>
                </Grid>
            </StackPanel>

            <WindowsFormsHost Height="160" Margin="2" >
                <Chr:Chart x:Name="chart1" />
            </WindowsFormsHost>
            <WindowsFormsHost Height="160" Margin="2" >
                <Chr:Chart x:Name="chart2" />
            </WindowsFormsHost>
        </StackPanel>
        <GroupBox Margin="2" Grid.Column="1">
            <GroupBox.Header>
                <TextBlock Style="{StaticResource TitleStyle}" Text="需要重启才能生效参数"/>
            </GroupBox.Header>
            <StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource FieldNameStyle}" Text="旋转加速时间(s)"/>
                    <TextBox Style="{StaticResource InputStyle}" Text="{Binding AngleAccTime}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource FieldNameStyle}" Text="旋转减速时间(s)"/>
                    <TextBox Style="{StaticResource InputStyle}" Text="{Binding AngleDecTime}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource FieldNameStyle}" Text="换方向冷却时间(s)"/>
                    <TextBox Style="{StaticResource InputStyle}" Text="{Binding AngleCoolTime}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource FieldNameStyle}" Text="膜泡压扁后总宽度(m)"/>
                    <TextBox Style="{StaticResource InputStyle}" Text="{Binding FilmWidth}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource FieldNameStyle}" Text="膜走带速度(m/min)"/>
                    <TextBox Style="{StaticResource InputStyle}" Text="{Binding FilmVelocity}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource FieldNameStyle}" Text="膜距离(m)"/>
                    <TextBox Style="{StaticResource InputStyle}" Text="{Binding FilmDistance}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource FieldNameStyle}" Text="辊信号长(mm)"/>
                    <TextBox Style="{StaticResource InputStyle}" Text="{Binding RollSignLength}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource FieldNameStyle}" Text="加热棒数量"/>
                    <TextBox Style="{StaticResource InputStyle}" Text="{Binding ChannelCnt}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource FieldNameStyle}" Text="第1根加热棒对应角度"/>
                    <TextBox Style="{StaticResource InputStyle}" Text="{Binding Channel1stAngle}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="2">
                    <TextBlock Style="{StaticResource FieldNameStyle}" Text="1圈脉冲数"/>
                    <TextBox Style="{StaticResource InputStyle}" Text="{Binding PosOfR}"/>
                </StackPanel>
                <Button Style="{StaticResource ButtonStyle}" Content="保存" Click="btnSaveClick"/>
                <GroupBox Header="运动控制">
                    <StackPanel>
                        <CheckBox Content="连续旋转" Height="16" Margin="5" IsChecked="{Binding Is360}" />
                        <CheckBox Content="正向旋转" Height="16" Margin="5" IsChecked="{Binding IsForw}" />
                        <CheckBox Content="复位" Height="16" Margin="5" IsChecked="{Binding IsOrg}" />
                        <CheckBox Content="旋转启动" Height="16" Margin="5" IsChecked="{Binding IsRotationOn}" />
                        <CheckBox Content="牵引启动" Height="16" Margin="5" IsChecked="{Binding IsTractionOn}" />
                    </StackPanel>
                    
                </GroupBox>
            </StackPanel>
        </GroupBox>




    </Grid>
</Window>
