sb
alielie
2025-03-03 f90615921589586c1f9efde22620b45243d94657
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<UserControl x:Class="Plugin.TestResult_WPF.ViewControl"
             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:Plugin.TestResult_WPF"
             mc:Ignorable="d" 
             Loaded="UserControl_Loaded"
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <local:FontSizeConverter x:Key="FontSizeConverter"/>
        <Style TargetType="GroupBox">
            <Setter Property="FontSize" Value="{Binding ActualWidth,RelativeSource={RelativeSource AncestorType=UserControl}, 
Converter={StaticResource FontSizeConverter}, ConverterParameter='30,1920'}" />
        </Style>
 
        <Style TargetType="Button">
            <Setter Property="Margin" Value="0,10"/>
            <Setter Property="Padding" Value="5"/>
        </Style>
 
        <Style TargetType="Label">
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="LightGray"/>
            <Setter Property="Margin" Value="0,10"/>
            <Setter Property="Padding" Value="5"/>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="7.5*"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <local:TestResultView x:Name="testResultView" Grid.Column="0" Loaded="testResultView_Loaded" />
        <StackPanel Grid.Column="1" Background="#FFF">
            <GroupBox Header="产品信息">
                <ComboBox x:Name="modelSelect" SelectionChanged="modelSelect_SelectionChanged"></ComboBox>
            </GroupBox>
            <GroupBox Header="生产统计">
                <StackPanel>
                    <Label HorizontalContentAlignment="Center" HorizontalAlignment="Stretch">
                        <Label.Style>
                            <Style TargetType="Label">
                                <Setter Property="HorizontalContentAlignment"  Value="Center"/>
                                <Setter Property="HorizontalAlignment"  Value="Stretch"/>
                                <Setter Property="Margin" Value="0,10"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding mesStatus}" Value="true">
                                        <Setter Property="Background" Value="Green"/>
                                        <Setter Property="Content" Value="MES开"/>
                                        <Setter Property="Foreground" Value="White"/>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding mesStatus}" Value="false">
                                        <Setter Property="Background" Value="Red"/>
                                        <Setter Property="Content" Value="MES关"/>
                                        <Setter Property="Foreground" Value="White"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Label.Style>
                    </Label>
                    <Label>
                        <Label.Style>
                            <Style TargetType="Label">
                                <Setter Property="HorizontalContentAlignment"  Value="Center"/>
                                <Setter Property="HorizontalAlignment"  Value="Stretch"/>
                                <Setter Property="Content" Value="{Binding produceStatus}"/>
                                <Setter Property="Margin" Value="0,10"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding produceStatus}" Value="INIT">
                                        <Setter Property="Background" Value="Gray"/>
                                        <Setter Property="Foreground" Value="White"/>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding produceStatus}" Value="STOP">
                                        <Setter Property="Background" Value="Red"/>
                                        <Setter Property="Foreground" Value="White"/>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding produceStatus}" Value="RUNNING">
                                        <Setter Property="Background" Value="Green"/>
                                        <Setter Property="Foreground" Value="White"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Label.Style>
                    </Label>
                </StackPanel>
            </GroupBox>
            <GroupBox Header="操作">
                <StackPanel>
                    <Button x:Name="btnStart" Click="Start_Click">
                        <Button.Content>启动</Button.Content>
                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Background" Value="Green"/>
                                <Setter Property="Foreground" Value="White"/>
                                <Setter Property="Margin" Value="0,10"/>
                                <Setter Property="Padding" Value="5"/>
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Foreground" Value="Gray"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>
                    </Button>
 
                    <Button x:Name="btnStop" Click="Stop_Click">
                        <Button.Content>停止</Button.Content>
                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Background" Value="Red"/>
                                <Setter Property="Foreground" Value="White"/>
                                <Setter Property="Margin" Value="0,10"/>
                                <Setter Property="Padding" Value="5"/>
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Foreground" Value="Gray"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>
                    </Button>
 
                    <Button x:Name="btnScan1" Click="Scan_Click_1">
                        <Button.Content>一区扫码</Button.Content>
                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Margin" Value="0,10"/>
                                <Setter Property="Padding" Value="5"/>
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Foreground" Value="Gray"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>
                    </Button>
 
                    <Button x:Name="btnScan2" Click="Scan_Click_2">
                        <Button.Content>二区扫码</Button.Content>
                        <Button.Style>
                            <Style TargetType="Button">
                                <Setter Property="Margin" Value="0,10"/>
                                <Setter Property="Padding" Value="5"/>
                                <Style.Triggers>
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Foreground" Value="Gray"/>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>
                    </Button>
                    <!-- <Button Content="计数清零"/>
                    <Button Content="扫码"/>
                    <Button Content="一区手动"/>
                    <Button Content="二区手动"/>-->
                </StackPanel>
            </GroupBox>
        </StackPanel>
    </Grid>
</UserControl>