-
Notifications
You must be signed in to change notification settings - Fork 2
/
MainWindow.xaml
125 lines (107 loc) · 7.96 KB
/
MainWindow.xaml
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
<Window x:Class="BlitFlashNet.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BlitFlashNet"
xmlns:viewModels="clr-namespace:BlitFlashNet.ViewModels"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
mc:Ignorable="d"
Title="32Blit Flasher" SizeToContent="WidthAndHeight" d:DataContext="{d:DesignInstance Type=viewModels:AppViewModel, IsDesignTimeCreatable=False}" IsEnabled="{Binding InterfaceEnabled}" ResizeMode="NoResize">
<Window.Resources>
<Style TargetType="TextBlock" x:Key="FieldNameStyle">
<Setter Property="FontSize" Value="16"></Setter>
<Setter Property="Margin" Value="3"></Setter>
<Setter Property="HorizontalAlignment" Value="Right"></Setter>
<Setter Property="FontWeight" Value="Bold"></Setter>
</Style>
<Style TargetType="TextBlock" x:Key="FieldValueStyle">
<Setter Property="FontSize" Value="16"></Setter>
<Setter Property="Margin" Value="3"></Setter>
<Setter Property="HorizontalAlignment" Value="Left"></Setter>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Margin="3,30,3,3" Grid.Row="0">
<TextBlock Text="Version" VerticalAlignment="Center" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center" Margin="3"></TextBlock>
<ComboBox VerticalAlignment="Center" VerticalContentAlignment="Center" MinWidth="150" Margin="3" ItemsSource="{Binding Releases}" DisplayMemberPath="TagName" SelectedValue="{Binding Release}"></ComboBox>
<TextBlock Text="Flash Tool" VerticalAlignment="Center" FontSize="20" FontWeight="Bold" HorizontalAlignment="Center" Margin="15,3,3,3"></TextBlock>
<ComboBox VerticalAlignment="Center" VerticalContentAlignment="Center" MinWidth="150" Margin="3" ItemsSource="{Binding FlashTools}" SelectedValue="{Binding SelectedFlashTool}"></ComboBox>
</StackPanel>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="Tag" Grid.Column="0" Grid.Row="0" Style="{StaticResource FieldNameStyle}"></TextBlock>
<TextBlock Text="Filename" Grid.Column="0" Grid.Row="1" Style="{StaticResource FieldNameStyle}"></TextBlock>
<TextBlock Text="Author" Grid.Column="0" Grid.Row="2" Style="{StaticResource FieldNameStyle}"></TextBlock>
<TextBlock Text="Date" Grid.Column="0" Grid.Row="3" Style="{StaticResource FieldNameStyle}"></TextBlock>
<TextBlock Text="DfuSe Found" Grid.Column="0" Grid.Row="4" Style="{StaticResource FieldNameStyle}"></TextBlock>
<TextBlock Text="{Binding Release.TagName}" Grid.Column="1" Grid.Row="0" Style="{StaticResource FieldValueStyle}"></TextBlock>
<TextBlock Text="{Binding TargetAsset.Name}" ToolTip="{Binding TargetAsset.DownloadUrl}" Grid.Column="1" Grid.Row="1" Style="{StaticResource FieldValueStyle}" Width="300"></TextBlock>
<TextBlock Text="{Binding Release.Author.Login}" Grid.Column="1" Grid.Row="2" Style="{StaticResource FieldValueStyle}"></TextBlock>
<TextBlock Text="{Binding TargetAsset.UpdatedDate}" Grid.Column="1" Grid.Row="3" Style="{StaticResource FieldValueStyle}"></TextBlock>
<TextBlock Text="{Binding DfuseFound}" Foreground="Brown" FontWeight="Bold" Grid.Column="1" Grid.Row="4" Style="{StaticResource FieldValueStyle}"></TextBlock>
<Button Content="Download Firmware" Grid.Row="5" Grid.Column="0" Margin="3" FontSize="16" FontWeight="Bold" VerticalAlignment="Top" Background="DarkSeaGreen" Command="{Binding DownloadFirmwareCommand1}"></Button>
<Button Content="Flash Firmware" Grid.Column="1" Grid.ColumnSpan="2" Grid.Row="5" Margin="3" FontSize="16" FontWeight="Bold" Background="DarkSalmon" HorizontalAlignment="left" VerticalAlignment="Top" Command="{Binding FlashFirmwareCommand1}"></Button>
<Grid Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0">
<ProgressBar HorizontalAlignment="Left" Minimum="0" Maximum="100" Value="{Binding PercentageComplete}" Visibility="{Binding ProgressBarVisible}" Height="25" Width="300" Margin="3,10,3,3"></ProgressBar>
<TextBlock VerticalAlignment="Center" Text="{Binding PercentageComplete, StringFormat={}{0}%}" Margin="3,10,3,3" Visibility="{Binding ProgressBarVisible}"></TextBlock>
</StackPanel>
<TextBlock Text="Remember to put your device in DFU mode if using DfuSe" FontSize="18" FontWeight="Bold" Margin="3,15,3,10" Foreground="DarkRed" Grid.Row="1"></TextBlock>
<Image Source="https://github.com/pimoroni/32blit-beta/raw/master/docs/resources/enter-dfu-mode.png" Height="270" Margin="0,10,0,15" Grid.Row="2">
<Image.Style>
<Style TargetType="Image">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding IsFlashing}" Value="false">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
<ScrollViewer Height="270" Margin="3,10,3,15" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible" IsEnabled="True" Grid.Row="2">
<ScrollViewer.Style>
<Style TargetType="ScrollViewer">
<Setter Property="Visibility" Value="Collapsed"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding IsFlashing}" Value="true">
<Setter Property="Visibility" Value="Visible"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ScrollViewer.Style>
<TextBlock Text="{Binding FlashOutput}" TextWrapping="Wrap">
<TextBlock.Style>
<Style TargetType="TextBlock">
</Style>
</TextBlock.Style>
</TextBlock>
</ScrollViewer>
</Grid>
</Grid>
</Grid>
</Window>