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
|
<UserControl x:Class="Tango.FSE.MachineConfiguration.Views.DataStoreView"
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:Tango.FSE.MachineConfiguration.Views"
xmlns:helpers="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI"
xmlns:global="clr-namespace:Tango.FSE.MachineConfiguration"
xmlns:controls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common"
xmlns:vm="clr-namespace:Tango.FSE.MachineConfiguration.ViewModels"
xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:commonControls="clr-namespace:Tango.FSE.Common.Controls;assembly=Tango.FSE.Common"
xmlns:resolution="clr-namespace:Tango.FSE.Common.Resolution;assembly=Tango.FSE.Common"
xmlns:converters="clr-namespace:Tango.FSE.MachineConfiguration.Converters"
mc:Ignorable="d"
d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:DataStoreViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.DataStoreViewVM}" d:DesignStyle="{StaticResource FSE_User_Control_Designer}">
<UserControl.Resources>
<converters:DataStoreValueToStringConverter x:Key="DataStoreValueToStringConverter" />
</UserControl.Resources>
<DockPanel Margin="0 10 0 0">
<DockPanel DockPanel.Dock="Top">
<DockPanel DockPanel.Dock="Left" HorizontalAlignment="Left">
<Image Source="../Images/data_collection.png" Stretch="Uniform" Width="40" RenderOptions.BitmapScalingMode="Fant" Opacity="0.5" />
<DockPanel Margin="10 0 0 0" >
<TextBlock Margin="0 5 0 0" FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GrayBrush}">
<Run>The data store contains global and local (machine) configuration and calibration parameters.</Run>
<LineBreak/>
<Run>Updating the data store parameters will take effect on the next machine cloud synchronization pass.</Run>
<LineBreak/>
<Run>If this is the currently connected machine, updating the data store will take effect immediately.</Run>
</TextBlock>
</DockPanel>
</DockPanel>
<DockPanel DockPanel.Dock="Right" Margin="0 0 10 0" VerticalAlignment="Center" ToolTip="Allow updates on this grid based on changes that are triggered by the machine's firmware device">
<ToggleButton IsChecked="{Binding DataStoreProvider.AcceptFirmwareChanges}" />
<TextBlock Margin="10 0 0 0" FontSize="{StaticResource FSE_SmallFontSize}" VerticalAlignment="Center">Accept Real-Time Firmware Updates</TextBlock>
</DockPanel>
<Grid>
</Grid>
</DockPanel>
<DockPanel Margin="0 20 0 0">
<DockPanel DockPanel.Dock="Bottom" >
<Grid DockPanel.Dock="Left">
<DockPanel VerticalAlignment="Center" Visibility="{Binding CanSync,Converter={StaticResource BooleanToVisibilityConverter}}">
<material:PackIcon Kind="InfoCircleOutline" Foreground="{StaticResource FSE_GreenBrush}" />
<TextBlock FontSize="{StaticResource FSE_SmallFontSize}" Foreground="{StaticResource FSE_GreenBrush}" VerticalAlignment="Center" Margin="5 2 0 0">Machine is connected, updating the data store will take effect immediately.</TextBlock>
</DockPanel>
</Grid>
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" Margin="0 10 0 5">
<Button IsEnabled="{Binding IsFree}" ToolTip="Import a data store csv file" Width="120" VerticalAlignment="Center" Margin="0 0 10 0" Height="35" material:ButtonAssist.CornerRadius="18" Style="{StaticResource FSE_RaisedButton_Dark_Hover}" Command="{Binding ImportCommand}">
<DockPanel>
<material:PackIcon Kind="Import" />
<TextBlock Margin="5 0 0 0">IMPORT</TextBlock>
</DockPanel>
</Button>
<Button IsEnabled="{Binding IsFree}" ToolTip="Export this data store to a csv file" Width="120" VerticalAlignment="Center" Margin="0 0 10 0" Height="35" material:ButtonAssist.CornerRadius="18" Style="{StaticResource FSE_RaisedButton_Dark_Hover}" Command="{Binding ExportCommand}">
<DockPanel>
<material:PackIcon Kind="Export" />
<TextBlock Margin="5 0 0 0">EXPORT</TextBlock>
</DockPanel>
</Button>
<Button ToolTip="Apply the data store changes" IsEnabled="{Binding IsFree}" Width="200" Height="45" material:ButtonAssist.CornerRadius="25" Command="{Binding SaveCommand}">
<DockPanel>
<material:PackIcon Kind="ContentSaveAll" />
<TextBlock Margin="5 0 0 0">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="UPDATE"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding CanSync}" Value="True">
<Setter Property="Text" Value="UPDATE & SYNC"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DockPanel>
</Button>
</StackPanel>
<Grid>
<!--FOOTER CENTER CONTENT-->
</Grid>
</DockPanel>
<Grid>
<DockPanel>
<Grid DockPanel.Dock="Top" Panel.ZIndex="100">
<!--TOP BAR-->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0 0 5 -45">
<DockPanel Margin="0 0 20 0" VerticalAlignment="Center">
<material:PackIcon Kind="Search" resolution:ResolutionHelper.Mode="High" Foreground="{StaticResource FSE_PrimaryAccentBrush}" VerticalAlignment="Center" Width="24" Height="24" Margin="0 0 5 0" />
<TextBox IsEnabled="{Binding IsFree}" material:HintAssist.Hint="Search" Text="{Binding Filter,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,Delay=500}" Background="{StaticResource FSE_PrimaryBackgroundBrush}" Width="250" Style="{StaticResource FSE_Rounded_Corners_TextBox}" Height="33"></TextBox>
</DockPanel>
<controls:TextIconButton IsEnabled="{Binding IsFree}" material:ButtonAssist.CornerRadius="15" Command="{Binding AddItemCommand}" Icon="Add" Width="150">ADD ITEM</controls:TextIconButton>
<commonControls:IconButton Margin="10 0 0 0" Icon="Refresh" Foreground="{StaticResource FSE_PrimaryAccentBrush}" Cursor="Hand" ToolTip="Reload the data store" Command="{Binding ReloadCommand}" />
</StackPanel>
</Grid>
<DockPanel>
<!--<TextBlock Margin="0 -25 0 0" DockPanel.Dock="Top" FontFamily="{StaticResource hand}" Foreground="{StaticResource FSE_PrimaryAccentBrush}" FontSize="{StaticResource FSE_LargerFontSize}">Collections</TextBlock>-->
<DockPanel>
<Border DockPanel.Dock="Bottom" Height="50" Background="#404040" CornerRadius="0 0 5 5">
<controls:TextIconButton IsEnabled="{Binding IsFree}" material:ButtonAssist.CornerRadius="15" Command="{Binding AddCollectionCommand}" Icon="Add" Width="180">ADD COLLECTION</controls:TextIconButton>
</Border>
<Border Padding="8" Background="{StaticResource FSE_PrimaryBackgroundMidBrush}" CornerRadius="5 5 0 0" BorderThickness="1" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}">
<ListBox IsEnabled="{Binding IsFree}" ItemsSource="{Binding DataStore.Collections}" SelectedItem="{Binding SelectedCollection}" MinWidth="200" HorizontalContentAlignment="Stretch">
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel>
<material:PackIcon Kind="Collection" />
<controls:IconButton DockPanel.Dock="Right" HorizontalAlignment="Right" ToolTip="Delete collection" Cursor="Hand" Width="20" Height="20" Padding="0" Icon="Close" Foreground="{StaticResource FSE_RedBrush}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveCollectionCommand}" CommandParameter="{Binding}" />
<TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Name}"></TextBlock>
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
</DockPanel>
</DockPanel>
<Grid Margin="10 0 0 0">
<Border Background="#8B202020" Padding="0 0 0 5" CornerRadius="5" BorderThickness="1" BorderBrush="{StaticResource FSE_PrimaryBackgroundLightBrush}">
<Grid>
<Border VerticalAlignment="Top" Background="{StaticResource FSE_PrimaryBackgroundLightBrush}" Height="47" CornerRadius="5 5 0 0">
</Border>
<DataGrid IsEnabled="{Binding IsFree}" IsReadOnly="True" helpers:DataGridHelper.DoubleClickCommand="{Binding EditItemCommand}" AutoGenerateColumns="False" Style="{StaticResource FSE_DataGrid}" CellStyle="{StaticResource FSE_DataGrid_Cell}" CanUserReorderColumns="False" CanUserSortColumns="False" ItemsSource="{Binding SelectedCollection.Items}" SelectedItem="{Binding SelectedItem}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="50">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<material:PackIcon Kind="Key" Width="32" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="KEY" Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Key}"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="TYPE" Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Type}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource FSE_PrimaryForegroundBrush}"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Type}" Value="Boolean">
<Setter Property="Foreground" Value="#FF9BFF"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="Bytes">
<Setter Property="Foreground" Value="#FFFBA3"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="Double">
<Setter Property="Foreground" Value="#85B1FF"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="Float">
<Setter Property="Foreground" Value="#FFDCB8"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="Int32">
<Setter Property="Foreground" Value="#FF858D "></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="String">
<Setter Property="Foreground" Value="#B9FFA5"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="Proto">
<Setter Property="Foreground" Value="#A5FFF9"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="GLOBAL" Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding GlobalItem,Converter={StaticResource DataStoreValueToStringConverter},TargetNullValue='-'}"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="LOCAL" Width="1*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding FormattedValue,Converter={StaticResource StringToOneLineConverter},ConverterParameter='100',Mode=OneWay}" Visibility="{Binding IsDeleted,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="FontWeight" Value="Normal"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding HasDifference}" Value="True">
<Setter Property="FontWeight" Value="Bold"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<UniformGrid Columns="2">
<controls:IconButton ToolTip="Edit local value" Cursor="Hand" Width="20" Padding="0" Height="20" Icon="Edit" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.EditItemCommand}" CommandParameter="{Binding}" />
<Grid IsEnabled="{Binding IsGlobal,Converter={StaticResource BooleanInverseConverter}}">
<controls:IconButton ToolTip="Delete local" IsEnabled="{Binding IsDeleted,Converter={StaticResource BooleanInverseConverter}}" Cursor="Hand" Width="20" Height="20" Padding="0" Icon="Close" Foreground="{StaticResource FSE_RedBrush}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RemoveItemCommand}" CommandParameter="{Binding}" />
</Grid>
</UniformGrid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
</Grid>
</DockPanel>
</Grid>
</DockPanel>
</DockPanel>
</UserControl>
|