WindowCoating.xaml 8.76 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<Window x:Class="FLYAD7_Simulation_Wpf.WindowCoating"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:local="clr-namespace:FLYAD7_Simulation_Wpf"
        Title="涂布模拟" Height="520" Width="724" xmlns:my="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization">
    <Window.Resources>
        <local:CoatingModeConverter x:Key="coatingmodeconv" />
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="273*" />
        </Grid.RowDefinitions>
15 16 17
        <Grid x:Name="hmi_cc"/>
        <Grid x:Name="inner_cc"/>
        <Grid x:Name="hmi"/>
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
        <StackPanel Orientation="Horizontal">
            <Grid HorizontalAlignment="Left" Margin="12,3" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="auto" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <Grid.Resources>
                    <Style TargetType="TextBlock" x:Key="textBlockStyle_title">
                        <Setter Property="FontSize" Value="18"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                        <Setter Property="HorizontalAlignment" Value="Left"/>
                        <Setter Property="VerticalAlignment" Value="Center"/>
                        <Setter Property="Margin" Value="5"/>
                    </Style>
                    <Style TargetType="TextBlock" x:Key="textBlockStyle_curr">
                        <Setter Property="HorizontalAlignment" Value="Center"/>
                        <Setter Property="VerticalAlignment" Value="Center"/>
                        <Setter Property="Margin" Value="2"/>
                        <Setter Property="Foreground" Value="Gray"/>
                    </Style>
潘栩锋's avatar
潘栩锋 committed
47

48 49 50 51 52 53
                    <Style TargetType="TextBox" x:Key="textBoxStyle_set">
                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                        <Setter Property="Margin" Value="2"/>
                    </Style>
                </Grid.Resources>
潘栩锋's avatar
潘栩锋 committed
54

55 56 57
                <TextBlock Style="{StaticResource textBlockStyle_title}" Text="泵速(R/min)" Grid.Row="1" />
                <TextBlock Style="{StaticResource textBlockStyle_title}" Text="左刀间距(um)" Grid.Row="2" />
                <TextBlock Style="{StaticResource textBlockStyle_title}" Text="右刀间距(um)" Grid.Row="3" />
潘栩锋's avatar
潘栩锋 committed
58

59
                <TextBlock Style="{StaticResource textBlockStyle_title}" Text="对外当前值" Grid.Column="1" />
潘栩锋's avatar
潘栩锋 committed
60

61 62 63 64 65 66 67
                <Button Margin="3" Click="button_set_out_Click" Grid.Column="2">
                    <TextBlock Style="{StaticResource textBlockStyle_title}" Text="对外设置值" />
                </Button>
                <TextBlock Style="{StaticResource textBlockStyle_title}" Text="内部当前值" Grid.Column="3" />
                <Button Margin="3" Click="button_set_inner_Click" Grid.Column="4">
                    <TextBlock Style="{StaticResource textBlockStyle_title}" Text="内部设置值" />
                </Button>
潘栩锋's avatar
潘栩锋 committed
68

69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
                <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center">
                    <TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding Pump}" DataContext="{Binding DataContext,ElementName=hmi_cc}"/>
                    <TextBlock Text="/"/>
                    <TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding PumpSet}" DataContext="{Binding DataContext,ElementName=hmi}" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Center">
                    <TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding LeftDis}" DataContext="{Binding DataContext,ElementName=hmi_cc}" />
                    <TextBlock Text="/"/>
                    <TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding LeftSet}" DataContext="{Binding DataContext,ElementName=hmi}"/>
                </StackPanel>
                <StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Center">
                    <TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding RightDis}" DataContext="{Binding DataContext,ElementName=hmi_cc}"/>
                    <TextBlock Text="/"/>
                    <TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding RightSet}" DataContext="{Binding DataContext,ElementName=hmi}" />
                </StackPanel>
潘栩锋's avatar
潘栩锋 committed
84

85 86 87
                <TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="2" Grid.Row="1" Name="textbox_pumpset_out"  />
                <TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="2" Grid.Row="2" Name="textbox_leftset_out" />
                <TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="2" Grid.Row="3" Name="textbox_rightset_out" />
潘栩锋's avatar
潘栩锋 committed
88

89 90 91
                <TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="3" Grid.Row="1" Text="{Binding Pump}" DataContext="{Binding DataContext,ElementName=inner_cc}" />
                <TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="3" Grid.Row="2" Text="{Binding LeftDis}" DataContext="{Binding DataContext,ElementName=inner_cc}"/>
                <TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="3" Grid.Row="3" Text="{Binding RightDis}" DataContext="{Binding DataContext,ElementName=inner_cc}" />
92 93 94 95 96 97 98 99

                <TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="4" Grid.Row="1" Name="textbox_pumpset_inner"/>
                <TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="4" Grid.Row="2" Name="textbox_leftset_inner" />
                <TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="4" Grid.Row="3" Name="textbox_rightset_inner"/>


            </Grid>
            <StackPanel>
100
                <CheckBox Content="设置位" FontSize="18" FontWeight="Bold" Height="23" Margin="3" VerticalAlignment="Center" FlowDirection="RightToLeft" IsChecked="{Binding OK}" DataContext="{Binding DataContext,ElementName=hmi}"/>
101 102
                <CheckBox Content="涂布状态" FontSize="18" FontWeight="Bold" Height="23" Margin="3" VerticalAlignment="Center" FlowDirection="RightToLeft" IsChecked="{Binding DeviceState}" IsEnabled="False"/>
            </StackPanel>
潘栩锋's avatar
潘栩锋 committed
103
            
104
        </StackPanel>
潘栩锋's avatar
潘栩锋 committed
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143

        <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="12,3">
            <StackPanel Orientation="Horizontal"  Margin="3">
                <TextBlock Text="modbusTCP 端口:" />
                <TextBlock Text="{Binding Port}" />
            </StackPanel>
            <StackPanel Orientation="Horizontal"  Margin="3">
                <TextBlock Text="线速度(m/min)" />
                <TextBox Text="{Binding FilmVelocity}" Width="117" />
            </StackPanel>
            <ComboBox Height="23" Margin="3" Name="comboBox1" VerticalAlignment="Top" Width="120" >
                <ComboBoxItem IsSelected="{Binding CoatingMode, Converter={StaticResource coatingmodeconv}, ConverterParameter=Extrusion}">
                    <TextBlock Text="挤压涂布"/>
                </ComboBoxItem>
                <ComboBoxItem IsSelected="{Binding CoatingMode, Converter={StaticResource coatingmodeconv}, ConverterParameter=Transfer}">
                    <TextBlock Text="转移涂布"/>
                </ComboBoxItem>
            </ComboBox>
            <TextBlock FontSize="18" FontWeight="Bold" Height="23" Margin="3" VerticalAlignment="Center" >
                <Run Text="当前平均值:" />
                <Run Text="{Binding Avg}" />
            </TextBlock>
        </StackPanel>
        <Grid Margin="12,3" Grid.Row="2">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition  />
            </Grid.RowDefinitions>
            <WindowsFormsHost >
                <my:Chart x:Name="chart1" />
            </WindowsFormsHost>
            <WindowsFormsHost Grid.Row="1">
                <my:Chart x:Name="chart2" />
            </WindowsFormsHost>
        </Grid>


    </Grid>
</Window>