aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml
blob: 77ace3e638bdf2cfaa26cbfd87d32d75606ca75d (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
330
331
332
333
334
335
336
337
338
<UserControl x:Class="Tango.MachineStudio.HardwareDesigner.Views.MainView"
             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:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls"
             xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI"
             xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
             xmlns:local="clr-namespace:Tango.MachineStudio.HardwareDesigner.Views"
             xmlns:vm="clr-namespace:Tango.MachineStudio.HardwareDesigner.ViewModels"
             xmlns:observables="clr-namespace:Tango.Integration.Observables;assembly=Tango.Integration"
             xmlns:global="clr-namespace:Tango.MachineStudio.HardwareDesigner"
             mc:Ignorable="d" 
             d:DesignHeight="720" Background="Transparent" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">

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

    <Grid>
        <Grid>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="477*"/>
                    <ColumnDefinition Width="310"/>
                </Grid.ColumnDefinitions>

                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200"/>
                        <ColumnDefinition Width="1*"/>
                    </Grid.ColumnDefinitions>

                    <Grid Grid.Column="1">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="90"/>
                            <RowDefinition Height="631*"/>
                        </Grid.RowDefinitions>

                        <Grid Margin="-210 0 0 0">
                            <StackPanel Orientation="Horizontal">
                                <TextBlock FontSize="30" FontStyle="Italic" VerticalAlignment="Center" Margin="50 10 10 0" Foreground="Silver" FontWeight="Bold">HARDWARE DESIGNER</TextBlock>
                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="10 10 0 0">
                                    <materialDesign:PackIcon Kind="Pencil" Width="32" Height="32" Foreground="Silver" />
                                    <ComboBox ItemsSource="{Binding Adapter.HardwareVersions}" SelectedItem="{Binding SelectedVersion}" DisplayMemberPath="Name" Width="300" FontSize="16" FontWeight="Bold" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Hardware Version"></ComboBox>
                                </StackPanel>
                            </StackPanel>
                        </Grid>

                        <Viewbox MaxWidth="1200" Grid.Row="1" >
                            <Grid VerticalAlignment="Top">

                                <Image IsHitTestVisible="False" Source="../Images/machine-sketch-trans.png" MaxWidth="800" RenderOptions.BitmapScalingMode="Fant">
                                    <Image.Effect>
                                        <DropShadowEffect ShadowDepth="0" BlurRadius="20" Opacity="1" RenderingBias="Performance" Color="DimGray"></DropShadowEffect>
                                    </Image.Effect>
                                </Image>

                                <Canvas ClipToBounds="False" x:Name="canvas">
                                    <Border BorderThickness="2" BorderBrush="Gray" CornerRadius="0 0 20 20" Width="707" Height="132" Canvas.Left="50" Canvas.Top="378" Background="#ABFFFFFF">
                                        <Grid Style="{StaticResource droppableGrid}" dragAndDrop:DragAndDropService.Drop="OnDancerDrop">
                                            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Silver" FontSize="20">DRAG &amp; DROP DANCERS</TextBlock>
                                            <ListBox x:Name="listDancers" ItemsSource="{Binding CurrentVersionDancerTypes}" Margin="0 5 0 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                                                <ListBox.ItemsPanel>
                                                    <ItemsPanelTemplate>
                                                        <WrapPanel Orientation="Horizontal" />
                                                    </ItemsPanelTemplate>
                                                </ListBox.ItemsPanel>
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate DataType="{x:Type observables:DancerType}">
                                                        <Grid Style="{StaticResource draggableGrid}">
                                                            <Grid.ToolTip>
                                                                <Border Padding="2">
                                                                    <ItemsControl ItemsSource="{Binding Parameters}">
                                                                        <ItemsControl.ItemTemplate>
                                                                            <DataTemplate>
                                                                                <TextBlock Margin="2">
                                                                                                <Run Text="{Binding Name}" FontWeight="SemiBold"></Run>
                                                                                                :
                                                                                                <Run Text="{Binding Value}" FontStyle="Italic"></Run>
                                                                                </TextBlock>
                                                                            </DataTemplate>
                                                                        </ItemsControl.ItemTemplate>
                                                                    </ItemsControl>
                                                                </Border>
                                                            </Grid.ToolTip>
                                                            <Border BorderBrush="Gray" Width="100" Height="100" BorderThickness="1" Background="White" Padding="2" IsHitTestVisible="False">
                                                                <Grid>
                                                                    <StackPanel>
                                                                        <Image Source="../Images/compass.png" Width="32" Margin="5" />
                                                                        <TextBlock FontSize="8" TextAlignment="Center" TextWrapping="Wrap" Margin="0 5 0 0" Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
                                                                    </StackPanel>
                                                                </Grid>
                                                            </Border>
                                                        </Grid>
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </Grid>
                                    </Border>

                                    <Border BorderThickness="2 2 2 0" BorderBrush="Gray" Width="576" Height="157" Canvas.Left="114" Canvas.Top="224" Background="#ABFFFFFF">
                                        <Grid Style="{StaticResource droppableGrid}" dragAndDrop:DragAndDropService.Drop="OnMotorsDrop">
                                            <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Silver" FontSize="20">DRAG &amp; DROP MOTORS</TextBlock>
                                            <ListBox x:Name="listMotors" ItemsSource="{Binding CurrentVersionMotorTypes}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                                                <ListBox.ItemsPanel>
                                                    <ItemsPanelTemplate>
                                                        <WrapPanel Orientation="Horizontal" />
                                                    </ItemsPanelTemplate>
                                                </ListBox.ItemsPanel>
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate DataType="{x:Type observables:MotorType}">
                                                        <Grid Style="{StaticResource draggableGrid}">
                                                            <Grid.ToolTip>
                                                                <Border Padding="2">
                                                                    <ItemsControl ItemsSource="{Binding Parameters}">
                                                                        <ItemsControl.ItemTemplate>
                                                                            <DataTemplate>
                                                                                <TextBlock Margin="2">
                                                                                                <Run Text="{Binding Name}" FontWeight="SemiBold"></Run>
                                                                                                :
                                                                                                <Run Text="{Binding Value}" FontStyle="Italic"></Run>
                                                                                </TextBlock>
                                                                            </DataTemplate>
                                                                        </ItemsControl.ItemTemplate>
                                                                    </ItemsControl>
                                                                </Border>
                                                            </Grid.ToolTip>
                                                            <Border BorderBrush="Gray" Height="25" IsHitTestVisible="False" MaxWidth="100" BorderThickness="1" Background="White" Padding="2">
                                                                <Grid>
                                                                    <StackPanel Orientation="Horizontal">
                                                                        <Image Source="../Images/engine.png" Width="16" />
                                                                        <TextBlock FontSize="8" Margin="5 0 0 0" TextTrimming="CharacterEllipsis" Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
                                                                    </StackPanel>
                                                                </Grid>
                                                            </Border>
                                                        </Grid>
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </Grid>
                                    </Border>
                                </Canvas>
                            </Grid>
                        </Viewbox>
                    </Grid>

                    <Grid>
                        <Grid VerticalAlignment="Bottom" Margin="0 0 0 50" Style="{StaticResource droppableGrid}" dragAndDrop:DragAndDropService.Drop="OnTrashDrop">
                            <StackPanel Margin="0 0 -80 50">
                                <TextBlock HorizontalAlignment="Center" FontSize="20" Foreground="Gray">
                                    DROP HERE TO DELETE
                                </TextBlock>
                                <materialDesign:PackIcon Kind="ArrowDown" HorizontalAlignment="Center" Width="32" Height="32" Foreground="Gray" Margin="0 10 0 0" />
                                <materialDesign:PackIcon Kind="Delete" Foreground="#9EFF6A6A" Width="250" Height="250" HorizontalAlignment="Center" />
                            </StackPanel>
                        </Grid>
                    </Grid>
                </Grid>

                <Grid Grid.Column="1">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="60"/>
                    </Grid.RowDefinitions>

                    <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <Grid>
                            <StackPanel>
                                <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}" Padding="20 10">
                                    <StackPanel>
                                        <TextBlock Text="HARDWARE VERSION" Foreground="Gray" FontWeight="Bold" FontStyle="Italic" FontSize="16"></TextBlock>

                                        <TextBlock Margin="0 10 0 0" FontSize="10" Foreground="Gray">Name</TextBlock>
                                        <TextBox Text="{Binding CurrentVersion.Name,UpdateSourceTrigger=PropertyChanged}"></TextBox>

                                        <TextBlock Margin="0 20 0 0" FontSize="10" Foreground="Gray">Version</TextBlock>
                                        <mahApps:NumericUpDown Minimum="0" BorderThickness="0 0 0 1" HorizontalContentAlignment="Left" Maximum="1000" HasDecimals="True" Value="{Binding CurrentVersion.Version}" />
                                    </StackPanel>
                                </materialDesign:Card>

                                <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}">
                                    <StackPanel>
                                        <Expander HorizontalAlignment="Stretch" Header="Motors">
                                            <ListBox ItemsSource="{Binding Adapter.MotorTypes}" HorizontalContentAlignment="Stretch">
                                                <ListBox.ItemContainerStyle>
                                                    <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
                                                        <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
                                                        <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter>
                                                        <Setter Property="Padding" Value="1"></Setter>
                                                    </Style>
                                                </ListBox.ItemContainerStyle>
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <Grid Background="Transparent" IsHitTestVisible="True" dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}">
                                                            <StackPanel Orientation="Horizontal" Margin="2 8">
                                                                <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/engine.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image>
                                                                <StackPanel Margin="5 0 0 0" IsHitTestVisible="False" VerticalAlignment="Center">
                                                                    <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Name}"></Run></TextBlock>
                                                                </StackPanel>
                                                            </StackPanel>

                                                            <Rectangle Margin="0 10 0 0" VerticalAlignment="Bottom" Stroke="Gainsboro" StrokeThickness="1"></Rectangle>
                                                        </Grid>
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </Expander>
                                        <Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
                                        <Expander HorizontalAlignment="Stretch" Header="Dancers">
                                            <ListBox ItemsSource="{Binding Adapter.DancerTypes}" HorizontalContentAlignment="Stretch">
                                                <ListBox.ItemContainerStyle>
                                                    <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
                                                        <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
                                                        <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter>
                                                        <Setter Property="Padding" Value="1"></Setter>
                                                    </Style>
                                                </ListBox.ItemContainerStyle>
                                                <ListBox.ItemTemplate>
                                                    <DataTemplate>
                                                        <Grid Background="Transparent" IsHitTestVisible="True" dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}">
                                                            <StackPanel Orientation="Horizontal" Margin="2 8">
                                                                <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/compass.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image>
                                                                <StackPanel Margin="5 0 0 0" IsHitTestVisible="False" VerticalAlignment="Center">
                                                                    <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Name}"></Run></TextBlock>
                                                                </StackPanel>
                                                            </StackPanel>

                                                            <Rectangle Margin="0 10 0 0" VerticalAlignment="Bottom" Stroke="Gainsboro" StrokeThickness="1"></Rectangle>
                                                        </Grid>
                                                    </DataTemplate>
                                                </ListBox.ItemTemplate>
                                            </ListBox>
                                        </Expander>
                                    </StackPanel>
                                </materialDesign:Card>

                                <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}">
                                    <StackPanel>
                                        <Grid>
                                            <Expander HorizontalAlignment="Stretch" Header="Selected Motor Properties">
                                                <editors:ParameterizedEditor ParameterizedObject="{Binding ElementName=listMotors,Path=SelectedItem}" Padding="10">
                                                    <editors:ParameterizedEditor.ItemsPanel>
                                                        <ItemsPanelTemplate>
                                                            <StackPanel></StackPanel>
                                                        </ItemsPanelTemplate>
                                                    </editors:ParameterizedEditor.ItemsPanel>
                                                    <editors:ParameterizedEditor.DoubleTemplate>
                                                        <DataTemplate>
                                                            <DockPanel>
                                                                <mahApps:NumericUpDown  DockPanel.Dock="Right" Background="Transparent" BorderThickness="0 0 0 0" Value="{Binding Value,UpdateSourceTrigger=PropertyChanged}" HasDecimals="True" HorizontalContentAlignment="Center" Width="100" />
                                                                <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
                                                            </DockPanel>
                                                        </DataTemplate>
                                                    </editors:ParameterizedEditor.DoubleTemplate>
                                                    <editors:ParameterizedEditor.Int32Template>
                                                        <DataTemplate>
                                                            <DockPanel>
                                                                <mahApps:NumericUpDown  DockPanel.Dock="Right" Background="Transparent" BorderThickness="0 0 0 0" Value="{Binding Value,Converter={StaticResource DoubleToIntConverter},UpdateSourceTrigger=PropertyChanged}" HasDecimals="False" HorizontalContentAlignment="Center" Width="100" />
                                                                <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
                                                            </DockPanel>
                                                        </DataTemplate>
                                                    </editors:ParameterizedEditor.Int32Template>
                                                    <editors:ParameterizedEditor.BooleanTemplate>
                                                        <DataTemplate>
                                                            <DockPanel Margin="0 5 0 0">
                                                                <ToggleButton DockPanel.Dock="Right"  Width="100" IsChecked="{Binding Value}" HorizontalAlignment="Right" />
                                                                <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
                                                            </DockPanel>
                                                        </DataTemplate>
                                                    </editors:ParameterizedEditor.BooleanTemplate>
                                                </editors:ParameterizedEditor>
                                            </Expander>
                                        </Grid>
                                    </StackPanel>
                                </materialDesign:Card>

                                <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}">
                                    <StackPanel>
                                        <Grid>
                                            <Expander HorizontalAlignment="Stretch" Header="Selected Dancer Properties">
                                                <editors:ParameterizedEditor ParameterizedObject="{Binding ElementName=listDancers,Path=SelectedItem}" Padding="10">
                                                    <editors:ParameterizedEditor.ItemsPanel>
                                                        <ItemsPanelTemplate>
                                                            <StackPanel></StackPanel>
                                                        </ItemsPanelTemplate>
                                                    </editors:ParameterizedEditor.ItemsPanel>
                                                    <editors:ParameterizedEditor.DoubleTemplate>
                                                        <DataTemplate>
                                                            <DockPanel>
                                                                <mahApps:NumericUpDown  DockPanel.Dock="Right" Background="Transparent" BorderThickness="0 0 0 0" Value="{Binding Value,UpdateSourceTrigger=PropertyChanged}" HasDecimals="True" HorizontalContentAlignment="Center" Width="100" />
                                                                <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
                                                            </DockPanel>
                                                        </DataTemplate>
                                                    </editors:ParameterizedEditor.DoubleTemplate>
                                                    <editors:ParameterizedEditor.Int32Template>
                                                        <DataTemplate>
                                                            <DockPanel>
                                                                <mahApps:NumericUpDown  DockPanel.Dock="Right" Background="Transparent" BorderThickness="0 0 0 0" Value="{Binding Value,Converter={StaticResource DoubleToIntConverter},UpdateSourceTrigger=PropertyChanged}" HasDecimals="False" HorizontalContentAlignment="Center" Width="100" />
                                                                <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
                                                            </DockPanel>
                                                        </DataTemplate>
                                                    </editors:ParameterizedEditor.Int32Template>
                                                    <editors:ParameterizedEditor.BooleanTemplate>
                                                        <DataTemplate>
                                                            <DockPanel Margin="0 5 0 0">
                                                                <ToggleButton DockPanel.Dock="Right"  Width="100" IsChecked="{Binding Value}" HorizontalAlignment="Right" />
                                                                <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
                                                            </DockPanel>
                                                        </DataTemplate>
                                                    </editors:ParameterizedEditor.BooleanTemplate>
                                                </editors:ParameterizedEditor>
                                            </Expander>
                                        </Grid>
                                    </StackPanel>
                                </materialDesign:Card>
                            </StackPanel>
                        </Grid>
                    </ScrollViewer>

                    <Grid Grid.Row="1" Margin="10">
                        <Button Height="Auto" Command="{Binding SaveCommand}" Margin="0 0 0 0">
                            <StackPanel Orientation="Horizontal">
                                <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="ContentSaveSettings"></materialDesign:PackIcon>
                                <TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">SAVE</TextBlock>
                            </StackPanel>
                        </Button>
                    </Grid>
                </Grid>
            </Grid>
        </Grid>

        <dragAndDrop:DraggingSurface x:Name="dragSufrace" />
    </Grid>
</UserControl>