Page navigation

This commit is contained in:
Royce551 2022-04-07 21:09:32 -05:00
parent 0d3c809129
commit 3cf31b0427
9 changed files with 34 additions and 40 deletions

View file

@ -372,7 +372,7 @@ namespace FRESHMusicPlayer.ViewModels
{
Content = new TextBlock
{
Text = "Tracks"
Text = "Tracks Tab"
}
};
case Tab.Artists:
@ -380,7 +380,7 @@ namespace FRESHMusicPlayer.ViewModels
{
Content = new TextBlock
{
Text = "Artists"
Text = "Artists Tab"
}
};
case Tab.Albums:
@ -388,7 +388,7 @@ namespace FRESHMusicPlayer.ViewModels
{
Content = new TextBlock
{
Text = "Albums"
Text = "Albums Tab"
}
};
case Tab.Playlists:
@ -396,7 +396,7 @@ namespace FRESHMusicPlayer.ViewModels
{
Content = new TextBlock
{
Text = "Playlists"
Text = "Playlists Tab"
}
};
case Tab.Fullscreen:
@ -404,7 +404,7 @@ namespace FRESHMusicPlayer.ViewModels
{
Content = new TextBlock
{
Text = "Fullscreen"
Text = "Fullscreen Page"
}
};
default:
@ -419,9 +419,9 @@ namespace FRESHMusicPlayer.ViewModels
switch (SelectedPane)
{
case Pane.Settings:
return new Views.Settings();
return new Views.Settings().SetThings(Program.Config, Library);
case Pane.QueueManagement:
return new Views.QueueManagement();
return new Views.QueueManagement().SetStuff(Player, Library, ProgressTimer);
case Pane.Search:
return new UserControl
{
@ -431,7 +431,7 @@ namespace FRESHMusicPlayer.ViewModels
}
};
case Pane.TrackInfo:
return new TrackInfo();
return new TrackInfo().SetStuff(Player);
case Pane.Notifications:
return new UserControl
{
@ -456,7 +456,7 @@ namespace FRESHMusicPlayer.ViewModels
}
}
private int auxPaneWidth = 220;
private int auxPaneWidth = 320;
public int AuxPaneWidth
{
get => auxPaneWidth;

View file

@ -5,9 +5,8 @@
xmlns:controls="clr-namespace:FRESHMusicPlayer.Controls.BlurryImage"
xmlns:vm="using:FRESHMusicPlayer.ViewModels"
xmlns:resx ="clr-namespace:FRESHMusicPlayer.Properties"
mc:Ignorable="d" Width="500" Height="300" Icon="/Assets/icon.ico"
x:Class="FRESHMusicPlayer.Views.Lyrics"
Title="{x:Static resx:Resources.Lyrics}">
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="300"
x:Class="FRESHMusicPlayer.Views.Lyrics">
<UserControl.DataContext>
<vm:LyricsViewModel/>
</UserControl.DataContext>
@ -21,7 +20,6 @@
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<CheckBox Grid.ColumnSpan="3" IsChecked="{Binding $parent[Window].Topmost}" Content="{x:Static resx:Resources.PinToTop}"/>
<ScrollViewer Grid.Row="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
<TextBlock Text="{Binding Text}" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"/>
</ScrollViewer>

View file

@ -1,19 +1,18 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.LogicalTree;
using Avalonia.Markup.Xaml;
using FRESHMusicPlayer.ViewModels;
using System.ComponentModel;
namespace FRESHMusicPlayer.Views
{
public partial class Lyrics : Window
public partial class Lyrics : UserControl
{
public Lyrics()
{
InitializeComponent();
#if DEBUG
this.AttachDevTools();
#endif
DetachedFromLogicalTree += OnClosing;
}
public Lyrics SetStuff(MainWindowViewModel mainWindow)
@ -24,7 +23,7 @@ namespace FRESHMusicPlayer.Views
return this;
}
private void OnClosing(object sender, CancelEventArgs e)
private void OnClosing(object sender, LogicalTreeAttachmentEventArgs e)
{
(DataContext as LyricsViewModel)?.Deinitialize();
}

View file

@ -186,7 +186,7 @@
</Grid>
</Grid>
<DockPanel DockPanel.Dock="Top" Height="30" Background="Blue" LastChildFill="False">
<DockPanel DockPanel.Dock="Top" Height="30" LastChildFill="False">
<TextBlock Text="Tracks" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="10,0,10,0"/>
<TextBlock Text="Artists" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="0,0,10,0"/>
<TextBlock Text="Albums" DockPanel.Dock="Left" VerticalAlignment="Center" Margin="0,0,10,0"/>
@ -208,10 +208,10 @@
</DockPanel>
<ContentControl DockPanel.Dock="Right" Background="Green" Content="{Binding AuxPaneContent}" Width="{Binding AuxPaneWidth}">
<ContentControl DockPanel.Dock="Right" Background="{DynamicResource SecondaryColor}" Content="{Binding AuxPaneContent}" Width="{Binding AuxPaneWidth}">
</ContentControl>
<ContentControl Background="Red" Content="{Binding MainContent}">
<ContentControl Content="{Binding MainContent}">
</ContentControl>

View file

@ -3,23 +3,22 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="using:FRESHMusicPlayer.ViewModels"
mc:Ignorable="d" Width="500" Height="400"
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="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"
Icon="/Assets/icon.ico">
x:Class="FRESHMusicPlayer.Views.QueueManagement">
<UserControl.DataContext>
<vm:QueueManagementViewModel/>
</UserControl.DataContext>
<Window.Resources>
<UserControl.Resources>
<svg:SvgImage x:Key="Play" Source="/Assets/play.svg"/>
<svg:SvgImage x:Key="Delete" Source="/Assets/delete.svg"/>
</Window.Resources>
<Window.Styles>
</UserControl.Resources>
<UserControl.Styles>
<Style Selector="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
</Style>
</Window.Styles>
</UserControl.Styles>
<Grid>
<Grid.RowDefinitions>
@ -28,7 +27,6 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<DockPanel Grid.Column="0" Grid.Row="0" Margin="5,5,5,0">
<CheckBox DockPanel.Dock="Left" IsChecked="{Binding $parent[Window].Topmost}" Content="{x:Static resx:Resources.PinToTop}"/>
<TextBlock DockPanel.Dock="Right" Text="{Binding TimeRemaining, StringFormat=\{0:hh\\:mm\\:ss\}}" Margin="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Right"/>
<TextBlock DockPanel.Dock="Right" Text="{x:Static resx:Resources.QueueManagement_TimeRemaining}" VerticalAlignment="Center" HorizontalAlignment="Right"/>
</DockPanel>

View file

@ -1,6 +1,7 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.LogicalTree;
using Avalonia.Markup.Xaml;
using FRESHMusicPlayer.Handlers;
using FRESHMusicPlayer.ViewModels;
@ -16,6 +17,7 @@ namespace FRESHMusicPlayer.Views
public QueueManagement()
{
InitializeComponent();
DetachedFromLogicalTree += OnClosing;
}
private void InitializeComponent()
@ -50,8 +52,7 @@ namespace FRESHMusicPlayer.Views
ViewModel?.RemoveCommand(x.Position);
}
}
private void OnClosing(object sender, CancelEventArgs e)
private void OnClosing(object sender, LogicalTreeAttachmentEventArgs e)
{
ViewModel?.CloseThings();
}

