Convert things into usercontrols

This commit is contained in:
Royce551 2022-04-06 20:03:14 -05:00
parent 371127f25e
commit 4f31adf17a
8 changed files with 77 additions and 73 deletions

View file

@ -1,4 +1,4 @@
<Window xmlns="https://github.com/avaloniaui"
<UserControl xmlns="https://github.com/avaloniaui"
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"
@ -6,11 +6,11 @@
mc:Ignorable="d" Width="500" Height="400"
xmlns:svg="clr-namespace:Avalonia.Svg.Skia;assembly=Avalonia.Svg.Skia"
xmlns:resx ="clr-namespace:FRESHMusicPlayer.Properties"
x:Class="FRESHMusicPlayer.Views.QueueManagement" Closing="OnClosing" WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
Icon="/Assets/icon.ico" Title="{x:Static resx:Resources.QueueManagement}">
<Window.DataContext>
x:Class="FRESHMusicPlayer.Views.QueueManagement" Closing="OnClosing"
Icon="/Assets/icon.ico">
<UserControl.DataContext>
<vm:QueueManagementViewModel/>
</Window.DataContext>
</UserControl.DataContext>
<Window.Resources>
<svg:SvgImage x:Key="Play" Source="/Assets/play.svg"/>
<svg:SvgImage x:Key="Delete" Source="/Assets/delete.svg"/>
@ -72,4 +72,4 @@
<Button Content="{x:Static resx:Resources.QueueManagement_ClearQueue}" Command="{Binding ClearQueueCommand}" Foreground="Red"/>
</StackPanel>
</Grid>
</Window>
</UserControl>

View file

@ -1,4 +1,4 @@
<Window xmlns="https://github.com/avaloniaui"
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="using:FRESHMusicPlayer.ViewModels"
@ -6,12 +6,12 @@
xmlns:resx ="clr-namespace:FRESHMusicPlayer.Properties"
mc:Ignorable="d"
Width="600" Height="400"
x:Class="FRESHMusicPlayer.Views.Settings" WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
Icon="/Assets/icon.ico" Title="{x:Static resx:Resources.Settings}">
x:Class="FRESHMusicPlayer.Views.Settings"
Icon="/Assets/icon.ico">
<Window.DataContext>
<UserControl.DataContext>
<vm:SettingsViewModel/>
</Window.DataContext>
</UserControl.DataContext>
<TabControl TabStripPlacement="Left" SelectedIndex="0">
<TabItem Header="{x:Static resx:Resources.Settings_General}">
@ -78,4 +78,4 @@
</StackPanel>
</TabItem>
</TabControl>
</Window>
</UserControl>

View file

@ -1,4 +1,4 @@
<Window xmlns="https://github.com/avaloniaui"
<UserControl xmlns="https://github.com/avaloniaui"
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"
@ -6,11 +6,11 @@
xmlns:vm="using:FRESHMusicPlayer.ViewModels"
xmlns:resx ="clr-namespace:FRESHMusicPlayer.Properties"
mc:Ignorable="d" Width="500" Height="300"
x:Class="FRESHMusicPlayer.Views.TrackInfo" WindowStartupLocation="CenterOwner" Closing="OnClosing" ShowInTaskbar="False"
Icon="/Assets/icon.ico" Title="{x:Static resx:Resources.TrackInfo}">
<Window.DataContext>
x:Class="FRESHMusicPlayer.Views.TrackInfo" Closing="OnClosing"
Icon="/Assets/icon.ico">
<UserControl.DataContext>
<vm:TrackInfoViewModel/>
</Window.DataContext>
</UserControl.DataContext>
<Panel>
<controls:BlurryImage ZIndex="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Source="{Binding CoverArt}" BlurLevel="10" Stretch="UniformToFill" Margin="-10"/>
@ -58,4 +58,4 @@
</Grid>
</Panel>
</Window>
</UserControl>

View file

