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.Storage.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:vm="clr-namespace:Tango.MachineStudio.Storage.ViewModels"
xmlns:global="clr-namespace:Tango.MachineStudio.Storage"
xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:localConverters="clr-namespace:Tango.MachineStudio.Storage.Converters"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:Tango.MachineStudio.Storage.Views"
mc:Ignorable="d"
d:DesignHeight="1080" x:Name="control" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
<UserControl.Resources>
<localConverters:StorageItemToImageConverter x:Key="StorageItemToImageConverter" />
<converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter" />
</UserControl.Resources>
<Grid>
<Grid>
<DockPanel>
<Border Background="{StaticResource WhiteBrush100}" Margin="20" Width="350" CornerRadius="5" IsEnabled="{Binding IsFree}">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="10" Color="Gray" />
</Border.Effect>
<DockPanel>
<TextBlock HorizontalAlignment="Left" DockPanel.Dock="Top" Margin="30 55 20 20" FontSize="30" FontStyle="Italic" Foreground="{StaticResource AccentColorBrush}" FontWeight="Bold">ACTIONS</TextBlock>
<StackPanel Margin="0 40 0 0">
<Button Command="{Binding CreateFolderCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="{StaticResource GrayBrush310}" HorizontalContentAlignment="Left">
<DockPanel>
<materialDesign:PackIcon Kind="FolderPlus" Foreground="{StaticResource OrangeBrush250}" Width="32" Height="32" />
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">CREATE FOLDER</TextBlock>
</DockPanel>
</Button>
<Button Command="{Binding DeleteFolderCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="{StaticResource GrayBrush310}" HorizontalContentAlignment="Left">
<DockPanel>
<materialDesign:PackIcon Kind="FolderRemove" Foreground="{StaticResource RedBrush500}" Width="32" Height="32" />
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">DELETE FOLDER</TextBlock>
</DockPanel>
</Button>
<Separator/>
<Button Command="{Binding UploadFileCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="{StaticResource GrayBrush310}" HorizontalContentAlignment="Left">
<DockPanel>
<materialDesign:PackIcon Kind="Upload" Foreground="{StaticResource OrangeBrush250}" Width="32" Height="32" />
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">UPLOAD FILE</TextBlock>
</DockPanel>
</Button>
<Button Command="{Binding DownloadFileCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="{StaticResource GrayBrush310}" HorizontalContentAlignment="Left">
<DockPanel>
<materialDesign:PackIcon Kind="Download" Foreground="{StaticResource GreenDownloadFileBrush}" Width="32" Height="32" />
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">DOWNLOAD FILE</TextBlock>
</DockPanel>
</Button>
<Separator/>
<Button Command="{Binding DeleteFileCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="{StaticResource GrayBrush310}" HorizontalContentAlignment="Left">
<DockPanel>
<materialDesign:PackIcon Kind="Delete" Foreground="{StaticResource RedBrush500}" Width="32" Height="32" />
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">DELETE FILE</TextBlock>
</DockPanel>
</Button>
<Separator/>
<Button Command="{Binding UploadVersionCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="{StaticResource GrayBrush310}" HorizontalContentAlignment="Left">
<DockPanel>
<materialDesign:PackIcon Kind="BriefcaseUpload" Foreground="{StaticResource LilacBrush}" Width="32" Height="32" />
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">UPGRADE VERSION</TextBlock>
</DockPanel>
</Button>
<Button Command="{Binding ValidateVersionCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="{StaticResource GrayBrush310}" HorizontalContentAlignment="Left">
<DockPanel>
<materialDesign:PackIcon Kind="CheckAll" Foreground="{StaticResource LilacBrush100}" Width="32" Height="32" />
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">VALIDATE VERSION</TextBlock>
</DockPanel>
</Button>
<Button Command="{Binding ActivateVersionCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="{StaticResource GrayBrush310}" HorizontalContentAlignment="Left">
<DockPanel>
<materialDesign:PackIcon Kind="Flash" Foreground="{StaticResource LilacBrush200}" Width="32" Height="32" />
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">ACTIVATE VERSION</TextBlock>
</DockPanel>
</Button>
<Button Command="{Binding GenerateTfpCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="{StaticResource GrayBrush310}" HorizontalContentAlignment="Left">
<DockPanel>
<materialDesign:PackIcon Kind="Chip" Foreground="{StaticResource LilacBrush200}" Width="32" Height="32" />
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">GENERATE TFP FILE</TextBlock>
</DockPanel>
</Button>
<Separator/>
<Button Command="{Binding RefreshCommand}" Margin="0 5 0 0" Style="{StaticResource MaterialDesignFlatButton}" Padding="20 10" Height="Auto" Foreground="{StaticResource GrayBrush310}" HorizontalContentAlignment="Left">
<DockPanel>
<materialDesign:PackIcon Kind="Refresh" Foreground="{StaticResource AccentColorBrush}" Width="32" Height="32" />
<TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="18">REFRESH</TextBlock>
</DockPanel>
</Button>
</StackPanel>
</DockPanel>
</Border>
<Grid>
<DockPanel>
<Border DockPanel.Dock="Top" Background="{StaticResource WhiteBrush100}" Margin="20" Height="150" CornerRadius="5" Padding="20 0">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="10" Color="Gray" />
</Border.Effect>
<DockPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" DockPanel.Dock="Left">
<Button Style="{StaticResource MaterialDesignFlatButton}" Width="80" Height="80" Padding="0" Command="{Binding BackCommand}" IsEnabled="{Binding IsFree}">
<materialDesign:PackIcon Kind="ArrowLeft" Width="60" Height="60" />
</Button>
<Button Style="{StaticResource MaterialDesignFlatButton}" Width="80" Height="80" Padding="0" Command="{Binding RefreshCommand}" IsEnabled="{Binding IsFree}">
<materialDesign:PackIcon Kind="Refresh" Width="60" Height="60" />
</Button>
</StackPanel>
<Border DockPanel.Dock="Right" Width="250" Margin="0 20" Background="{StaticResource AccentColorBrush}" TextElement.Foreground="White" CornerRadius="5" Padding="10">
<DockPanel>
<TextBlock DockPanel.Dock="Top" FontSize="18" FontWeight="Bold" FontStyle="Italic" HorizontalAlignment="Center">STORAGE</TextBlock>
<StackPanel>
<TextBlock Margin="0 5 0 0">
<Run>Root:</Run>
<Run FontWeight="Bold" FontStyle="Italic" Text="{Binding StorageManager.StorageDrive.Root}"></Run>
</TextBlock>
<TextBlock Margin="0 5 0 0">
<Run>Capacity:</Run>
<Run FontWeight="Bold" FontStyle="Italic" Text="{Binding StorageManager.StorageDrive.Capacity,Converter={StaticResource ByteArrayToFileSizeConverter}}"></Run>
</TextBlock>
<TextBlock Margin="0 5 0 0">
<Run>Free Space:</Run>
<Run FontWeight="Bold" FontStyle="Italic" Text="{Binding StorageManager.StorageDrive.FreeSpace,Converter={StaticResource ByteArrayToFileSizeConverter}}"></Run>
</TextBlock>
</StackPanel>
</DockPanel>
</Border>
<DockPanel VerticalAlignment="Center" Margin="50 0 50 0">
<Button Margin="10 0 0 0" DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" Width="80" Height="80" Padding="0" Command="{Binding GoCommand}" IsEnabled="{Binding IsFree}">
<materialDesign:PackIcon Kind="SubdirectoryArrowRight" Width="60" Height="60" />
</Button>
<Border Height="35" Background="{StaticResource AccentColorBrush}" CornerRadius="5" Padding="5" IsEnabled="{Binding IsFree}">
<TextBox Style="{x:Null}" Background="Transparent" Foreground="White" FontSize="18" BorderThickness="0" CaretBrush="White" Text="{Binding CurrentPath,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBox.InputBindings>
<KeyBinding Command="{Binding Path=GoCommand}" Key="Enter"/>
</TextBox.InputBindings>
</TextBox>
</Border>
</DockPanel>
</DockPanel>
</Border>
<Grid Margin="20">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100*" MinHeight="150" />
<RowDefinition Height="5" />
<RowDefinition Height="40*" MinHeight="150" />
</Grid.RowDefinitions>
<Border Background="{StaticResource TransparentBackgroundBrush500}" CornerRadius="5" Padding="20">
<DataGrid x:Name="gridStorageItems" IsEnabled="{Binding IsFree}" MouseDoubleClick="DataGrid_MouseDoubleClick" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" CanUserSortColumns="True" IsReadOnly="True" Background="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding StorageManager.CurrentFolder.Items}" SelectedItem="{Binding SelectedStorageItem}">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Width="32" Height="32" HorizontalAlignment="Left" Source="{Binding Converter={StaticResource StorageItemToImageConverter}}"></Image>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="NAME" Width="1*" SortMemberPath="Name">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" VerticalAlignment="Center" FontSize="14" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="TYPE" Width="150" SortMemberPath="Attribute">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Attribute}" VerticalAlignment="Center" FontSize="14" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="SIZE" Width="150" SortMemberPath="Length">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Length,Converter={StaticResource ByteArrayToFileSizeConverter},FallbackValue='',TargetNullValue=''}" VerticalAlignment="Center" FontSize="14" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="LAST MODIFIED" Width="200" SortMemberPath="LastModified">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding LastModified}" VerticalAlignment="Center" FontSize="14" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Border>
<GridSplitter Grid.Row="1" Height="5" VerticalAlignment="Center" HorizontalAlignment="Stretch" Background="Gray" Margin="5 0" />
<Border Background="{StaticResource TransparentBackgroundBrush500}" CornerRadius="5" Padding="20" Grid.Row="3">
<DockPanel>
<TextBlock DockPanel.Dock="Top" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontStyle="Italic" Foreground="{StaticResource AccentColorBrush}" FontWeight="Bold">FILE TRANSFERS</TextBlock>
<DataGrid AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserResizeRows="False" CanUserSortColumns="False" IsReadOnly="True" Background="Transparent" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding FileHandlers}">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
</Style>
</DataGrid.CellStyle>
<DataGrid.Columns>
<DataGridTemplateColumn Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<materialDesign:PackIcon Width="32" Height="32" HorizontalAlignment="Left">
<materialDesign:PackIcon.Style>
<Style TargetType="materialDesign:PackIcon">
<Setter Property="Kind" Value="Download"></Setter>
<Setter Property="Foreground" Value="{StaticResource GreenBrush450}"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Type}" Value="Upload">
<Setter Property="Kind" Value="Upload"></Setter>
<Setter Property="Foreground" Value="{StaticResource OrangeUploadBrush}"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</materialDesign:PackIcon.Style>
</materialDesign:PackIcon>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="FILE" Width="450">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding FilePath}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" FontSize="14" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="PROGRESS" Width="1*">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ProgressBar Height="15" Margin="0 0 30 0" VerticalAlignment="Center" Maximum="{Binding Handler.Total,Mode=OneWay}" Value="{Binding Handler.Current,Mode=OneWay}">
<ProgressBar.Style>
<Style TargetType="ProgressBar">
<Setter Property="Foreground" Value="{StaticResource GreenUploadBrush}"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Handler.Status}" Value="Canceled">
<Setter Property="Foreground" Value="{StaticResource OrangeCanceledBrush}"></Setter>
</DataTrigger>
<DataTrigger Binding="{Binding Handler.Status}" Value="Failed">
<Setter Property="Foreground" Value="{StaticResource RedBrush500}"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ProgressBar.Style>
</ProgressBar>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="STATUS" Width="150">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Handler.Status}" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" FontStyle="Italic" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="150">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ContentControl Content="{Binding}">
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate></DataTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding Handler.Status}" Value="Active">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Button Command="{Binding Source={x:Reference control},Path=DataContext.CancelFileHandlerCommand}" CommandParameter="{Binding}" Margin="5" Background="{StaticResource RedBrush100}" BorderBrush="{StaticResource RedBrush100}">CANCEL</Button>
</DataTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding Handler.Status}" Value="Completed"></Condition>
<Condition Binding="{Binding Type}" Value="Download"></Condition>
</MultiDataTrigger.Conditions>
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Button Command="{Binding Source={x:Reference control},Path=DataContext.OpenFileHandlerCommand}" CommandParameter="{Binding}" Margin="5" Background="{StaticResource GreenOpenFileBrush}" BorderBrush="{StaticResource GreenOpenFileBrush}">OPEN</Button>
</DataTemplate>
</Setter.Value>
</Setter>
</MultiDataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="60">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Foreground="{StaticResource RedBrush100}" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" Width="24" Height="24" Command="{Binding Source={x:Reference control},Path=DataContext.RemoveFileHandlerCommand}" CommandParameter="{Binding}" Margin="5">
<materialDesign:PackIcon Kind="Close" Width="24" Height="24" />
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</DockPanel>
</Border>
</Grid>
</Grid>
</DockPanel>
</Grid>
</DockPanel>
</Grid>
</Grid>
</UserControl>
|