aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml
blob: b57db3d3ff137530e7fccd30f55e6df538c5a6ea (plain)
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<local:ElementEditor x:Class="Tango.MachineStudio.Technician.Editors.JobRunnerElementEditor"
             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:dispensing="clr-namespace:Tango.BL.Dispensing;assembly=Tango.BL"
             xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
             xmlns:items="clr-namespace:Tango.MachineStudio.Technician.TechItems"
             xmlns:converters="clr-namespace:Tango.Editors.Converters;assembly=Tango.Editors"
             xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals"
             xmlns:local="clr-namespace:Tango.Editors;assembly=Tango.Editors"
             mc:Ignorable="d" Background="Transparent" ClipToBounds="False" BorderThickness="0" MinWidth="200" MinHeight="200" RenderTransformOrigin="0.5,0.5" d:DataContext="{d:DesignInstance Type=items:JobRunnerItem, IsDesignTimeCreatable=False}" Height="100" Width="350">

    <UserControl.Resources>
        <converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"></converters:BoolToVisibilityConverter>
        <sharedConverters:BooleanInverseConverter x:Key="BooleanInverseConverter" />
        <sharedConverters:ColorToIntegerConverter x:Key="ColorToIntegerConverter" />
        <sharedConverters:IsNotConverter x:Key="IsNotConverter" />
        <sharedConverters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
        <sharedConverters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />

        <Color x:Key="dummyColor">Transparent</Color>

        <ObjectDataProvider x:Key="dispenserDivisions" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="dispensing:DispenserStepDivisions"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>

        <!--Theme-->
        <SolidColorBrush x:Key="BorderBrush" Color="Transparent"></SolidColorBrush>
        <SolidColorBrush x:Key="CornersBrush" Color="Red"></SolidColorBrush>
    </UserControl.Resources>

    <UserControl.RenderTransform>
        <RotateTransform Angle="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=Angle}"></RotateTransform>
    </UserControl.RenderTransform>

    <Grid>


        <!--Content-->
        <Grid>
            <Border Padding="10" BorderThickness="1" BorderBrush="{StaticResource DarkGrayBrush}" Background="{StaticResource TransparentBackgroundBrush}" CornerRadius="5">
                <DockPanel>
                    <TextBox Foreground="{StaticResource DarkGrayBrush}" FontSize="14" DockPanel.Dock="Top" Text="{Binding Job.Name}"></TextBox>
                    <ItemsControl Margin="0 10 0 0" DockPanel.Dock="Top" ItemsSource="{Binding BrushStop.LiquidVolumes}" VerticalAlignment="Center">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel VerticalAlignment="Center" Orientation="Horizontal" IsItemsHost="True"></StackPanel>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <ContentControl Focusable="False" Width="60" Height="60" Margin="10 0 0 0" Style="{StaticResource numberBorder}">
                                    <ContentControl.Foreground>
                                        <SolidColorBrush Color="{Binding IdsPack.LiquidType.Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush>
                                    </ContentControl.Foreground>
                                    <mahapps:NumericUpDown FontSize="16" FontFamily="{StaticResource digital-7}" HorizontalAlignment="Center" Value="{Binding Volume, Mode=TwoWay}" Background="Transparent" Width="40" StringFormat="0.00" HideUpDownButtons="True" Minimum="0" Maximum="1000" InterceptArrowKeys="True" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Center">

                                    </mahapps:NumericUpDown>
                                </ContentControl>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>

                    <Grid DockPanel.Dock="Bottom">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="21*"/>
                            <ColumnDefinition Width="160"/>
                        </Grid.ColumnDefinitions>

                        <ProgressBar Margin="0 0 10 0" VerticalAlignment="Bottom" Height="10" Minimum="0" Maximum="{Binding RunningJobStatus.TotalProgress}" Value="{Binding RunningJobStatus.Progress}"></ProgressBar>

                        <TextBlock HorizontalAlignment="Right" VerticalAlignment="Top" Foreground="{StaticResource DarkGrayBrush}" FontSize="14" Margin="0 0 10 0">
                            <Run Text="{Binding RunningJobStatus.Progress,StringFormat=0.0}"></Run><Run Foreground="DodgerBlue" FontWeight="Bold">/</Run><Run Text="{Binding RunningJobStatus.TotalProgress,StringFormat=0.0}"></Run>
                            <Run Foreground="Gray">m</Run>
                            <Run></Run>
                            <Run Foreground="Gray">|</Run>
                            <Run></Run>
                            <Run Text="{Binding RunningJobStatus.RemainingTime,StringFormat='hh\\:mm\\:ss'}"></Run><Run Foreground="DodgerBlue" FontWeight="Bold">/</Run><Run Text="{Binding RunningJobStatus.TotalTime,StringFormat='hh\\:mm\\:ss'}"></Run>
                        </TextBlock>

                        <Button Grid.Column="1" Height="40" Command="{Binding StartStopJobCommand}">
                            <Button.Style>
                                <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
                                    <Setter Property="Content" Value="START"></Setter>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding IsJobStarted}" Value="True">
                                            <Setter Property="Content" Value="STOP"></Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Button.Style>
                        </Button>
                    </Grid>

                    <DataGrid Margin="0 10 0 0" ItemsSource="{Binding BrushStop.LiquidVolumes}" AutoGenerateColumns="False" IsSynchronizedWithCurrentItem="True" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" Background="Transparent" SelectionUnit="FullRow">
                        <DataGrid.CellStyle>
                            <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
                                <Setter Property="BorderThickness" Value="0"/>
                                <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                            </Style>
                        </DataGrid.CellStyle>
                        <DataGrid.Columns>
                            <DataGridTemplateColumn Header="IDS PACK">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Grid x:Name="t0">
                                            <Polygon x:Name="t1" Points="0,0 15,0 0,15 0,0" Margin="-15 -11 0 0">
                                                <Polygon.Fill>
                                                    <SolidColorBrush x:Name="t2" Color="{Binding IdsPack.LiquidType.Color,Converter={StaticResource ColorToIntegerConverter},FallbackValue={StaticResource dummyColor}}" />
                                                </Polygon.Fill>
                                            </Polygon>
                                            <TextBlock FontWeight="SemiBold" TextWrapping="Wrap" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding IdsPack.LiquidType.Name}"></TextBlock>
                                        </Grid>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="D/F">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock VerticalAlignment="Center">
                                                                                                                        <Run Text="{Binding IdsPack.DispenserType.NlPerPulse,StringFormat='0.0'}"></Run>
                                                                                                                        <Run Text="(nl)" FontSize="9" Foreground="Gray"></Run>
                                        </TextBlock>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="STEP">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <ComboBox ItemsSource="{Binding Source={StaticResource dispenserDivisions}}" SelectedItem="{Binding DispenserStepDivision,UpdateSourceTrigger=PropertyChanged}">
                                            <ComboBox.ItemContainerStyle>
                                                <Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
                                                    <Setter Property="Background" Value="{StaticResource WhiteBrush100}"></Setter>
                                                </Style>
                                            </ComboBox.ItemContainerStyle>
                                            <ComboBox.ItemTemplate>
                                                <DataTemplate>
                                                    <TextBlock Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock>
                                                </DataTemplate>
                                            </ComboBox.ItemTemplate>
                                        </ComboBox>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="MAX NL / CM">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock VerticalAlignment="Center">
                                                                                                                        <Run Text="{Binding LiquidMaxNanoliterPerCentimeter,Mode=OneWay,StringFormat='0.0'}"></Run>
                                                                                                                        <Run Text="(nl)" FontSize="9" Foreground="Gray"></Run>
                                        </TextBlock>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="VOLUME">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock VerticalAlignment="Center">
                                                                                                                        <Run Text="{Binding Volume,StringFormat='0.0'}"></Run>
                                                                                                                        <Run Text="%" Foreground="Gray"></Run>
                                        </TextBlock>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="FORMULA">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock VerticalAlignment="Center">
                                                                                                                        <Run Text="{Binding IdsPack.IdsPackFormula.Name}"></Run>
                                        </TextBlock>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="NL / CM">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock VerticalAlignment="Center">
                                                                                                                        <Run Text="{Binding NanoliterPerCentimeter,Mode=OneWay,StringFormat='0.0'}"></Run>
                                                                                                                        <Run Text="(nl)" FontSize="9" Foreground="Gray"></Run>
                                        </TextBlock>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="NL / SEC">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock VerticalAlignment="Center">
                                                                                                                        <Run Text="{Binding NanoliterPerSecond,Mode=OneWay,StringFormat='0.0'}"></Run>
                                                                                                                        <Run Text="(nl)" FontSize="9" Foreground="Gray"></Run>
                                        </TextBlock>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                            <DataGridTemplateColumn Header="PULSE / SEC">
                                <DataGridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label VerticalAlignment="Center">
                                            <Label.Style>
                                                <Style TargetType="Label">
                                                    <Setter Property="Content">
                                                        <Setter.Value>
                                                            <TextBlock>
                                                                                                                                                 <Run Text="{Binding PulsePerSecond,Mode=OneWay,StringFormat='0.0'}"></Run>
                                                                                                                                                 <Run Text="(pulse)" FontSize="9" Foreground="Gray"></Run>
                                                            </TextBlock>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Style.Triggers>
                                                        <DataTrigger Binding="{Binding DispenserStepDivision}" Value="{x:Static dispensing:DispenserStepDivisions.Auto}">
                                                            <Setter Property="Content" Value="Auto"></Setter>
                                                        </DataTrigger>
                                                        <DataTrigger Binding="{Binding DispenserStepDivision,Converter={StaticResource IsNotConverter},ConverterParameter={x:Static dispensing:DispenserStepDivisions.Auto}}" Value="True">
                                                            <Setter Property="Content">
                                                                <Setter.Value>
                                                                    <TextBlock>
                                                                                                                                                 <Run Text="{Binding PulsePerSecond,Mode=OneWay,StringFormat='0.0'}"></Run>
                                                                                                                                                 <Run Text="(pulse)" FontSize="9" Foreground="Gray"></Run>
                                                                    </TextBlock>
                                                                </Setter.Value>
                                                            </Setter>
                                                        </DataTrigger>
                                                    </Style.Triggers>
                                                </Style>
                                            </Label.Style>
                                        </Label>
                                    </DataTemplate>
                                </DataGridTemplateColumn.CellTemplate>
                            </DataGridTemplateColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </DockPanel>
            </Border>
        </Grid>
        <!--Content-->


        <Border BorderThickness="1" BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=BorderBrush,TargetNullValue={StaticResource BorderBrush},FallbackValue={StaticResource BorderBrush}}">
            <Border.Style>
                <Style TargetType="Border">
                    <Setter Property="Visibility" Value="Collapsed"></Setter>
                    <Style.Triggers>
                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=(local:ElementsEditor.IsSelected)}" Value="True" />
                                <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable}" Value="True" />
                            </MultiDataTrigger.Conditions>

                            <Setter Property="Visibility" Value="Visible"></Setter>
                        </MultiDataTrigger>
                    </Style.Triggers>
                </Style>
            </Border.Style>
            <Grid>
                <ContentPresenter Content="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=InnerContent}"></ContentPresenter>

                <Thumb Opacity="0" DragDelta="MoveDrag" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
                <Thumb HorizontalAlignment="Left" Cursor="SizeWE" Opacity="0" DragDelta="DragLeft" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
                <Thumb HorizontalAlignment="Right" Cursor="SizeWE" Opacity="0" DragDelta="DragRight" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
                <Thumb VerticalAlignment="Top" Cursor="SizeNS" Opacity="0" DragDelta="DragTop" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>
                <Thumb VerticalAlignment="Bottom" Cursor="SizeNS" Opacity="0" DragDelta="DragBottom" DragStarted="DragStarted" DragCompleted="OnDragEnded"></Thumb>

                <Grid ClipToBounds="False" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0 -20 0 0" Width="10" Height="10">
                    <Ellipse Stroke="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" StrokeThickness="2"></Ellipse>
                    <Rectangle HorizontalAlignment="Center" VerticalAlignment="Stretch" Margin="0 10 0 -8" StrokeThickness="1" Stroke="Red"></Rectangle>
                    <Thumb Opacity="0" DragDelta="DragAngle" DragStarted="DragStarted" Cursor="Arrow" DragCompleted="OnDragEnded"></Thumb>
                </Grid>

                <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="-8 -8 0 0">
                    <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 2 0 0"></Border>
                    <Thumb Opacity="0" DragDelta="DragTopLeft" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb>
                </Grid>

                <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 -8 -8 0">
                    <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 2 2 0"></Border>
                    <Thumb Opacity="0" DragDelta="DragTopRight" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb>
                </Grid>

                <Grid Width="10" Height="10" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -8 -8">
                    <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="0 0 2 2"></Border>
                    <Thumb Opacity="0" DragDelta="DragBottomRight" DragStarted="DragStarted" Cursor="SizeNWSE" DragCompleted="OnDragEnded"></Thumb>
                </Grid>

                <Grid Width="10" Height="10" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="-8 0 0 -8">
                    <Border BorderBrush="{Binding RelativeSource={RelativeSource AncestorType=local:ElementEditor},Path=CornersBrush,TargetNullValue={StaticResource CornersBrush},FallbackValue={StaticResource CornersBrush}}" BorderThickness="2 0 0 2"></Border>
                    <Thumb Opacity="0" DragDelta="DragBottomLeft" DragStarted="DragStarted" Cursor="SizeNESW" DragCompleted="OnDragEnded"></Thumb>
                </Grid>
            </Grid>
        </Border>
    </Grid>
</local:ElementEditor>