@ -62,7 +62,7 @@
</DockPanel>
<!--Controls Box-->
<Border x:Name="ControlsBoxBorder" BorderThickness="1" Height="84" BorderBrush="{StaticResource ControlBoxColor}" DockPanel.Dock="Bottom" RenderTransformOrigin="0.5,0.5">
<Border x:Name="ControlsBoxBorder" Height="84" BorderBrush="White" BorderThickness="0, 1, 0, 0" DockPanel.Dock="Bottom" RenderTransformOrigin="0.5,0.5">
<Grid x:Name="ControlsBox" DockPanel.Dock="Bottom" Background="{StaticResource ControlBoxColor}" Margin="0,0,0,-2" Drop="ControlsBox_Drop">
<Grid.ColumnDefinitions>
@ -78,8 +78,8 @@
</Image.ToolTip>
</Image>
<TextBlock x:Name="TitleLabel" HorizontalAlignment="Stretch" Margin="5,5,40,0" TextWrapping="NoWrap" Text="{x:Static resx:Resources.MAINWINDOW_NOTHINGPLAYING}" VerticalAlignment="Top" FontWeight="Bold" FontSize="22" Grid.Column="1" Height="30" Foreground="{StaticResource PrimaryTextColor}" TextTrimming="CharacterEllipsis" MouseLeftButtonDown="TrackTitle_MouseLeftButtonDown" MouseRightButtonDown="TrackTitle_MouseRightButtonDown" Cursor="Hand" Grid.ColumnSpan="2" Panel.ZIndex="0"/>
<Slider x:Name="ProgressBar" Grid.Column="1" HorizontalAlignment="Stretch" Margin="37,54,45,0" VerticalAlignment="Top" Height="21" Style="{StaticResource Progress_Slider}" Value="9.8" Thumb.DragStarted="ProgressBar_DragStarted" Thumb.DragCompleted="ProgressBar_DragCompleted" ValueChanged="ProgressBar_ValueChanged" IsMoveToPointEnabled="True" MouseLeftButtonUp="ProgressBar_MouseLeftButtonUp" Cursor="Hand"/>
<TextBlock x:Name="ProgressIndicator1" Grid.Column="1" Margin="5,56,0,0" TextWrapping="NoWrap" Text="10:00" Foreground="{StaticResource SecondaryTextColor}" Height="15" VerticalAlignment="Top" HorizontalAlignment="Left" Width="28"/>
<Slider x:Name="ProgressBar" Grid.Column="1" HorizontalAlignment="Stretch" Margin="50,54,45,0" VerticalAlignment="Top" Height="21" Style="{StaticResource Progress_Slider}" Value="9.8" Thumb.DragStarted="ProgressBar_DragStarted" Thumb.DragCompleted="ProgressBar_DragCompleted" ValueChanged="ProgressBar_ValueChanged" IsMoveToPointEnabled="True" MouseLeftButtonUp="ProgressBar_MouseLeftButtonUp" Cursor="Hand"/>
<TextBlock x:Name="ProgressIndicator1" Grid.Column="1" Margin="5,56,0,0" TextWrapping="NoWrap" Text="10:00" Foreground="{StaticResource SecondaryTextColor}" Height="15" VerticalAlignment="Top" HorizontalAlignment="Left" Width="35"/>
<TextBlock x:Name="ProgressIndicator2" Grid.Column="1" Margin="0,0,0,13" TextWrapping="NoWrap" Text="10:00" Foreground="{StaticResource SecondaryTextColor}" Height="15" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="40" MouseLeftButtonDown="ProgressIndicator2_MouseLeftButtonDown"/>
<TextBlock x:Name="ArtistLabel" HorizontalAlignment="Stretch" Margin="5,35,10,0" TextWrapping="NoWrap" Text="{x:Static resx:Resources.MAINWINDOW_NOTHINGPLAYING}" VerticalAlignment="Top" Grid.Column="1" Height="20" Foreground="{StaticResource SecondaryTextColor}" TextTrimming="CharacterEllipsis"/>
@ -147,7 +147,10 @@
</Slider>
</Grid>
</Border>
<ContentControl x:Name="RightFrame" DockPanel.Dock="Right" Visibility="Collapsed" Width="235"/>
<Border x:Name="RightFrameBorder" BorderBrush="White" BorderThickness="1,0,0,0">
<ContentControl x:Name="RightFrame" />
</Border>
<ContentControl x:Name="ContentFrame"/>

View file

@ -245,9 +245,9 @@ namespace FRESHMusicPlayer
}
if (CurrentPane != Pane.None) await HideAuxilliaryPane(true);
if (!openleft) DockPanel.SetDock(RightFrame, Dock.Right); else DockPanel.SetDock(RightFrame, Dock.Left);
RightFrame.Visibility = Visibility.Visible;
RightFrame.Width = width;
if (!openleft) DockPanel.SetDock(RightFrameBorder, Dock.Right); else DockPanel.SetDock(RightFrameBorder, Dock.Left);
RightFrameBorder.Visibility = Visibility.Visible;
RightFrameBorder.Width = width;
RightFrame.Content = GetPageForPane(pane);
var sb = InterfaceUtils.GetThicknessAnimation(
@ -257,7 +257,7 @@ namespace FRESHMusicPlayer
new PropertyPath(MarginProperty),
new ExponentialEase { EasingMode = EasingMode.EaseOut, Exponent = 3 });
sb.Begin(RightFrame);
sb.Begin(RightFrameBorder);
CurrentPane = pane;
}
@ -265,13 +265,13 @@ namespace FRESHMusicPlayer
{
var sb = InterfaceUtils.GetThicknessAnimation(
new Thickness(0),
DockPanel.GetDock(RightFrame) == Dock.Left ? new Thickness(RightFrame.Width * -1, 0, 0, 0) : new Thickness(0, 0, RightFrame.Width * -1, 0),
DockPanel.GetDock(RightFrameBorder) == Dock.Left ? new Thickness(RightFrameBorder.Width * -1, 0, 0, 0) : new Thickness(0, 0, RightFrameBorder.Width * -1, 0),
TimeSpan.FromMilliseconds(120),
new PropertyPath(MarginProperty),
new ExponentialEase { EasingMode = EasingMode.EaseIn, Exponent = 3 });
if (animate) await sb.BeginStoryboardAsync(RightFrame);
RightFrame.Visibility = Visibility.Collapsed;
if (animate) await sb.BeginStoryboardAsync(RightFrameBorder);
RightFrameBorder.Visibility = Visibility.Collapsed;
RightFrame.Content = null;
CurrentPane = Pane.None;
}

