alielie
2025-05-12 7bf89fd93bc487e8445d6d85bb527251b7371a04
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<hb:PluginControl x:Class="Plugin.TsExecution.TsExecution"
             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.TsExecution"
             xmlns:hb="clr-namespace:HMI.Base;assembly=HMI.Base"
         xmlns:uic="clr-namespace:HMI.UI.Converter;assembly=HMI.UI"
         xmlns:pw="https://opensource.panuon.com/wpf"
         xmlns:pu="https://opensource.panuon.com/wpf-ui"
         xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI"
         xmlns:ScottPlot="clr-namespace:ScottPlot.WPF;assembly=ScottPlot.WPF"
         mc:Ignorable="d" 
         Padding="10"
         Loaded="PluginControl_Loaded"
                  SizeChanged="PluginControl_SizeChanged"
         Background="{StaticResource WorkspaceBackground}"
         d:DesignHeight="450" d:DesignWidth="800">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="8*"/>
            <ColumnDefinition Width="2*"/>
        </Grid.ColumnDefinitions>
        <WindowsFormsHost x:Name="host" Visibility="Collapsed"></WindowsFormsHost>
 
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <UniformGrid x:Name="panel" Columns="2" dp:UniformGridHelper.InnerBorder="1" 
                         dp:UniformGridHelper.InnerBorderBrush="#3a3a3a">
 
            </UniformGrid>
            <Border Grid.Row="1" Visibility="{Binding AlarmVisiable,Converter={StaticResource vbConverter}}" 
                     Height="50" Background="Red"/>
        </Grid>
 
 
 
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
 
            <GroupBox>
                <pu:FormGroup Orientation="Vertical" 
                              HeaderHeight="Auto"
                              HeaderPadding="0" Header="{DynamicResource Ts.SelectProductModel}">
                    <ComboBox Style="{StaticResource FormComboxStyle}" 
          ItemsSource="{Binding Products}"
          DisplayMemberPath="Name" SelectedValuePath="Name"
          SelectedItem="{Binding SelectedProduct}"
          x:Name="CbProduct"/>
                </pu:FormGroup>
            </GroupBox>
 
            <GroupBox Grid.Row="2">
                <StackPanel>
                    <pu:FormGroup Header="{DynamicResource Ts.MesStatus}" GroupName="Number">
                        <Label Grid.Row="1">
                            <Label.Style>
                                <Style TargetType="Label">
                                    <Setter Property="Foreground" Value="#FFF"/>
                                    <Setter Property="HorizontalContentAlignment" Value="Center"/>
                                    <Setter Property="FontSize" Value="16"/>
                                    <Setter Property="FontWeight" Value="Bold"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding EnableMes}" Value="True">
                                            <Setter Property="Background" Value="Green"/>
                                            <Setter Property="Content" Value="{DynamicResource Ts.MesStatus.Enable}"/>
                                        </DataTrigger>
                                        <DataTrigger Binding="{Binding EnableMes}" Value="False">
                                            <Setter Property="Background" Value="Red"/>
                                            <Setter Property="Content" Value="{DynamicResource Ts.MesStatus.Disable}"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Label.Style>
                        </Label>
                    </pu:FormGroup>
                    <pu:FormGroup Header="{DynamicResource Ts.Total}" GroupName="Number">
                        <TextBox Style="{StaticResource EditorTextBoxStyle}"  IsReadOnly="True"
                 x:Name="TbTotal"/>
                    </pu:FormGroup>
                    <pu:FormGroup Header="{DynamicResource Ts.Pass}" GroupName="Number">
                        <TextBox Style="{StaticResource EditorTextBoxStyle}" IsReadOnly="True"
                 x:Name="TbPass"/>
                    </pu:FormGroup>
                    <pu:FormGroup Header="{DynamicResource Ts.Fail}" GroupName="Number">
                        <TextBox Style="{StaticResource EditorTextBoxStyle}" IsReadOnly="True"
                 x:Name="TbFail"/>
                    </pu:FormGroup>
                    <pu:FormGroup Header="{DynamicResource Ts.PassRate}" GroupName="Number">
                        <TextBox Style="{StaticResource EditorTextBoxStyle}" IsReadOnly="True"
                 x:Name="TbPassRate"/>
                    </pu:FormGroup>
                </StackPanel>
            </GroupBox>
 
            <GroupBox Grid.Row="3">
                <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                    <ScottPlot:WpfPlot Background="Transparent" x:Name="pieChart" MinWidth="300" MinHeight="300"
                   SizeChanged="PluginControl_SizeChanged"/>
                </ScrollViewer>
            </GroupBox>
 
            <GroupBox Grid.Row="4">
                <Grid dp:GridHelper.Space="20">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Button Style="{StaticResource SuccessButton}" 
                            x:Name="BtnStartSeq" Click="Button_Click" 
                            Content="{DynamicResource Ts.BtnStartSeq}"/>
                    <Button Grid.Row="1" Style="{StaticResource DangerButton}" IsEnabled="False"
                            x:Name="BtnStopSeq" Click="Button_Click"
                            Content="{DynamicResource Ts.BtnStopSeq}"/>
                    <Button Grid.Row="2" Style="{StaticResource PrimaryButton}" 
                            x:Name="BtnClearNum" Click="Button_Click"
                            Content="{DynamicResource Ts.BtnClearNum}"/>
                    <Button Grid.Row="3"
                            x:Name="BtnSample" Click="Button_Click">
                        <Button.Style>
                            <Style TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding SampleStatus}" Value="True">
                                        <Setter Property="Content" Value="{DynamicResource Ts.BtnIsSample}"/>
                                    </DataTrigger>
                                    <DataTrigger Binding="{Binding SampleStatus}" Value="False">
                                        <Setter Property="Content" Value="{DynamicResource Ts.BtnNotSample}"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </Button.Style>
                    </Button>
 
                    <!--<Grid Grid.Row="4" dp:GridHelper.Space="20" dp:GridHelper.SpaceIgnore="ALL">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
 
                        <CheckBox 
                            IsChecked="{Binding EnableMes,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                            Content="{DynamicResource Ts.EnableMes}"
                            />
                        <CheckBox Grid.Column="1" 
                                  IsChecked="{Binding EnableCanLog,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                  Content="{DynamicResource Ts.EnableCanLog}"
                                  />
                        <CheckBox Grid.Column="2" 
                                  IsChecked="{Binding EnableDebugMode,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
                                  Content="{DynamicResource Ts.DebugMode}"/>
                    </Grid>-->
 
                    <!--<pu:Switch Grid.Row="3" BoxWidth="120"
    CheckedBackground="{StaticResource PrimaryColor}"
    CheckedBorderBrush="#36abff"
    ToggleBrush="#030303"
    CheckedForeground="White"
    CheckedToggleBrush="#FFFFFF"      
    IsChecked="{Binding SampleStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
    ToggleSize="25" Cursor="Hand" >
                        <pu:Switch.BoxTemplate>
                            <DataTemplate>
                                <TextBlock x:Name="text" 
                                           Text="{Binding Converter={StaticResource lc},ConverterParameter='Ts.BtnNotSample'}"
                                           Padding="30,0"
                                           VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                <DataTemplate.Triggers>
                                    <DataTrigger Binding="{Binding IsChecked,
                                        RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=pu:Switch,AncestorLevel=1}}" 
                                                 Value="True">
                                        <Setter TargetName="text" Property="Text"
                                                Value="{Binding Converter={StaticResource lc},ConverterParameter='Ts.BtnIsSample'}"/>
                                        <Setter TargetName="text" Property="Foreground" Value="{StaticResource PrimaryColorContract}"/>
                                    </DataTrigger>
                                </DataTemplate.Triggers>
                            </DataTemplate>
                        </pu:Switch.BoxTemplate>
                    </pu:Switch>-->
                </Grid>
            </GroupBox>
        </Grid>
 
    </Grid>
</hb:PluginControl>