-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
222 lines (199 loc) · 10.5 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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<Window x:Class="ZiraceVideoPlayer.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:ZiraceVideoPlayer.Services"
mc:Ignorable="d"
Title="Zirace" Height="764" Width="1358"
KeyDown="Window_KeyDown"
MouseMove="MediaElement_MouseMove"
Background="#111111"
FontFamily="Verdana">
<Window.Resources>
<Color x:Key="Surface-A0">#111111</Color>
<Color x:Key="Surface-A20">#272727</Color>
<!-- Menu Style -->
<Style TargetType="Menu">
<Setter Property="Background" Value="#2C2C2C" />
<Setter Property="Foreground" Value="#ffffff" />
<Setter Property="FontFamily" Value="Segoe UI" />
<Setter Property="FontSize" Value="16" />
</Style>
<!-- MenuItem Style with Child Menu Support -->
<Style TargetType="MenuItem">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="Background" Value="#2C2C2C" />
<Setter Property="Foreground" Value="#ffffff" />
<Setter Property="Padding" Value="10,5" />
<Setter Property="Margin" Value="2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="MenuItem">
<Border Background="{TemplateBinding Background}"
CornerRadius="3"
BorderBrush="#828282"
BorderThickness="0">
<Grid>
<ContentPresenter ContentSource="Header" Margin="5,0" RecognizesAccessKey="True"/>
<Popup x:Name="SubMenuPopup"
Placement="Bottom"
IsOpen="{TemplateBinding IsSubmenuOpen}"
AllowsTransparency="True">
<Border Background="#2C2C2C" CornerRadius="2"
BorderBrush="#404040" BorderThickness="2">
<ItemsPresenter />
</Border>
</Popup>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<!-- Hover Effect -->
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#404040" />
<Setter Property="Foreground" Value="#94D2BD" />
</Trigger>
<Trigger Property="IsHighlighted" Value="True">
<Setter Property="Background" Value="#404040" />
<Setter Property="Foreground" Value="#94D2BD" />
</Trigger>
</Style.Triggers>
</Style>
<!-- Separator Styling -->
<Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="Separator">
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Separator}">
<Border Width="100" Height="2" Margin="4" Background="#828282"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Control Panel Button Styling -->
<Style TargetType="Button">
<Setter Property="Background" Value="#404040" />
<Setter Property="Foreground" Value="#ffffff" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Margin" Value="5" />
<Setter Property="Padding" Value="10,5" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Opacity" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="Transparent"
CornerRadius="10"
BorderThickness="1">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#363b39" />
<Setter Property="Foreground" Value="#94D2BD" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="border" Property="Background" Value="#555555" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.3" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Slider Settings -->
<Style TargetType="Slider">
<Setter Property="Cursor" Value="Hand"/>
</Style>
</Window.Resources>
<!-- All content -->
<DockPanel LastChildFill="True">
<!-- Top Menu -->
<Menu x:Name="TopMenu" DockPanel.Dock="Top" Background="#2C2C2C" Foreground="#ffffff">
<MenuItem Header="_File">
<MenuItem Header="Open Video..." Click="OpenVideo_Click"/>
<Separator/>
<MenuItem Header="Exit" Click="Exit_Click"/>
</MenuItem>
<MenuItem Header="_View">
<MenuItem Header="Fullscreen" ToolTip="Toggle Fullscreen on/Off (f)" Click="ToggleFullscreen_Click"/>
<Separator/>
<MenuItem Header="Minimize" Click="Minimize_Click"/>
</MenuItem>
<MenuItem Header="_Help">
<MenuItem Header="About" Click="About_Click"/>
</MenuItem>
</Menu>
<!-- Main Content Area -->
<Grid>
<Grid.RowDefinitions>
<!-- Media Player takes up all available space -->
<RowDefinition Height="*" />
<!-- Control Panel stays at the bottom -->
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- MediaElement (Video Area) -->
<MediaElement Name="mediaElement"
LoadedBehavior="Manual" UnloadedBehavior="Stop"
Stretch="Uniform" Focusable="False" Grid.RowSpan="2"
MediaEnded="MediaElement_MediaEnded"
MediaOpened="MediaElement_MediaOpened"/>
<!-- Control Panel at the Bottom -->
<StackPanel Grid.Row="1" Name="ControlPanel" Orientation="Vertical"
Background="#AA000000" Height="100" Margin="20,0,20,20"
Opacity="1" MouseEnter="ControlPanel_MouseEnter"
MouseLeave="ControlPanel_MouseLeave" Visibility="Visible">
<!-- Overlay for Duration Slider and Time Labels -->
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"
HorizontalAlignment="Center" Margin="7">
<TextBlock Name="ElapsedTime" Text="00:00" Foreground="#ffffff"
Width="50" VerticalAlignment="Center"
FontSize="16"/>
<Slider Name="DurationSlider" Width="800" Margin="5,0"
Minimum="0" Maximum="100" Value="0"
PreviewMouseDown="DurationSlider_PreviewMouseDown"
PreviewMouseUp="DurationSlider_PreviewMouseUp"
ValueChanged="DurationSlider_ValueChanged"
Focusable="False"/>
<TextBlock Name="RemainingTime" Text="-00:00" Foreground="#ffffff"
Width="60" VerticalAlignment="Center"
FontSize="16"/>
</StackPanel>
<!-- Playback Controls and Volume Slider -->
<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<!-- Spacer -->
<ColumnDefinition Width="Auto" />
<!-- Controls in the Center -->
<ColumnDefinition Width="*" />
<!-- Spacer -->
</Grid.ColumnDefinitions>
<!-- Playback Controls in the Center Column -->
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Center" >
<Button x:Name="btnBack" Content="-10s" Click="OnBack_Click" Width="65" Height="35" Focusable="False"/>
<Button x:Name="btnPlay" Content="▶" Click="OnPlay_Click" Width="65" Height="35" Focusable="False"/>
<Button x:Name="btnPause" Content="❙❙" Click="OnPause_Click" Width="65" Height="35" Focusable="False"/>
<Button x:Name="btnForward" Content="+10s" Click="OnForward_Click" Width="65" Height="35" Focusable="False"/>
</StackPanel>
<!-- Volume Slider on the Right Column -->
<StackPanel Orientation="Horizontal" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right">
<TextBlock Text="🔊" Foreground="#ffffff" Margin="0,0,5,0" VerticalAlignment="Center"/>
<Slider Name="volumeSlider" Width="100" Minimum="0" Maximum="1"
Value="0.5" TickFrequency="0.1"
ValueChanged="volumeSlider_ValueChanged"
Focusable="False"/>
</StackPanel>
</Grid>
</StackPanel>
</Grid>
</DockPanel>
</Window>