View file

@ -17,13 +17,16 @@
<ColumnDefinition x:Name="LeftSide" Width="222"/>
<ColumnDefinition x:Name="RightSide"/>
</Grid.ColumnDefinitions>
<ListBox x:Name="TracksPanel" Grid.Column="1" Background="{StaticResource BackgroundColor}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HorizontalContentAlignment="Stretch" Padding="0" Margin="0" VirtualizingPanel.IsVirtualizing="True" BorderBrush="{StaticResource BackgroundColor}" ScrollViewer.PanningMode="Both">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Focusable" Value="False"/>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
<Border Grid.Column="1" BorderBrush="White" BorderThickness="1, 0, 0, 1">
<ListBox x:Name="TracksPanel" Grid.Column="1" Background="{StaticResource BackgroundColor}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HorizontalContentAlignment="Stretch" Padding="0" Margin="0" VirtualizingPanel.IsVirtualizing="True" BorderBrush="{StaticResource BackgroundColor}" ScrollViewer.PanningMode="Both">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Focusable" Value="False"/>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</Border>
<GridSplitter
HorizontalAlignment="Right"
VerticalAlignment="Stretch"
@ -35,18 +38,19 @@
/>
<ListBox x:Name="CategoryPanel" Margin="0,0,5,0" Background="{StaticResource SecondaryColor}" Foreground="{StaticResource PrimaryTextColor}" Grid.RowSpan="2" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" FontSize="14" VirtualizingPanel.IsVirtualizing="True" BorderBrush="{x:Null}" SelectionChanged="CategoryPanel_SelectionChanged" BorderThickness="0" ScrollViewer.PanningMode="Both"/>
<Grid x:Name="InfoPanel" Grid.Column="1" Grid.Row="2" Margin="0" Height="45" Background="{StaticResource BackgroundColor}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!--<Grid.RowDefinitions>
<Border BorderBrush="White" BorderThickness="1, 0, 0, 0" Grid.Column="1" Grid.Row="2">
<Grid x:Name="InfoPanel" Grid.Column="1" Grid.Row="2" Margin="0" Height="45" Background="{StaticResource BackgroundColor}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!--<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="45"/>
</Grid.RowDefinitions>-->
<!--<DockPanel Grid.Column="0" Margin="10,5,5,5" LastChildFill="False">
<!--<DockPanel Grid.Column="0" Margin="10,5,5,5" LastChildFill="False">
<TextBlock DockPanel.Dock="Left" Text="Sort" FontSize="14" Foreground="{StaticResource PrimaryTextColor}"/>
<ComboBox DockPanel.Dock="Left" Margin="10,0,0,0" Width="120">
<ComboBoxItem Content="{x:Static resx:Resources.TAGEDITOR_TITLE}"/>
@ -60,11 +64,13 @@
<ComboBoxItem Content="↓"/>
</ComboBox>
</DockPanel>-->
<TextBlock x:Name="InfoLabel" Text="99 Tracks ・ 10:00:00" Grid.Column="0" Foreground="{StaticResource SecondaryTextColor}" Grid.Row="2" FontSize="12" Margin="10" VerticalAlignment="Center"/>
<Button x:Name="QueueAllButton" Content="{x:Static resx:Resources.LIBRARY_ENQUEUEALL}" Grid.Column="1" Grid.Row="2" Margin="10,10,0,10" Padding="5,1" Click="QueueAllButton_Click"/>
<Button x:Name="PlayAllButton" Content="{x:Static resx:Resources.LIBRARY_PLAYALL}" Grid.Column="2" Grid.Row="2" Margin="10" Padding="5,1" Click="PlayAllButton_Click"/>
</Grid>
<TextBlock x:Name="InfoLabel" Text="99 Tracks ・ 10:00:00" Grid.Column="0" Foreground="{StaticResource SecondaryTextColor}" Grid.Row="2" FontSize="12" Margin="10" VerticalAlignment="Center"/>
<Button x:Name="QueueAllButton" Content="{x:Static resx:Resources.LIBRARY_ENQUEUEALL}" Grid.Column="1" Grid.Row="2" Margin="10,10,0,10" Padding="5,1" Click="QueueAllButton_Click"/>
<Button x:Name="PlayAllButton" Content="{x:Static resx:Resources.LIBRARY_PLAYALL}" Grid.Column="2" Grid.Row="2" Margin="10" Padding="5,1" Click="PlayAllButton_Click"/>
</Grid>
</Border>
</Grid>
</UserControl>