View file

@ -5,9 +5,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx ="clr-namespace:FRESHMusicPlayer.Properties"
mc:Ignorable="d"
Width="600" Height="400"
x:Class="FRESHMusicPlayer.Views.Settings"
Icon="/Assets/icon.ico">
d:DesignWidth="600" d:DesignHeight="400"
x:Class="FRESHMusicPlayer.Views.Settings">
<UserControl.DataContext>
<vm:SettingsViewModel/>

View file

@ -5,9 +5,8 @@
xmlns:controls="clr-namespace:FRESHMusicPlayer.Controls.BlurryImage"
xmlns:vm="using:FRESHMusicPlayer.ViewModels"
xmlns:resx ="clr-namespace:FRESHMusicPlayer.Properties"
mc:Ignorable="d" Width="500" Height="300"
x:Class="FRESHMusicPlayer.Views.TrackInfo" Closing="OnClosing"
Icon="/Assets/icon.ico">
mc:Ignorable="d" d:DesignWidth="500" d:DesignHeight="300"
x:Class="FRESHMusicPlayer.Views.TrackInfo">
<UserControl.DataContext>
<vm:TrackInfoViewModel/>
</UserControl.DataContext>
@ -25,8 +24,6 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<CheckBox Grid.ColumnSpan="3" IsChecked="{Binding $parent[Window].Topmost}" Content="{x:Static resx:Resources.PinToTop}"/>
<Image Grid.Row="1" Grid.Column="0" Source="{Binding CoverArt}" HorizontalAlignment="Right">
</Image>

View file

@ -1,5 +1,6 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.LogicalTree;
using Avalonia.Markup.Xaml;
using FRESHMusicPlayer.ViewModels;
using System.ComponentModel;
@ -13,6 +14,7 @@ namespace FRESHMusicPlayer.Views
public TrackInfo()
{
InitializeComponent();
DetachedFromLogicalTree += OnClosing;
}
private void InitializeComponent()
@ -27,7 +29,7 @@ namespace FRESHMusicPlayer.Views
return this;
}
private void OnClosing(object sender, CancelEventArgs e)
private void OnClosing(object sender, LogicalTreeAttachmentEventArgs e)
{
ViewModel?.CloseThings();
}