using HarmonyWinUI.Pages; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using System; using System.Collections.ObjectModel; using Windows.System; // To learn more about WinUI, the WinUI project structure, // and more about our project templates, see: http://aka.ms/winui-project-info. namespace HarmonyWinUI { /// /// An empty window that can be used on its own or navigated to within a Frame. /// public sealed partial class MainWindow : Window { public ObservableCollection Items { get; } = new(); public MainWindow() { InitializeComponent(); // default MainNavigationContentFrame.Navigate(typeof(Dashboard)); this.Items.Add(new PlayListItem("Dodo", "Stromae")); this.Items.Add(new PlayListItem("La Danza", "John Summit")); this.Items.Add(new PlayListItem("Trapny vietor", "Horkyze Slize")); } private async void MainNavigation_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args) { if (args.IsSettingsSelected) { MainNavigationContentFrame.Navigate(typeof(Settings)); return; } if (args.SelectedItem is not NavigationViewItem item) return; switch (item.Tag?.ToString()) { case "Dashboard": MainNavigationContentFrame.Navigate(typeof(Dashboard)); break; case "FavoriteAlbums": MainNavigationContentFrame.Navigate(typeof(FavoriteAlbums)); break; case "FavoriteTracks": MainNavigationContentFrame.Navigate(typeof(FavoriteTracks)); break; case "FavoriteArtists": MainNavigationContentFrame.Navigate(typeof(FavoriteArtists)); break; case "PageDonate": await Launcher.LaunchUriAsync( new Uri("https://www.anycoin.cz/donate/igormino") ); break; case "PageHomepage": await Launcher.LaunchUriAsync( new Uri("https://harmony.tpsoft.org/") ); break; } } } public class PlayListItem { public string? TrackName { get; set; } public string? ArtistName { get; set; } public PlayListItem() { } public PlayListItem(string? trackName, string? artistName) { TrackName = trackName; ArtistName = artistName; } } }