-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
256 lines (256 loc) · 16.7 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
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
<Window x:Class="Orpheus.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"
mc:Ignorable="d"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:fa="http://schemas.fontawesome.io/icons/"
ui:WindowHelper.UseModernWindowStyle="True"
Title="{Binding Title}"
Width="1280"
Height="720" WindowStartupLocation="CenterScreen">
<Window.InputBindings>
<KeyBinding Modifiers="Ctrl" Key="F" Command="{Binding AddFileCommand}"/>
<KeyBinding Modifiers="Ctrl" Key="D" Command="{Binding AddFolderCommand}"/>
<KeyBinding Modifiers="Ctrl" Key="S" Command="{Binding ScanLibraryCommand}"/>
<KeyBinding Modifiers="Ctrl" Key="I" Command="{Binding PruneInvalidSongsCommand}"/>
<KeyBinding Modifiers="Ctrl" Key="T" Command="{Binding SelectThemeCommand}"/>
<KeyBinding Modifiers="Ctrl" Key="W" Command="{Binding ExitApplicationCommand}"/>
</Window.InputBindings>
<DockPanel LastChildFill="True">
<DockPanel.Resources>
<Style TargetType="{x:Type DockPanel}">
<Setter Property="Background" Value="{Binding Background}"/>
<Style.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="{Binding Foreground}"/>
</Style>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Foreground" Value="{Binding Foreground}"/>
</Style>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Foreground" Value="{Binding Foreground}"/>
</Style>
</Style.Resources>
</Style>
</DockPanel.Resources>
<Menu DockPanel.Dock="Top" Foreground="{Binding Foreground}">
<MenuItem Header="File" Foreground="{Binding Foreground}">
<MenuItem Header="Add File" Command="{Binding AddFileCommand}" InputGestureText="Ctrl+F"/>
<MenuItem Header="Add Folder" Command="{Binding AddFolderCommand}" InputGestureText="Ctrl+D"/>
<Separator />
<MenuItem Header="Scan Library" Command="{Binding ScanLibraryCommand}" InputGestureText="Ctrl+S"/>
<MenuItem Header="Prune Invalid Songs" Command="{Binding PruneInvalidSongsCommand}" InputGestureText="Ctrl+I"/>
<Separator />
<MenuItem Header="Select Theme" Command="{Binding SelectThemeCommand}" InputGestureText="Ctrl+T"/>
<Separator />
<MenuItem Header="Exit" Command="{Binding ExitApplicationCommand}" InputGestureText="Ctrl+W"/>
</MenuItem>
</Menu>
<Grid DockPanel.Dock="Bottom" Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Width="32" Height="32" Command="{Binding RewindToStartCommand}">
<fa:ImageAwesome Icon="StepBackward" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
<Button Grid.Column="1" Width="32" Height="32" Command="{Binding RewindCommand}">
<fa:ImageAwesome Icon="Backward" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
<Button Grid.Column="2" Width="32" Height="32" Command="{Binding StartPlaybackCommand}">
<fa:ImageAwesome Icon="{Binding PlayPauseImageSource}" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
<Button Grid.Column="3" Width="32" Height="32" Command="{Binding StopPlaybackCommand}">
<fa:ImageAwesome Icon="Stop" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
<Button Grid.Column="4" Width="32" Height="32" Command="{Binding FastForwardCommand}">
<fa:ImageAwesome Icon="Forward" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
<Button Grid.Column="5" Width="32" Height="32" Command="{Binding ForwardToEndCommand}">
<fa:ImageAwesome Icon="StepForward" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
<Button Grid.Column="7" Width="32" Height="32" Command="{Binding ShuffleCommand}">
<fa:ImageAwesome Icon="Random" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>
</Grid>
<Grid DockPanel.Dock="Bottom" Margin="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="20"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Slider Grid.Column="0" Minimum="0" Maximum="{Binding CurrentTrackLength, Mode=OneWay}" Value="{Binding CurrentTrackPosition, Mode=TwoWay}" x:Name="SeekbarControl" VerticalAlignment="Center">
<Slider.Resources>
<SolidColorBrush x:Key="SliderSelectionBackground" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderSelectionBorder" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBackground" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBackgroundDisabled" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBackgroundDragging" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBackgroundHover" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBorder" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBorderDisabled" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBorderDragging" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBorderHover" Color="{Binding Foreground}" />
</Slider.Resources>
<i:Interaction.Triggers>
<i:EventTrigger EventName="PreviewMouseDown">
<i:InvokeCommandAction Command="{Binding TrackControlMouseDownCommand}"></i:InvokeCommandAction>
</i:EventTrigger>
<i:EventTrigger EventName="PreviewMouseUp">
<i:InvokeCommandAction Command="{Binding TrackControlMouseUpCommand}"></i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</Slider>
<Slider Grid.Column="3" Minimum="0" Maximum="1" Value="{Binding CurrentVolume, Mode=TwoWay}" x:Name="VolumeControl" VerticalAlignment="Center">
<Slider.Resources>
<SolidColorBrush x:Key="SliderSelectionBackground" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderSelectionBorder" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBackground" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBackgroundDisabled" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBackgroundDragging" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBackgroundHover" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBorder" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBorderDisabled" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBorderDragging" Color="{Binding Foreground}" />
<SolidColorBrush x:Key="SliderThumbBorderHover" Color="{Binding Foreground}" />
</Slider.Resources>
<i:Interaction.Triggers>
<i:EventTrigger EventName="ValueChanged">
<i:InvokeCommandAction Command="{Binding VolumeControlValueChangedCommand}"></i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</Slider>
</Grid>
<Grid DockPanel.Dock="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Now Playing: "></TextBlock>
<TextBlock Grid.Column="1" Text="{Binding CurrentlyPlayingTrack.title, Mode=OneWay}"/>
</Grid>
<ScrollViewer VerticalScrollBarVisibility="Hidden" HorizontalScrollBarVisibility="Disabled" Height="Auto">
<ListView HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Name="Playlist"
ItemsSource="{Binding Playlist}"
SelectedItem="{Binding CurrentlySelectedTrack, Mode=TwoWay}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding RowDoubleClickCommand}" PassEventArgsToCommand="True"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<ListView.ContextMenu>
<ContextMenu>
<MenuItem Header="Remove Song" Command="{Binding RemoveSongCommand}" />
<MenuItem Header="Remap Song" Command="{Binding RemapSongCommand}" />
</ContextMenu>
</ListView.ContextMenu>
<ListView.View>
<GridView>
<GridView.ColumnHeaderContainerStyle>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Background" Value="{Binding Background}"></Setter>
<Setter Property="Foreground" Value="{Binding Foreground}"></Setter>
<Setter Property="BorderBrush" Value="{x:Null}"></Setter>
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="Margin" Value="0"></Setter>
<Setter Property="Padding" Value="0"></Setter>
</Style>
</GridView.ColumnHeaderContainerStyle>
<GridViewColumn Width="494" Header="Title">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding Path=title, Mode=OneWay}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Black"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=error, Mode=OneWay}" Value="File not found">
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Artist" Width="256">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding Path=artist, Mode=OneWay}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Black"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=error, Mode=OneWay}" Value="File not found">
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Album" Width="384">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding Path=album, Mode=OneWay}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Black"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=error, Mode=OneWay}" Value="File not found">
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Track" Width="128">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<TextBlock Text="{Binding Path=track, Mode=OneWay}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="Black"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=error, Mode=OneWay}" Value="File not found">
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
</ScrollViewer>
</DockPanel>
</Window>