-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainWindow.xaml
201 lines (189 loc) · 9.16 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
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
<Window
x:Class="CSharpWpfYouTube.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:ui="http://schemas.modernwpf.com/2019"
Title="{Binding AppTitle}"
Width="1450"
Height="960"
MinWidth="1170"
MinHeight="600"
Icon="/CSharpWpfYouTube;component/CSharpWpfYouTube.ico"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" MinHeight="230" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<Border
Grid.Row="0"
BorderBrush="Black"
BorderThickness="0">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0" Color="#AA2196F3" />
<GradientStop Offset="1.0" Color="#662196F3" />
</LinearGradientBrush>
</Border.Background>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label
Margin="20,10,10,0"
Content="Groups"
FontSize="20" />
<ComboBox
Grid.Column="1"
Height="30"
Margin="0,10,0,0"
Background="#EDEDED"
FontSize="18"
FontWeight="SemiBold"
ItemsSource="{Binding VideoGroupList}"
SelectedItem="{Binding SelectedVideoGroup}" />
<Label
Grid.Column="2"
Margin="15,10,0,0"
Content="Import YouTube videos by groups into local SQLite DB with info from YouTube data service API"
FontSize="20"
Foreground="Navy" />
</Grid>
</Border>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="290" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- 1st column - Video group/info list -->
<Border Grid.Column="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="48" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Grid.Row="0" Background="#662196F3">
<DockPanel Margin="0">
<TextBlock
Margin="15,7,10,10"
FontSize="22"
FontWeight="Normal"
Text="Selected Group" />
<TextBlock
FontSize="22"
FontWeight="SemiBold"
Text="{Binding SelectedVideoGroup}" />
<!-- Gap for the look -->
<Rectangle
Width="18"
Margin="0,-1,0,0"
HorizontalAlignment="Right"
Fill="WhiteSmoke" />
</DockPanel>
</Border>
<!-- Filtered VideoInfoByGroupList by SelectedVideoGroup -->
<DataGrid
x:Name="videoHistoryListDataGrid"
Grid.Row="1"
Background="#FFECECEC"
BorderThickness="0"
GridLinesVisibility="None"
ItemsSource="{Binding VideoInfoByGroupList}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Auto"
SelectedItem="{Binding SelectedVideoInfo}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="*" Header="Video">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<!-- Need Grid (not StackPanel) for TextBlock to wrap -->
<Grid Background="#19000000">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="90" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Ellipse
Width="70"
Height="70"
Margin="0,10">
<Ellipse.Fill>
<ImageBrush ImageSource="{Binding CoverUrl, FallbackValue={x:Null}}" Stretch="UniformToFill" />
</Ellipse.Fill>
</Ellipse>
<StackPanel Grid.Column="1">
<TextBlock
Margin="5,7,5,10"
Padding="5,2"
FontSize="20"
Text="{Binding Description}"
TextWrapping="Wrap" />
</StackPanel>
</Grid>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
</Border>
<!-- 2nd column - Import, url, Open browser + WebView2 -->
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="70" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Border Background="LightGray">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal">
<Button
Margin="15,0,0,0"
Command="{Binding ImportCurrentVideoCommand}"
Content="Import"
ToolTip="Import current video to the video list in the left panel" />
</StackPanel>
<TextBox
Grid.Column="1"
Height="36"
Margin="10,5,10,8"
ui:ControlHelper.PlaceholderText="Start with https://www.youtube.com and hit Enter key to navigate"
FontSize="16"
Foreground="Navy"
Text="{Binding CurrentVideoUrl, UpdateSourceTrigger=PropertyChanged}">
<!-- UpdateSourceTrigger=PropertyChanged needed for KeyBinding to work -->
<TextBox.InputBindings>
<KeyBinding Key="Enter" Command="{Binding GoToVideoUrlCommand}" />
</TextBox.InputBindings>
</TextBox>
<Button
Grid.Column="2"
Margin="5,0,15,0"
Command="{Binding OpenAtYouTubeWebSiteCommand}"
Content="Open with Web Browser"
ToolTip="Open current video with default browser" />
</Grid>
</Border>
<ContentControl Grid.Row="1" Content="{Binding WebView2Control}" />
</Grid>
</Grid>
<Border Grid.Row="2" Background="#662196F3">
<TextBlock
Margin="10,0,0,5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
FontWeight="SemiBold"
Text="{Binding StatusMessage}" />
</Border>
</Grid>
</Window>