mirror of
https://github.com/Royce551/FRESHMusicPlayer.git
synced 2025-01-22 19:02:19 -05:00
make aux panes a little less messy
This commit is contained in:
parent
977ffc64e1
commit
80e4ef49f4
3 changed files with 76 additions and 53 deletions
|
@ -24,6 +24,6 @@ namespace FRESHMusicPlayer.Handlers.Configuration
|
||||||
public DateTime UpdatesLastChecked { get; set; }
|
public DateTime UpdatesLastChecked { get; set; }
|
||||||
public Skin Theme { get; set; } = Skin.Dark;
|
public Skin Theme { get; set; } = Skin.Dark;
|
||||||
public int Volume { get; set; } = 100;
|
public int Volume { get; set; } = 100;
|
||||||
public SelectedMenus CurrentMenu { get; set; } = SelectedMenus.Import;
|
public SelectedMenu CurrentMenu { get; set; } = SelectedMenu.Import;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ using Winforms = System.Windows.Forms;
|
||||||
|
|
||||||
namespace FRESHMusicPlayer
|
namespace FRESHMusicPlayer
|
||||||
{
|
{
|
||||||
public enum SelectedMenus
|
public enum SelectedMenu
|
||||||
{
|
{
|
||||||
Tracks,
|
Tracks,
|
||||||
Artists,
|
Artists,
|
||||||
|
@ -33,18 +33,27 @@ namespace FRESHMusicPlayer
|
||||||
Import,
|
Import,
|
||||||
Other
|
Other
|
||||||
}
|
}
|
||||||
|
public enum SelectedAuxiliaryPane
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Settings,
|
||||||
|
QueueManagement,
|
||||||
|
Search,
|
||||||
|
Notifications,
|
||||||
|
TrackInfo
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for MainWindow.xaml
|
/// Interaction logic for MainWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
Winforms.Timer progressTimer;
|
Winforms.Timer progressTimer;
|
||||||
public static SelectedMenus SelectedMenu = SelectedMenus.Tracks;
|
public static SelectedMenu SelectedMenu = SelectedMenu.Tracks;
|
||||||
|
public static SelectedAuxiliaryPane SelectedAuxiliaryPane = SelectedAuxiliaryPane.None;
|
||||||
public static Player Player = new Player { CurrentVolume = App.Config.Volume};
|
public static Player Player = new Player { CurrentVolume = App.Config.Volume};
|
||||||
public static NotificationHandler NotificationHandler = new NotificationHandler();
|
public static NotificationHandler NotificationHandler = new NotificationHandler();
|
||||||
public static bool MiniPlayerMode = false;
|
public static bool MiniPlayerMode = false;
|
||||||
public static bool AuxilliaryPaneIsOpen = false;
|
public static bool AuxilliaryPaneIsOpen = false;
|
||||||
public static string AuxilliaryPaneUri = "";
|
|
||||||
public static EventHandler TabChanged;
|
public static EventHandler TabChanged;
|
||||||
public static LiteDatabase Libraryv2;
|
public static LiteDatabase Libraryv2;
|
||||||
public static Track CurrentTrack;
|
public static Track CurrentTrack;
|
||||||
|
@ -65,7 +74,7 @@ namespace FRESHMusicPlayer
|
||||||
progressTimer.Tick += ProgressTimer_Tick;
|
progressTimer.Tick += ProgressTimer_Tick;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Libraryv2 = new LiteDatabase(System.IO.Path.Combine(DatabaseHandler.DatabasePath, "database.fdb2"));
|
Libraryv2 = new LiteDatabase(Path.Combine(DatabaseHandler.DatabasePath, "database.fdb2"));
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -90,7 +99,7 @@ namespace FRESHMusicPlayer
|
||||||
DisplayAsToast = true,
|
DisplayAsToast = true,
|
||||||
Type = NotificationType.Failure
|
Type = NotificationType.Failure
|
||||||
});
|
});
|
||||||
App.Config.CurrentMenu = SelectedMenus.Import;
|
App.Config.CurrentMenu = SelectedMenu.Import;
|
||||||
TracksTab.Visibility = ArtistsTab.Visibility = AlbumsTab.Visibility = PlaylistsTab.Visibility = Visibility.Collapsed;
|
TracksTab.Visibility = ArtistsTab.Visibility = AlbumsTab.Visibility = PlaylistsTab.Visibility = Visibility.Collapsed;
|
||||||
SearchButton.Visibility = QueueManagementButton.Visibility = Visibility.Collapsed;
|
SearchButton.Visibility = QueueManagementButton.Visibility = Visibility.Collapsed;
|
||||||
}
|
}
|
||||||
|
@ -217,21 +226,41 @@ namespace FRESHMusicPlayer
|
||||||
if (!mode) CoverArtArea.Width = new GridLength(5);
|
if (!mode) CoverArtArea.Width = new GridLength(5);
|
||||||
else CoverArtArea.Width = new GridLength(75);
|
else CoverArtArea.Width = new GridLength(75);
|
||||||
}
|
}
|
||||||
public void ShowAuxilliaryPane(string Uri, int width = 235, bool openleft = false)
|
public void ShowAuxilliaryPane(SelectedAuxiliaryPane pane, int width = 235, bool openleft = false)
|
||||||
{
|
{
|
||||||
if (AuxilliaryPaneUri == Uri)
|
if (SelectedAuxiliaryPane == pane)
|
||||||
{
|
{
|
||||||
HideAuxilliaryPane();
|
HideAuxilliaryPane();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (AuxilliaryPaneIsOpen) HideAuxilliaryPane(false);
|
if (AuxilliaryPaneIsOpen) HideAuxilliaryPane(false);
|
||||||
|
string uri;
|
||||||
|
switch (pane)
|
||||||
|
{
|
||||||
|
case SelectedAuxiliaryPane.Settings:
|
||||||
|
uri = "/Pages/Settings/SettingsPage.xaml";
|
||||||
|
break;
|
||||||
|
case SelectedAuxiliaryPane.QueueManagement:
|
||||||
|
uri = "/Pages/QueueManagement/QueueManagementPage.xaml";
|
||||||
|
break;
|
||||||
|
case SelectedAuxiliaryPane.Search:
|
||||||
|
uri = "/Pages/Library/SearchPage.xaml";
|
||||||
|
break;
|
||||||
|
case SelectedAuxiliaryPane.Notifications:
|
||||||
|
uri = "/Pages/NotificationPage.xaml";
|
||||||
|
break;
|
||||||
|
case SelectedAuxiliaryPane.TrackInfo:
|
||||||
|
uri = "/Pages/TrackInfoPage.xaml";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!openleft) DockPanel.SetDock(RightFrame, Dock.Right); else DockPanel.SetDock(RightFrame, Dock.Left);
|
if (!openleft) DockPanel.SetDock(RightFrame, Dock.Right); else DockPanel.SetDock(RightFrame, Dock.Left);
|
||||||
RightFrame.Visibility = Visibility.Visible;
|
RightFrame.Visibility = Visibility.Visible;
|
||||||
var sb = InterfaceUtils.GetDoubleAnimation(0, width, TimeSpan.FromMilliseconds(100), new PropertyPath("Width"));
|
var sb = InterfaceUtils.GetDoubleAnimation(0, width, TimeSpan.FromMilliseconds(100), new PropertyPath("Width"));
|
||||||
sb.Begin(RightFrame);
|
sb.Begin(RightFrame);
|
||||||
RightFrame.Source = new Uri(Uri, UriKind.Relative);
|
RightFrame.Source = new Uri(uri, UriKind.Relative);
|
||||||
AuxilliaryPaneUri = Uri;
|
SelectedAuxiliaryPane = pane;
|
||||||
RightFrame.NavigationService.RemoveBackEntry();
|
RightFrame.NavigationService.RemoveBackEntry();
|
||||||
AuxilliaryPaneIsOpen = true;
|
AuxilliaryPaneIsOpen = true;
|
||||||
}
|
}
|
||||||
|
@ -242,7 +271,7 @@ namespace FRESHMusicPlayer
|
||||||
else sb.Begin(RightFrame);
|
else sb.Begin(RightFrame);
|
||||||
RightFrame.Visibility = Visibility.Collapsed;
|
RightFrame.Visibility = Visibility.Collapsed;
|
||||||
RightFrame.Source = null;
|
RightFrame.Source = null;
|
||||||
AuxilliaryPaneUri = "";
|
SelectedAuxiliaryPane = SelectedAuxiliaryPane.None;
|
||||||
AuxilliaryPaneIsOpen = false;
|
AuxilliaryPaneIsOpen = false;
|
||||||
}
|
}
|
||||||
public void ProcessSettings()
|
public void ProcessSettings()
|
||||||
|
@ -251,7 +280,7 @@ namespace FRESHMusicPlayer
|
||||||
ChangeTabs(App.Config.CurrentMenu);
|
ChangeTabs(App.Config.CurrentMenu);
|
||||||
}
|
}
|
||||||
#region Tabs
|
#region Tabs
|
||||||
private void ChangeTabs(SelectedMenus tab)
|
private void ChangeTabs(SelectedMenu tab)
|
||||||
{
|
{
|
||||||
SelectedMenu = tab;
|
SelectedMenu = tab;
|
||||||
UpdateLibrary();
|
UpdateLibrary();
|
||||||
|
@ -261,27 +290,27 @@ namespace FRESHMusicPlayer
|
||||||
TextBlock tab;
|
TextBlock tab;
|
||||||
switch (SelectedMenu)
|
switch (SelectedMenu)
|
||||||
{
|
{
|
||||||
case SelectedMenus.Tracks:
|
case SelectedMenu.Tracks:
|
||||||
ContentFrame.Source = new Uri("/Pages/Library/LibraryPage.xaml", UriKind.Relative);
|
ContentFrame.Source = new Uri("/Pages/Library/LibraryPage.xaml", UriKind.Relative);
|
||||||
ContentFrame.NavigationService.RemoveBackEntry();
|
ContentFrame.NavigationService.RemoveBackEntry();
|
||||||
tab = TracksTab;
|
tab = TracksTab;
|
||||||
break;
|
break;
|
||||||
case SelectedMenus.Artists:
|
case SelectedMenu.Artists:
|
||||||
ContentFrame.Source = new Uri("/Pages/Library/LibraryPage.xaml", UriKind.Relative);
|
ContentFrame.Source = new Uri("/Pages/Library/LibraryPage.xaml", UriKind.Relative);
|
||||||
ContentFrame.NavigationService.RemoveBackEntry();
|
ContentFrame.NavigationService.RemoveBackEntry();
|
||||||
tab = ArtistsTab;
|
tab = ArtistsTab;
|
||||||
break;
|
break;
|
||||||
case SelectedMenus.Albums:
|
case SelectedMenu.Albums:
|
||||||
ContentFrame.Source = new Uri("/Pages/Library/LibraryPage.xaml", UriKind.Relative);
|
ContentFrame.Source = new Uri("/Pages/Library/LibraryPage.xaml", UriKind.Relative);
|
||||||
ContentFrame.NavigationService.RemoveBackEntry();
|
ContentFrame.NavigationService.RemoveBackEntry();
|
||||||
tab = AlbumsTab;
|
tab = AlbumsTab;
|
||||||
break;
|
break;
|
||||||
case SelectedMenus.Playlists:
|
case SelectedMenu.Playlists:
|
||||||
ContentFrame.Source = new Uri("/Pages/Library/LibraryPage.xaml", UriKind.Relative);
|
ContentFrame.Source = new Uri("/Pages/Library/LibraryPage.xaml", UriKind.Relative);
|
||||||
ContentFrame.NavigationService.RemoveBackEntry();
|
ContentFrame.NavigationService.RemoveBackEntry();
|
||||||
tab = PlaylistsTab;
|
tab = PlaylistsTab;
|
||||||
break;
|
break;
|
||||||
case SelectedMenus.Import:
|
case SelectedMenu.Import:
|
||||||
ContentFrame.Source = new Uri("/Pages/ImportPage.xaml", UriKind.Relative);
|
ContentFrame.Source = new Uri("/Pages/ImportPage.xaml", UriKind.Relative);
|
||||||
tab = ImportTab;
|
tab = ImportTab;
|
||||||
break;
|
break;
|
||||||
|
@ -402,10 +431,7 @@ namespace FRESHMusicPlayer
|
||||||
if (!isDragging) ProgressBar.Value = Player.CurrentBackend.CurrentTime.TotalSeconds;
|
if (!isDragging) ProgressBar.Value = Player.CurrentBackend.CurrentTime.TotalSeconds;
|
||||||
Player.AvoidNextQueue = false;
|
Player.AvoidNextQueue = false;
|
||||||
}
|
}
|
||||||
private void TrackTitle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
private void TrackTitle_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) => ShowAuxilliaryPane(SelectedAuxiliaryPane.TrackInfo, 235, true);
|
||||||
{
|
|
||||||
ShowAuxilliaryPane("/Pages/TrackInfoPage.xaml", 235, true);
|
|
||||||
}
|
|
||||||
private void TrackTitle_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
private void TrackTitle_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
var cm = FindResource("MiscContext") as ContextMenu;
|
var cm = FindResource("MiscContext") as ContextMenu;
|
||||||
|
@ -414,10 +440,10 @@ namespace FRESHMusicPlayer
|
||||||
}
|
}
|
||||||
private void TrackContextTagEditor_Click(object sender, RoutedEventArgs e)
|
private void TrackContextTagEditor_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
List<string> tracks = new List<string>();
|
var tracks = new List<string>();
|
||||||
if (Player.Playing) tracks.Add(Player.FilePath); // if playing, edit the file the user is playing
|
if (Player.Playing) tracks.Add(Player.FilePath); // if playing, edit the file the user is playing
|
||||||
else tracks = Player.Queue;
|
else tracks = Player.Queue;
|
||||||
TagEditor tagEditor = new TagEditor(tracks);
|
var tagEditor = new TagEditor(tracks);
|
||||||
tagEditor.Show();
|
tagEditor.Show();
|
||||||
}
|
}
|
||||||
private void TrackContentPlaylistManagement_Click(object sender, RoutedEventArgs e)
|
private void TrackContentPlaylistManagement_Click(object sender, RoutedEventArgs e)
|
||||||
|
@ -443,18 +469,15 @@ namespace FRESHMusicPlayer
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region MenuBar
|
#region MenuBar
|
||||||
private void TracksTab_MouseDown(object sender, MouseButtonEventArgs e) => ChangeTabs(SelectedMenus.Tracks);
|
private void TracksTab_MouseDown(object sender, MouseButtonEventArgs e) => ChangeTabs(SelectedMenu.Tracks);
|
||||||
private void ArtistsTab_MouseDown(object sender, MouseButtonEventArgs e) => ChangeTabs(SelectedMenus.Artists);
|
private void ArtistsTab_MouseDown(object sender, MouseButtonEventArgs e) => ChangeTabs(SelectedMenu.Artists);
|
||||||
private void AlbumsTab_MouseDown(object sender, MouseButtonEventArgs e) => ChangeTabs(SelectedMenus.Albums);
|
private void AlbumsTab_MouseDown(object sender, MouseButtonEventArgs e) => ChangeTabs(SelectedMenu.Albums);
|
||||||
private void PlaylistsTab_MouseDown(object sender, MouseButtonEventArgs e) => ChangeTabs(SelectedMenus.Playlists);
|
private void PlaylistsTab_MouseDown(object sender, MouseButtonEventArgs e) => ChangeTabs(SelectedMenu.Playlists);
|
||||||
private void ImportTab_MouseDown(object sender, MouseButtonEventArgs e) => ChangeTabs(SelectedMenus.Import);
|
private void ImportTab_MouseDown(object sender, MouseButtonEventArgs e) => ChangeTabs(SelectedMenu.Import);
|
||||||
private void SettingsButton_Click(object sender, MouseButtonEventArgs e)
|
private void SettingsButton_Click(object sender, MouseButtonEventArgs e) => ShowAuxilliaryPane(SelectedAuxiliaryPane.Settings, 335);
|
||||||
{
|
private void SearchButton_Click(object sender, MouseButtonEventArgs e) => ShowAuxilliaryPane(SelectedAuxiliaryPane.Search, 335);
|
||||||
ShowAuxilliaryPane("/Pages/Settings/SettingsPage.xaml", 335);
|
private void QueueManagementButton_Click(object sender, MouseButtonEventArgs e) => ShowAuxilliaryPane(SelectedAuxiliaryPane.QueueManagement, 335);
|
||||||
}
|
private void NotificationButton_Click(object sender, MouseButtonEventArgs e) => ShowAuxilliaryPane(SelectedAuxiliaryPane.Notifications);
|
||||||
private void SearchButton_Click(object sender, MouseButtonEventArgs e) => ShowAuxilliaryPane("/Pages/Library/SearchPage.xaml", 335);
|
|
||||||
private void QueueManagementButton_Click(object sender, MouseButtonEventArgs e) => ShowAuxilliaryPane("/Pages/QueueManagement/QueueManagementPage.xaml", 335);
|
|
||||||
private void NotificationButton_Click(object sender, MouseButtonEventArgs e) => ShowAuxilliaryPane("/Pages/NotificationPage.xaml");
|
|
||||||
#endregion
|
#endregion
|
||||||
private void NotificationHandler_NotificationInvalidate(object sender, EventArgs e)
|
private void NotificationHandler_NotificationInvalidate(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -473,9 +496,9 @@ namespace FRESHMusicPlayer
|
||||||
{
|
{
|
||||||
if (box.DisplayAsToast && !box.Read)
|
if (box.DisplayAsToast && !box.Read)
|
||||||
{
|
{
|
||||||
if (AuxilliaryPaneUri != "/Pages/NotificationPage.xaml")
|
if (SelectedAuxiliaryPane != SelectedAuxiliaryPane.Notifications)
|
||||||
{
|
{
|
||||||
ShowAuxilliaryPane("/Pages/NotificationPage.xaml");
|
ShowAuxilliaryPane(SelectedAuxiliaryPane.Notifications);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -504,31 +527,31 @@ namespace FRESHMusicPlayer
|
||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
case Key.Q:
|
case Key.Q:
|
||||||
ShowAuxilliaryPane("/Pages/Settings/SettingsPage.xaml", 335);
|
ShowAuxilliaryPane(SelectedAuxiliaryPane.Settings, 335);
|
||||||
break;
|
break;
|
||||||
case Key.A:
|
case Key.A:
|
||||||
ChangeTabs(SelectedMenus.Tracks);
|
ChangeTabs(SelectedMenu.Tracks);
|
||||||
break;
|
break;
|
||||||
case Key.S:
|
case Key.S:
|
||||||
ChangeTabs(SelectedMenus.Artists);
|
ChangeTabs(SelectedMenu.Artists);
|
||||||
break;
|
break;
|
||||||
case Key.D:
|
case Key.D:
|
||||||
ChangeTabs(SelectedMenus.Albums);
|
ChangeTabs(SelectedMenu.Albums);
|
||||||
break;
|
break;
|
||||||
case Key.F:
|
case Key.F:
|
||||||
ChangeTabs(SelectedMenus.Playlists);
|
ChangeTabs(SelectedMenu.Playlists);
|
||||||
break;
|
break;
|
||||||
case Key.G:
|
case Key.G:
|
||||||
ChangeTabs(SelectedMenus.Import);
|
ChangeTabs(SelectedMenu.Import);
|
||||||
break;
|
break;
|
||||||
case Key.E:
|
case Key.E:
|
||||||
ShowAuxilliaryPane("/Pages/Library/SearchPage.xaml", 335);
|
ShowAuxilliaryPane(SelectedAuxiliaryPane.Search, 335);
|
||||||
break;
|
break;
|
||||||
case Key.R:
|
case Key.R:
|
||||||
ShowAuxilliaryPane("/Pages/TrackInfoPage.xaml", 235, true);
|
ShowAuxilliaryPane(SelectedAuxiliaryPane.TrackInfo, 235, true);
|
||||||
break;
|
break;
|
||||||
case Key.W:
|
case Key.W:
|
||||||
ShowAuxilliaryPane("/Pages/QueueManagement/QueueManagementPage.xaml", 335);
|
ShowAuxilliaryPane(SelectedAuxiliaryPane.QueueManagement, 335);
|
||||||
break;
|
break;
|
||||||
case Key.Space:
|
case Key.Space:
|
||||||
PlayPauseMethod();
|
PlayPauseMethod();
|
||||||
|
|
|
@ -31,16 +31,16 @@ namespace FRESHMusicPlayer.Pages.Library
|
||||||
InfoLabel.Visibility = Visibility.Hidden;
|
InfoLabel.Visibility = Visibility.Hidden;
|
||||||
switch (MainWindow.SelectedMenu) // all of this stuff is here so that i can avoid copying and pasting the same page thrice, maybe there's a better way?
|
switch (MainWindow.SelectedMenu) // all of this stuff is here so that i can avoid copying and pasting the same page thrice, maybe there's a better way?
|
||||||
{
|
{
|
||||||
case SelectedMenus.Tracks:
|
case SelectedMenu.Tracks:
|
||||||
ShowTracks();
|
ShowTracks();
|
||||||
break;
|
break;
|
||||||
case SelectedMenus.Artists:
|
case SelectedMenu.Artists:
|
||||||
ShowArtists();
|
ShowArtists();
|
||||||
break;
|
break;
|
||||||
case SelectedMenus.Albums:
|
case SelectedMenu.Albums:
|
||||||
ShowAlbums();
|
ShowAlbums();
|
||||||
break;
|
break;
|
||||||
case SelectedMenus.Playlists:
|
case SelectedMenu.Playlists:
|
||||||
ShowPlaylists();
|
ShowPlaylists();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -148,8 +148,8 @@ namespace FRESHMusicPlayer.Pages.Library
|
||||||
{
|
{
|
||||||
var selectedItem = (string)CategoryPanel.SelectedItem;
|
var selectedItem = (string)CategoryPanel.SelectedItem;
|
||||||
if (selectedItem == null) return;
|
if (selectedItem == null) return;
|
||||||
if (MainWindow.SelectedMenu == SelectedMenus.Artists) ShowTracksforArtist(selectedItem);
|
if (MainWindow.SelectedMenu == SelectedMenu.Artists) ShowTracksforArtist(selectedItem);
|
||||||
else if (MainWindow.SelectedMenu == SelectedMenus.Playlists) ShowTracksforPlaylist(selectedItem);
|
else if (MainWindow.SelectedMenu == SelectedMenu.Playlists) ShowTracksforPlaylist(selectedItem);
|
||||||
else ShowTracksforAlbum(selectedItem);
|
else ShowTracksforAlbum(selectedItem);
|
||||||
}
|
}
|
||||||
private void MainWindow_TabChanged(object sender, EventArgs e)
|
private void MainWindow_TabChanged(object sender, EventArgs e)
|
||||||
|
|
Loading…
Reference in a new issue