diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest index 0b8d0ab..0054877 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3 (Package)/Package.appxmanifest @@ -12,7 +12,7 @@ + Version="1.0.95.0" /> diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml index 2f4c05d..e66994f 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml @@ -13,8 +13,8 @@ - + @@ -66,10 +66,13 @@ + + + 4 @@ -305,8 +308,12 @@ - diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs index 1b4d7fb..c24b383 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/App.xaml.cs @@ -9,6 +9,7 @@ using BetterLyrics.WinUI3.Services.LibWatcherService; using BetterLyrics.WinUI3.Services.LiveStatesService; using BetterLyrics.WinUI3.Services.LyricsSearchService; using BetterLyrics.WinUI3.Services.MediaSessionsService; +using BetterLyrics.WinUI3.Services.ResourceService; using BetterLyrics.WinUI3.Services.SettingsService; using BetterLyrics.WinUI3.Services.TranslateService; using BetterLyrics.WinUI3.ViewModels; @@ -22,7 +23,6 @@ using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.Windows.ApplicationModel.Resources; using Serilog; -using ShadowViewer.Controls; using System; using System.Diagnostics; using System.Linq; @@ -39,12 +39,6 @@ namespace BetterLyrics.WinUI3 private readonly ILogger _logger; public static new App Current => (App)Application.Current; - public static DispatcherQueue? DispatcherQueue { get; private set; } - public static DispatcherQueueTimer? DispatcherQueueTimer { get; private set; } - public static ResourceLoader? ResourceLoader { get; private set; } - - public NotificationPanel? LyricsWindowNotificationPanel { get; set; } - public NotificationPanel? SettingsWindowNotificationPanel { get; set; } private static Mutex? _instanceMutex; @@ -52,10 +46,6 @@ namespace BetterLyrics.WinUI3 { this.InitializeComponent(); - DispatcherQueue = DispatcherQueue.GetForCurrentThread(); - DispatcherQueueTimer = DispatcherQueue.CreateTimer(); - ResourceLoader = new ResourceLoader(); - EnsureSingleInstance(); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); @@ -72,12 +62,11 @@ namespace BetterLyrics.WinUI3 private void EnsureSingleInstance() { - bool createdNew; - _instanceMutex = new Mutex(true, Constants.App.AppName, out createdNew); + _instanceMutex = new Mutex(true, Constants.App.AppName, out bool createdNew); if (!createdNew) { - User32.MessageBox(HWND.NULL, ResourceLoader!.GetString("TryRunMultipleInstance"), null, User32.MB_FLAGS.MB_APPLMODAL); + User32.MessageBox(HWND.NULL, new ResourceLoader().GetString("TryRunMultipleInstance"), null, User32.MB_FLAGS.MB_APPLMODAL); Environment.Exit(0); } } @@ -111,6 +100,7 @@ namespace BetterLyrics.WinUI3 .AddSingleton() .AddSingleton() .AddSingleton() + .AddSingleton() // ViewModels .AddSingleton() .AddSingleton() diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj index c575964..c55bf46 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/BetterLyrics.WinUI3.csproj @@ -50,20 +50,16 @@ - - - - - + @@ -74,7 +70,7 @@ - + @@ -82,7 +78,6 @@ - @@ -92,7 +87,7 @@ - + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml index 7dd9c2a..4ff2b65 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AlbumArtLayoutSettingsControl.xaml @@ -7,6 +7,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:BetterLyrics.WinUI3.Controls" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:dev="using:DevWinUI" xmlns:ui="using:CommunityToolkit.WinUI" mc:Ignorable="d"> @@ -17,16 +18,16 @@ - - - + + - - + + - - - + + + - + - + - + - + - + - + - - - + + - - + + - - - + + + - - - + + - - - + + + diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml index 9ce9dff..9a1be26 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Controls/AppSettingsControl.xaml @@ -5,6 +5,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="using:CommunityToolkit.WinUI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:dev="using:DevWinUI" xmlns:globalization="using:Windows.Globalization" xmlns:helper="using:BetterLyrics.WinUI3.Helper" xmlns:local="using:BetterLyrics.WinUI3.Controls" @@ -22,7 +23,7 @@ - - - + + + + Grid.Row="2" + ItemsSource="{x:Bind ViewModel.AppSettings.StarredPlaylists, Mode=OneWay}"> @@ -121,33 +257,28 @@ - - - - - - - - - - - - + + + + + + + + - + @@ -163,7 +294,7 @@ @@ -172,7 +303,7 @@ @@ -206,7 +337,7 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml.cs b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml.cs index a7b8316..51c7e7e 100644 --- a/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml.cs +++ b/BetterLyrics.WinUI3/BetterLyrics.WinUI3/Views/SettingsWindow.xaml.cs @@ -1,4 +1,5 @@ using BetterLyrics.WinUI3.Helper; +using BetterLyrics.WinUI3.Services.ResourceService; using BetterLyrics.WinUI3.ViewModels; using CommunityToolkit.Mvvm.DependencyInjection; using Microsoft.UI.Windowing; @@ -9,12 +10,14 @@ namespace BetterLyrics.WinUI3.Views { public sealed partial class SettingsWindow : Window { + private readonly IResourceService _resourceService = Ioc.Default.GetRequiredService(); + public SettingsWindowViewModel ViewModel { get; set; } = Ioc.Default.GetRequiredService(); public SettingsWindow() { InitializeComponent(); - Title = App.ResourceLoader?.GetString("SettingsPageTitle"); + Title = _resourceService.GetLocalizedString("SettingsPageTitle"); AppWindow.TitleBar.PreferredTheme = TitleBarTheme.UseDefaultAppMode; AppWindow.SetIcons(); @@ -30,11 +33,6 @@ namespace BetterLyrics.WinUI3.Views WindowHelper.CloseWindow(); } - private void TipContainerCenter_Loaded(object sender, RoutedEventArgs e) - { - App.Current.SettingsWindowNotificationPanel = TipContainerCenter; - } - private void LyricsWindowButton_Click(object sender, RoutedEventArgs e) { WindowHelper.OpenOrShowWindow();