MainPage.xaml
17.6 KB
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
<UserControl
x:Class="SilverlightMediaElement.MainPage"
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:vsm="clr-namespace:System.Windows;assembly=System.Windows"
mc:Ignorable="d"
Width="640" Height="360">
<UserControl.Resources>
<Style x:Key="roundThumbStyle" TargetType="Thumb">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Ellipse Stroke="#FFFFFFFF" StrokeThickness="2" Fill="#FF484848"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SliderStyle" TargetType="Slider">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Slider">
<Grid x:Name="Root" Background="Transparent">
<Grid.Resources>
<ControlTemplate x:Key="RightRepeatButtonTemplate">
<Rectangle Height="8" Margin="-5,0,0,0" Grid.Column="0" Grid.ColumnSpan="3"
StrokeThickness="0.5" RadiusY="1" RadiusX="1" Fill="#FF484848"/>
</ControlTemplate>
<ControlTemplate x:Key="LeftRepeatButtonTemplate">
<Rectangle Height="8" Margin="0,0,-5,0" Grid.Column="0" Grid.ColumnSpan="3"
StrokeThickness="0.5" RadiusY="1" RadiusX="1" Fill="#FFAFAFAF"/>
</ControlTemplate>
</Grid.Resources>
<Grid x:Name="HorizontalTemplate">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Grid.Column="0"
IsTabStop="False" Template="{StaticResource LeftRepeatButtonTemplate}"/>
<Rectangle x:Name="LeftTrack" Grid.Row="1" Fill="#00FFFFFF" Cursor="Hand" MouseLeftButtonDown="LeftTrack_MouseLeftButtonDown"/>
<Thumb Background="#00FFFFFF" Height="10" x:Name="HorizontalThumb" Width="10"
Grid.Column="1" Style="{StaticResource roundThumbStyle}" HorizontalAlignment="Left"
DragStarted="HorizontalThumb_DragStarted" DragCompleted="HorizontalThumb_DragCompleted"
Canvas.ZIndex="1"/>
<RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Grid.Column="2"
IsTabStop="False" Template="{StaticResource RightRepeatButtonTemplate}"/>
<Rectangle x:Name="RightTrack" Grid.Column="2" Grid.Row="1" Fill="#00FFFFFF" Cursor="Hand" MouseLeftButtonDown="LeftTrack_MouseLeftButtonDown"/>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<ControlTemplate x:Key="PlayButtonTemplate" TargetType="ToggleButton">
<Grid x:Name="grid" Background="Transparent">
<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="FocusStates">
<vsm:VisualState x:Name="Focused">
<Storyboard>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Unfocused">
<Storyboard/>
</vsm:VisualState>
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="CommonStates">
<vsm:VisualState x:Name="Normal">
<Storyboard/>
</vsm:VisualState>
<vsm:VisualState x:Name="MouseOver">
<Storyboard>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Pressed">
<Storyboard/>
</vsm:VisualState>
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="CheckStates">
<vsm:VisualState x:Name="Checked">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000"
Storyboard.TargetName="playSymbol"
Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000"
Storyboard.TargetName="pauseSymbol"
Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Unchecked">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="pauseSymbol" Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>
<Grid Margin="11,3,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"
Opacity="1" x:Name="playSymbol" Width="21" Height="22">
<Path Width="14" Height="15" Stretch="Fill" Fill="#FF7F7F7F"
Data="F1 M 15.1997,22.542L 29.7776,14.89L 15.2707,6.99886L 15.1997,22.542 Z "/>
</Grid>
<Grid Margin="11,2,0,0" Opacity="0" x:Name="pauseSymbol" Width="31" Height="15">
<Rectangle Stretch="Fill" Fill="#FF7F7F7F" HorizontalAlignment="Left"
Margin="0,0,0,0" Width="6"/>
<Rectangle Stretch="Fill" Fill="#FF7F7F7F" HorizontalAlignment="Stretch"
Margin="6,0,13,0" Width="6"/>
</Grid>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="MuteButtonTemplate" TargetType="ToggleButton">
<Grid Background="Transparent" Cursor="Hand">
<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="FocusStates">
<vsm:VisualState x:Name="Focused">
<Storyboard>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Unfocused">
<Storyboard/>
</vsm:VisualState>
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="CommonStates">
<vsm:VisualState x:Name="Normal">
<Storyboard/>
</vsm:VisualState>
<vsm:VisualState x:Name="MouseOver">
<Storyboard>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Pressed">
<Storyboard/>
</vsm:VisualState>
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="CheckStates">
<vsm:VisualState x:Name="Checked">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000"
Storyboard.TargetName="volumeSymbol"
Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Unchecked">
<Storyboard>
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000"
Storyboard.TargetName="volumeSymbol"
Storyboard.TargetProperty="(UIElement.Opacity)">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>
<Grid HorizontalAlignment="Left" VerticalAlignment="Top"
Width="17">
<Path HorizontalAlignment="Left" Stretch="Fill"
Fill="#FF7F7F7F" Data="F1 M 23.1457,26.5056L 23.1457,33.8944L 25.7913,33.8944L 28.8235,37.4722L 30.5346,37.4722L 30.5665,23.0833L 28.8995,23.0833L 25.8679,26.5056L 23.1457,26.5056 Z "
Width="7.421" Height="14.389" UseLayoutRounding="False"
Margin="0,6.5,0,6.5"/>
<Grid HorizontalAlignment="Right" Width="7.003" x:Name="volumeSymbol" Margin="0,10">
<Path HorizontalAlignment="Right" VerticalAlignment="Stretch"
Width="2.398"
Data="M0.5,0.5 C0.5,0.5 2.5939558,2.7128265 2.5946648,7.0504856 C2.5953746,11.391507 0.50033337,13.889001 0.50033337,13.889001"
Stretch="Fill" Stroke="#FF7F7F7F" Margin="0,0,-0.398,0" UseLayoutRounding="False"/>
<Path HorizontalAlignment="Stretch" Margin="2.4,2.384,2.317,1.584" VerticalAlignment="Stretch"
Data="M0.5,0.50000006 C0.5,0.50000006 1.4786903,2.1275051 1.4781417,4.9569001 C1.4776551,7.4670725 0.35717732,9.892808 0.35717732,9.892808" Stretch="Fill" Stroke="#FF7F7F7F" UseLayoutRounding="False"/>
<Path HorizontalAlignment="Left" Margin="0,4.36,0,3.46" VerticalAlignment="Stretch" Width="1.542"
Data="M0.5,0.5 C0.5,0.5 1.0412779,1.4903735 1.042276,3.1459465 C1.0429831,4.3189368 0.66544437,6.0685911 0.66544437,6.0685911" Stretch="Fill" Stroke="#FF7F7F7F" d:LayoutOverrides="Width"/>
</Grid>
</Grid>
</Grid>
</ControlTemplate>
<ControlTemplate x:Key="ButtonTemplate" TargetType="Button">
<Grid Background="Transparent">
<ContentPresenter Width="Auto"/>
</Grid>
</ControlTemplate>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="Black" Width="640" Height="360">
<MediaElement Grid.Row="0" Grid.Column="0" Width="640" Height="360"
CacheMode="BitmapCache" AutoPlay="false" Name="media">
</MediaElement>
<Button x:Name="bigPlayButton" Template="{StaticResource ButtonTemplate}"
Click="BigPlayButton_Click" Grid.Row="0" Visibility="Collapsed">
<Canvas Width="100" Height="100">
<Path Width="100" Height="100" Canvas.Left="0" Canvas.Top="0" Stretch="Fill"
Fill="#77000000" Data="F1 M 15,0L 85,0C 93.2843,0 100,6.71573 100,15L 100,85C 100,93.2843 93.2843,100 85,100L 15,100C 6.71573,100 0,93.2843 0,85L 0,15C 0,6.71573 6.71573,0 15,0 Z "/>
<Path Width="40.8182" Height="47.1328" Canvas.Left="34.6439"
Canvas.Top="27.6003" Stretch="Fill" Fill="#FFFFFFFF"
Data="F1 M 75.4621,51.1667L 34.6439,27.6003L 34.6439,74.7331L 75.4621,51.1667 Z "/>
</Canvas>
</Button>
<TextBox Margin="25,25,0,0" Name="textBox1" VerticalScrollBarVisibility="Auto" Height="146" VerticalAlignment="Top" HorizontalAlignment="Left" Width="235" />
<Button Content="" Height="36" HorizontalAlignment="Right" x:Name="FullscreenButton" VerticalAlignment="Bottom" Width="31" Click="FullscreenButton_Click" Opacity="0" Background="#00000000" Cursor="Hand" />
<Grid x:Name="transportControls" VerticalAlignment="Bottom" Height="40" Background="#FF000000"
Grid.Row="1" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" MinWidth="10" />
<ColumnDefinition Width="Auto" MinWidth="10" />
</Grid.ColumnDefinitions>
<!-- play symbol showing is checked = false, Pause symbol showing is checked = true-->
<ToggleButton x:Name="playPauseButton" Template="{StaticResource PlayButtonTemplate}"
Click="PlayPauseButton_Click" IsChecked="false" Cursor="Hand"/>
<Grid x:Name="time" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="10" />
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>
<TextBlock x:Name="currentTimeTextBlock" Margin="0,1.5,10,0" Height="12"
FontFamily="Verdana" FontSize="10" Text="00:00" TextWrapping="Wrap"
Foreground="#FFFFFFFF" FontStyle="Normal" HorizontalAlignment="Right"
TextAlignment="Right" Grid.Column="0"/>
<Slider x:Name="timelineSlider" Margin="0,2,0,-1"
Maximum="1" Style="{StaticResource SliderStyle}" Grid.Column="1"
ValueChanged="TimelineSlider_ValueChanged"
Value="0"/>
<TextBlock Margin="0,1.5,0,0" Height="12" FontFamily="Verdana" FontSize="10"
Text="" TextWrapping="Wrap" Foreground="#FFFFFFFF"
FontStyle="Normal" HorizontalAlignment="Center" TextAlignment="Right"
Grid.Column="2"/>
<TextBlock x:Name="totalTimeTextBlock" Margin="0,1.5,0,0" Height="12"
FontFamily="Verdana" FontSize="10" Text="00:00" TextWrapping="Wrap"
Foreground="#FFFFFFFF" FontStyle="Normal" HorizontalAlignment="Left"
TextAlignment="Right" Grid.Column="3"/>
</Grid>
<ToggleButton IsChecked="false" Grid.Column="3" x:Name="muteButton"
Template="{StaticResource MuteButtonTemplate}" Click="MuteButton_Click"
VerticalAlignment="Center" Margin="0,0,6,0" Cursor="Hand"/>
<Slider Grid.Column="4" HorizontalAlignment="Stretch" Margin="3,0,0,0"
VerticalAlignment="Center" Maximum="1" x:Name="volumeSlider"
Background="#FF777777" Style="{StaticResource SliderStyle}" Width="50"
Value="{Binding ElementName=media, Mode=TwoWay, Path=Volume, UpdateSourceTrigger=Default}"/>
<Button x:Name="fullScreenButton" Grid.Column="5" Margin="8,10,4,10" Click="FullScreenButton_Click"
Template="{StaticResource ButtonTemplate}" VerticalAlignment="Center" Cursor="Hand">
<Path Height="14.375" HorizontalAlignment="Stretch"
VerticalAlignment="Bottom" RenderTransformOrigin="0.212389379739761,0.208695650100708"
Data="M10.181361,8.375 L12.844413,11.008244 L14.125,9.7418737 L14.125,14.375 L9.675765,14.374833 L10.906104,13.158273 L8.125,10.408315 L10.181361,8.375 z M3.9666855,8.375 L6,10.431361 L3.3667567,13.094413 L4.6331258,14.375 L0,14.375 L0.00016707927,9.925765 L1.2167276,11.156104 L3.9666855,8.375 z M9.4918737,0 L14.125,0 L14.124833,4.449235 L12.908273,3.2188957 L10.158315,6 L8.125,3.943639 L10.758244,1.2805867 L9.4918737,0 z M0,0 L4.449235,0.00016686507 L3.2188957,1.2167276 L6,3.9666855 L3.943639,6 L1.280587,3.3667567 L0,4.6331258 L0,0 z"
Fill="#FF7F7F7F" Stretch="Fill" Stroke="#FF000000" StrokeThickness="0" />
</Button>
</Grid>
</Grid>
</UserControl>