View file

@ -3,10 +3,10 @@
xmlns:local="clr-namespace:FRESHMusicPlayer">
<SolidColorBrush x:Key="PrimaryTextColor" Color="White"/>
<SolidColorBrush x:Key="SecondaryTextColor" Color="#DADADA"/>
<SolidColorBrush x:Key="ControlBoxColor" Color="#2C2F33"/>
<SolidColorBrush x:Key="NavBarColor" Color="Black"/>
<SolidColorBrush x:Key="ForegroundColor" Color="#2C2F33"/>
<SolidColorBrush x:Key="SecondaryColor" Color="#323539"/>
<SolidColorBrush x:Key="BackgroundColor" Color="Black"/>
<SolidColorBrush x:Key="ControlColor" Color="#40444A"/>
<SolidColorBrush x:Key="ControlBoxColor" Color="#282828"/>
<SolidColorBrush x:Key="NavBarColor" Color="#282828"/>
<SolidColorBrush x:Key="ForegroundColor" Color="#282828"/>
<SolidColorBrush x:Key="SecondaryColor" Color="#282828"/>
<SolidColorBrush x:Key="BackgroundColor" Color="#282828"/>
<SolidColorBrush x:Key="ControlColor" Color="#282828"/>
</ResourceDictionary>

View file

@ -1,19 +1,22 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Style x:Key="{x:Type TextBlock}" TargetType="{x:Type TextBlock}">
<Setter Property="FontFamily" Value="Contemporary"/>
</Style>
<!--Button-->
<Style x:Key="{x:Type Button}" TargetType="{x:Type Button}">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Background" Value="{StaticResource ControlColor}"/>
<Setter Property="Background" Value="#FF338BC1"/>
<Setter Property="Foreground" Value="{StaticResource PrimaryTextColor}"/>
<Setter Property="Padding" Value="20,1"/>
<Setter Property="Padding" Value="20,5"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid x:Name="grid">
<Border x:Name="border"
CornerRadius="2"
CornerRadius="0"
BorderBrush="{TemplateBinding Background}"
TextElement.Foreground="{TemplateBinding Foreground}"
BorderThickness="1"
@ -203,7 +206,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border Background="{StaticResource SecondaryColor}" Height="3"/>
<Border Background="{StaticResource SecondaryColor}" Height="6"/>
</ControlTemplate>
</Setter.Value>
</Setter>
@ -219,7 +222,7 @@
<Border.Background>
<LinearGradientBrush EndPoint="0,0.5" StartPoint="1,0.5">
<GradientStop Color="#FF338BC1" Offset="0"/>
<GradientStop Color="#FF69B578" Offset="1"/>
<GradientStop Color="#FF338BC1" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
</Border>
@ -234,8 +237,8 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Thumb">
<Ellipse x:Name="ThumbEllipse" Height="10" Width="10" Fill="#FF338BC1">
<Ellipse.Triggers>
<Rectangle x:Name="ThumbEllipse" Height="15" Width="15" Fill="#FF338BC1">
<Rectangle.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
@ -264,8 +267,8 @@
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Ellipse.Triggers>
</Ellipse>
</Rectangle.Triggers>
</Rectangle>
</ControlTemplate>
</Setter.Value>
</Setter>
@ -460,17 +463,9 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBoxBase}">
<Border x:Name="TextBorder" CornerRadius="2" Background="{StaticResource ControlColor}" BorderBrush="{StaticResource ControlColor}" BorderThickness="2">
<Border x:Name="TextBorder" CornerRadius="0" Background="{StaticResource ControlColor}" BorderBrush="White" BorderThickness="1, 0, 0, 1">
<ScrollViewer Margin="0" x:Name="PART_ContentHost" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TextBorder" Property="BorderBrush" Value="#FF338BC1"/>
</Trigger>
<Trigger Property="IsFocused" Value="true">
<Setter TargetName="TextBorder" Property="BorderBrush" Value="#FF338BC1"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>