Ocarina2/Ocarina2/Views/MainWindow.axaml

77 lines
3.9 KiB
XML

<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:Ocarina2.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
xmlns:converter="clr-namespace:Ocarina2.Converter"
xmlns:views="clr-namespace:Ocarina2.Views"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
x:Class="Ocarina2.Views.MainWindow"
Icon="/Assets/icon.ico"
Title="{Binding AppName}">
<!--
OCARINA2 Open-source music player and library manager
Copyright (C) 2023 Matyáš Caras
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<Window.Resources>
<converter:SongMetadataConverter x:Key="SongMeta"/>
<converter:AlbumArtConverter x:Key="AlbumArt"/>
</Window.Resources>
<Design.DataContext>
<!-- This only sets the DataContext for the previewer in an IDE,
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
<vm:MainWindowViewModel />
</Design.DataContext>
<Grid RowDefinitions="33,*,50" ColumnDefinitions="0.25*,*">
<DockPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
<Menu DockPanel.Dock="Top">
<MenuItem Header="{Binding MenuOpen}">
<MenuItem Header="{Binding MenuFile}" />
<Separator />
<MenuItem Header="{Binding MenuExit}" />
</MenuItem>
</Menu>
</DockPanel>
<Grid Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" RowDefinitions="*,2*" Margin="0">
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<materialIcons:MaterialIcon Kind="Music" /><TextBlock Text="{Binding Music}" Margin="5,0,0,0" />
</StackPanel>
</StackPanel>
</Grid>
<views:LibraryView Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" x:Name="LibraryView" />
<!-- Song info -->
<StackPanel Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom">
<Image Source="{Binding SelectedFile.Metadata.Tag.Pictures, FallbackValue={materialIcons:MaterialIconExt Kind=Music} , Converter={StaticResource AlbumArt}}"/>
<TextBlock Text="{Binding SelectedFile, Converter={StaticResource SongMeta}, ConverterParameter=1}" FontWeight="Bold"/>
<TextBlock Text="{Binding SelectedFile, Converter={StaticResource SongMeta}, ConverterParameter=2}" />
</StackPanel>
<!-- Playback Controls -->
<StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="0">
<Button Content="{materialIcons:MaterialIconExt Kind=PlayPause}" Padding="5" Margin="5,0,0,0" Command="{Binding StopMusic}" />
<Button Content="{materialIcons:MaterialIconExt Kind=Stop}" Padding="5" Margin="5,0,0,0" Command="{Binding StopMusic}" />
</StackPanel>
</Grid>
</Window>