aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml
blob: d66005016fecba5b4bc6524fa52994c3c42ef5fa (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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<UserControl x:Class="Tango.PPC.Jobs.Views.JobView"
             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:vm="clr-namespace:Tango.PPC.Jobs.ViewModels"
             xmlns:fa="http://schemas.fontawesome.io/icons/"
             xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
             xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch"
             xmlns:global="clr-namespace:Tango.PPC.Jobs"
             xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
             xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
             xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
             xmlns:local="clr-namespace:Tango.PPC.Jobs.Views"
             mc:Ignorable="d" 
             d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobViewVM}">

    <UserControl.Resources>
        <Style TargetType="FrameworkElement" x:Key="Level1Container">
            <Setter Property="Margin" Value="20 15 60 15"></Setter>
        </Style>
        <Style TargetType="FrameworkElement" x:Key="Level2Container">
            <Setter Property="Margin" Value="80 30 60 0"></Setter>
        </Style>
        <Style TargetType="FrameworkElement" x:Key="Level2ContainerExtraMargin">
            <Setter Property="Margin" Value="80 40 60 0"></Setter>
        </Style>

        <converters:SegmentToBrushConverter x:Key="SegmentToBrushConverter" />
    </UserControl.Resources>

    <Grid Background="{StaticResource TangoMidBackgroundBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="1*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid x:Name="Container" keyboard:KeyboardView.ContainerOffset="40" Grid.RowSpan="2">
                <touch:LightTouchScrollViewer>
                    <StackPanel Margin="10 60 10 0">
                        <StackPanel>
                            <touch:TouchExpander Padding="20 15">
                                <touch:TouchExpander.Header>
                                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0">
                                        <Image Source="../Images/JobView/job-details.png" Width="39" />
                                        <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Details</TextBlock>

                                        <TextBlock FontWeight="Medium" Margin="50 0 0 0" VerticalAlignment="Center" Text="{Binding Job.Rml.Name}"></TextBlock>
                                    </StackPanel>
                                </touch:TouchExpander.Header>

                                <StackPanel Margin="60 30 60 20" TextElement.FontWeight="Medium">
                                    <controls:TableGrid RowHeight="50">

                                        <TextBlock>Job name:</TextBlock>
                                        <touch:TouchTextBox Text="{Binding Job.Name,UpdateSourceTrigger=PropertyChanged}" KeyboardMode="AlphaNumeric" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" />

                                        <TextBlock>Customer:</TextBlock>
                                        <touch:TouchAutoComplete Text="{Binding CustomersFilter}" ItemsSource="{Binding Customers}" SelectedItem="{Binding Job.Customer}" DisplayMemberPath="Name" AutoCompleteProvider="{Binding CustomersAutoCompleteProvider}" KeyboardMode="AlphaNumeric" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" />

                                        <TextBlock>Thread type:</TextBlock>
                                        <touch:TouchComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding Job.Rml}" DisplayMemberPath="Name" Title="Select Thread Type" />

                                        <TextBlock>Comment:</TextBlock>
                                        <TextBox Margin="20 0 0 -42" Text="{Binding Job.Description}" FocusVisualStyle="{x:Null}" BorderBrush="{StaticResource TangoDividerBrush}" Foreground="{StaticResource TangoDarkForegroundBrush}" AcceptsReturn="True" TextWrapping="Wrap" Height="60" Padding="5">

                                        </TextBox>
                                    </controls:TableGrid>

                                    <Grid HorizontalAlignment="Center" Margin="0 20 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>

                                        <TextBlock HorizontalAlignment="Left">
                                    <Run Text="Job status:"></Run>
                                    <Run Text="{Binding Job.JobStatus}"></Run>
                                        </TextBlock>

                                        <Rectangle Margin="20 0" Grid.Column="1" HorizontalAlignment="Center" StrokeThickness="1" Stroke="{StaticResource TangoGrayTextBrush}" />

                                        <TextBlock Grid.Column="2" HorizontalAlignment="Center">
                                    <Run Text="Last updated:"></Run>
                                    <Run Text="{Binding Job.LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter},TargetNullValue=Never}"></Run>
                                        </TextBlock>

                                        <Rectangle Margin="20 0" Grid.Column="3" HorizontalAlignment="Center" StrokeThickness="1" Stroke="{StaticResource TangoGrayTextBrush}" />

                                        <TextBlock Grid.Column="4" HorizontalAlignment="Right">
                                    <Run Text="Last dye:"></Run>
                                    <Run Text="{Binding Job.LastRun,Converter={StaticResource DateTimeUTCToShortDateConverter},TargetNullValue=Never}"></Run>
                                        </TextBlock>
                                    </Grid>
                                </StackPanel>
                            </touch:TouchExpander>

                            <Border Style="{StaticResource TangoTouchBorder}" Margin="0 12 0 0" Padding="0 0 0 40">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  Style="{StaticResource Level1Container}">
                                        <Image Source="../Images/JobView/color-length.png" Width="39" />
                                        <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Color &amp; Length</TextBlock>
                                    </StackPanel>

                                    <DockPanel Style="{StaticResource Level2Container}">
                                        <TextBlock Text="Color Catalog/Space" VerticalAlignment="Center"></TextBlock>
                                        <touch:TouchComboBox Margin="20 0 0 0" ItemsSource="{Binding ColorSpaces}" SelectedItem="{Binding Job.ColorSpace}" DisplayMemberPath="Name" Title="Select Color Catalog/Space" />
                                    </DockPanel>

                                    <DockPanel LastChildFill="False" Style="{StaticResource Level2ContainerExtraMargin}" Height="40">
                                        <StackPanel DockPanel.Dock="Left" Orientation="Horizontal">
                                            <touch:TouchToggleIconButton x:Name="toggle_small_list" IsChecked="{Binding ElementName=toggle_large_list,Path=IsChecked,Mode=OneWay,Converter={StaticResource BooleanInverseConverter}}" DockPanel.Dock="Right" Icon="List" CheckedIcon="List" Padding="8" CornerRadius="20" />
                                            <Rectangle HorizontalAlignment="Left" Stroke="{StaticResource TangoDividerBrush}" Margin="10 8" />
                                            <touch:TouchToggleIconButton x:Name="toggle_large_list" IsChecked="{Binding ElementName=toggle_small_list,Path=IsChecked,Mode=OneWay,Converter={StaticResource BooleanInverseConverter}}" DockPanel.Dock="Right" Icon="ThList" CheckedIcon="ThList" Padding="8" CornerRadius="20" />
                                        </StackPanel>

                                        <touch:TouchToggleIconButton DockPanel.Dock="Right" Icon="Pencil" CheckedIcon="Pencil" Padding="8" CornerRadius="20" />
                                    </DockPanel>

                                    <ItemsControl Style="{StaticResource Level2Container}" ItemsSource="{Binding Job.Segments}">
                                        <ItemsControl.ItemTemplate>
                                            <DataTemplate>
                                                <Border Margin="0 0 0 15" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}">
                                                    <Border.Style>
                                                        <Style TargetType="Border">
                                                            <Setter Property="Height" Value="163"></Setter>
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True">
                                                                    <Setter Property="Height" Value="74"></Setter>
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Border.Style>
                                                    <Border.Effect>
                                                        <DropShadowEffect Opacity="0.5" Color="{StaticResource TangoDropShadowColor}" BlurRadius="10" ShadowDepth="15" />
                                                    </Border.Effect>

                                                    <DockPanel>
                                                        <Border DockPanel.Dock="Left" CornerRadius="8 0 0 8" Background="{Binding SegmentBrush}">
                                                            <Border.Style>
                                                                <Style TargetType="Border">
                                                                    <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter>
                                                                    <Style.Triggers>
                                                                        <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True">
                                                                            <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2'}"></Setter>
                                                                        </DataTrigger>
                                                                    </Style.Triggers>
                                                                </Style>
                                                            </Border.Style>
                                                        </Border>

                                                        <Grid>
                                                            <DockPanel Margin="30 0" VerticalAlignment="Center">
                                                                <TextBlock DockPanel.Dock="Top" FontSize="{StaticResource TangoTitleFontSize}">
                                                                    <Run>Segment #</Run>
                                                                    <Run Text="{Binding SegmentIndex,Mode=OneWay}"></Run>
                                                                </TextBlock>

                                                                <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}">
                                                                    <DockPanel LastChildFill="False">
                                                                        <TextBlock VerticalAlignment="Center" DockPanel.Dock="Left" Text="Color code:"></TextBlock>

                                                                        <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0]}">
                                                                            <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180">
                                                                                <ContentControl.Style>
                                                                                    <Style TargetType="ContentControl">
                                                                                        <Setter Property="ContentTemplate" Value="{x:Null}"></Setter>
                                                                                        <Style.Triggers>
                                                                                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="RGB">
                                                                                                <Setter Property="ContentTemplate">
                                                                                                    <Setter.Value>
                                                                                                        <DataTemplate>
                                                                                                            <UniformGrid Rows="1" Columns="3">
                                                                                                                <touch:TouchTextBox Margin="2 0" HorizontalContentAlignment="Center" Text="{Binding Red,UpdateSourceTrigger=PropertyChanged}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" />
                                                                                                                <touch:TouchTextBox Margin="2 0" HorizontalContentAlignment="Center" Text="{Binding Green,UpdateSourceTrigger=PropertyChanged}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" />
                                                                                                                <touch:TouchTextBox Margin="2 0" HorizontalContentAlignment="Center" Text="{Binding Blue,UpdateSourceTrigger=PropertyChanged}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" />
                                                                                                            </UniformGrid>
                                                                                                        </DataTemplate>
                                                                                                    </Setter.Value>
                                                                                                </Setter>
                                                                                            </DataTrigger>
                                                                                        </Style.Triggers>
                                                                                    </Style>
                                                                                </ContentControl.Style>
                                                                            </ContentControl>
                                                                        </Grid>
                                                                    </DockPanel>
                                                                    <DockPanel LastChildFill="False" Margin="0 20 0 0">
                                                                        <TextBlock VerticalAlignment="Center" DockPanel.Dock="Left" Text="Length (m):"></TextBlock>
                                                                        <touch:TouchTextBox Width="180" DockPanel.Dock="Right" Text="{Binding Length,StringFormat=0.0}" />
                                                                    </DockPanel>
                                                                </StackPanel>
                                                            </DockPanel>

                                                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 50 0" Text="{Binding Length,StringFormat={}{0:N1} m}"></TextBlock>
                                                        </Grid>
                                                    </DockPanel>
                                                </Border>
                                            </DataTemplate>
                                        </ItemsControl.ItemTemplate>
                                    </ItemsControl>

                                    <StackPanel HorizontalAlignment="Right" Style="{StaticResource Level2Container}" Orientation="Horizontal">
                                        <touch:TouchButton Command="{Binding AddSolidSegmentCommand}" FontWeight="Normal" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontSize="{StaticResource TangoDefaultFontSize}" EnableDropShadow="False" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="170" CornerRadius="20" Padding="0 10" Background="Transparent" BorderThickness="2" BorderBrush="{StaticResource TangoPrimaryAccentBrush}">
                                            <StackPanel Orientation="Horizontal">
                                                <fa:ImageAwesome Icon="Plus" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="16" Height="16" />
                                                <TextBlock Margin="10 0 0 0">SOLID SEGMENT</TextBlock>
                                            </StackPanel>
                                        </touch:TouchButton>
                                        <touch:TouchButton FontWeight="Normal" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontSize="{StaticResource TangoDefaultFontSize}" Margin="30 0 0 0" EnableDropShadow="False" Foreground="{StaticResource TangoPrimaryAccentBrush}" Padding="0 10" Width="200" CornerRadius="20" Background="Transparent" BorderThickness="2">
                                            <touch:TouchButton.BorderBrush>
                                                <LinearGradientBrush>
                                                    <GradientStop Offset="0" Color="{StaticResource TangoPrimaryAccentColor}" />
                                                    <GradientStop Offset="1" Color="#57F157" />
                                                </LinearGradientBrush>
                                            </touch:TouchButton.BorderBrush>

                                            <StackPanel Orientation="Horizontal">
                                                <fa:ImageAwesome Icon="Plus" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="16" Height="16" />
                                                <TextBlock Margin="10 0 0 0">GRADIENT SEGMENT</TextBlock>
                                            </StackPanel>
                                        </touch:TouchButton>
                                    </StackPanel>

                                    <StackPanel Style="{StaticResource Level2Container}">
                                        <StackPanel Margin="0 10 0 0">
                                            <touch:TouchCheckBox HorizontalAlignment="Left" IsChecked="{Binding Job.EnableInterSegment}">Include white gap between segments</touch:TouchCheckBox>
                                        </StackPanel>
                                    </StackPanel>

                                    <Rectangle Stroke="{StaticResource TangoDividerBrush}" Margin="0 30 0 0" />

                                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  Style="{StaticResource Level1Container}">
                                        <Image Source="../Images/JobView/output.png" Width="39" />
                                        <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Output</TextBlock>
                                    </StackPanel>

                                    <DockPanel Style="{StaticResource Level2Container}">
                                        <TextBlock Text="Output spool (m):" VerticalAlignment="Center"></TextBlock>
                                        <touch:TouchComboBox ItemsSource="{Binding SpoolTypes}" SelectedItem="{Binding Job.SpoolType}" Margin="40 0 0 0" DisplayMemberPath="Name" Title="Select Output Spool" />
                                    </DockPanel>

                                    <DockPanel Style="{StaticResource Level2Container}">
                                        <TextBlock Text="Segments per spool:" VerticalAlignment="Center"></TextBlock>
                                        <touch:TouchToggleSlider Margin="30 0 0 0" BorderThickness="2" Height="38" Width="83" HorizontalAlignment="Left" UncheckedContent="One" CheckedContent="All" IsChecked="{Binding Job.IsAllSegmentsPerSpool}" />
                                    </DockPanel>
                                </StackPanel>
                            </Border>

                            <Border Style="{StaticResource TangoTouchBorder}" Margin="0 12 0 0" Padding="0 0 0 40">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  Style="{StaticResource Level1Container}">
                                        <Image Source="../Images/JobView/job-summary.png" Width="39" />
                                        <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Summary</TextBlock>
                                    </StackPanel>
                                </StackPanel>
                            </Border>

                            <Border Style="{StaticResource TangoTouchBorder}" Margin="0 12 0 120" Padding="0 0 0 40">
                                <StackPanel>
                                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center"  Style="{StaticResource Level1Container}">
                                        <Image Source="../Images/JobView/additional-tools.png" Width="39" />
                                        <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Additional Tools</TextBlock>
                                    </StackPanel>

                                    <StackPanel Style="{StaticResource Level2Container}" HorizontalAlignment="Left">

                                        <DockPanel LastChildFill="False">
                                            <TextBlock Text="Make a sample dye" VerticalAlignment="Center"></TextBlock>
                                            <touch:TouchToggleSlider DockPanel.Dock="Right" Width="75" Style="{StaticResource TouchToggleButtonCheck}" Margin="30 0 0 0" Height="38" HorizontalAlignment="Left" />
                                        </DockPanel>

                                        <DockPanel Margin="0 25 0 0" LastChildFill="False">
                                            <TextBlock Text="Run color fine tuning" VerticalAlignment="Center"></TextBlock>
                                            <touch:TouchToggleSlider DockPanel.Dock="Right" Width="75" Style="{StaticResource TouchToggleButtonCheck}" Margin="30 0 0 0" Height="38" HorizontalAlignment="Left" />
                                        </DockPanel>
                                    </StackPanel>
                                </StackPanel>
                            </Border>
                        </StackPanel>
                    </StackPanel>
                </touch:LightTouchScrollViewer>
            </Grid>

            <Grid Grid.Row="1">
                <Grid.Background>
                    <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                        <GradientStop Offset="0" Color="#AEFFFFFF" />
                        <GradientStop Offset="1" Color="{StaticResource TangoPrimaryBackgroundColor}" />
                    </LinearGradientBrush>
                </Grid.Background>
                <Rectangle Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Top" />
                <Border Padding="20 20">
                    <Grid>
                        <touch:TouchButton Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" Command="{Binding DyeCommand}">
                            DYE
                        </touch:TouchButton>
                    </Grid>
                </Border>
            </Grid>
        </Grid>

        <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}">
            <Border.Effect>
                <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" />
            </Border.Effect>

            <Grid>
                <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold" Text="{Binding Job.Name}"></TextBlock>
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Height="57" Margin="0 0 30 -45">
                    <touch:TouchButton Margin="0 0 30 0" Padding="15" Style="{StaticResource TangoRoundTouchButton}">
                        <Image Source="../Images/JobView/delete.png" />
                    </touch:TouchButton>
                    <touch:TouchButton Padding="20" Style="{StaticResource TangoRoundTouchButton}">
                        <Image Source="../Images/JobView/remove.png" />
                    </touch:TouchButton>
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>