mirror of
https://github.com/jayfunc/BetterLyrics.git
synced 2026-01-12 19:24:55 +08:00
fix: incorrect aot state after switching back to standard mode
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
using System.Text;
|
||||
using BetterInAppLyrics.WinUI3.ViewModels;
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using BetterLyrics.WinUI3.Rendering;
|
||||
using BetterLyrics.WinUI3.Services;
|
||||
using BetterLyrics.WinUI3.Services.BetterLyrics.WinUI3.Services;
|
||||
using BetterLyrics.WinUI3.ViewModels;
|
||||
using BetterLyrics.WinUI3.Views;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -13,7 +11,6 @@ using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.Windows.ApplicationModel.Resources;
|
||||
using Serilog;
|
||||
using WinUIEx;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
{
|
||||
window.SetIsShownInSwitchers(true);
|
||||
window.ExtendsContentIntoTitleBar = true;
|
||||
window.SetIsAlwaysOnTop(false);
|
||||
|
||||
IntPtr hwnd = WindowNative.GetWindowHandle(window);
|
||||
|
||||
@@ -43,8 +44,6 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
_originalPositions.Remove(hwnd);
|
||||
}
|
||||
|
||||
window.SetIsAlwaysOnTop(false);
|
||||
|
||||
UnregisterAppBar(hwnd);
|
||||
}
|
||||
|
||||
@@ -52,6 +51,7 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
{
|
||||
window.SetIsShownInSwitchers(false);
|
||||
window.ExtendsContentIntoTitleBar = false;
|
||||
window.SetIsAlwaysOnTop(true);
|
||||
|
||||
IntPtr hwnd = WindowNative.GetWindowHandle(window);
|
||||
|
||||
@@ -82,8 +82,6 @@ namespace BetterLyrics.WinUI3.Helper
|
||||
appBarHeight,
|
||||
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_SHOWWINDOW
|
||||
);
|
||||
|
||||
window.SetIsAlwaysOnTop(true);
|
||||
}
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
x:Name="LyricsCanvas"
|
||||
Draw="LyricsCanvas_Draw"
|
||||
Loaded="LyricsCanvas_Loaded"
|
||||
Paused="{x:Bind ViewModel.IsPlaying, Mode=OneWay, Converter={StaticResource BoolNegationConverter}}"
|
||||
Update="LyricsCanvas_Update" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace BetterLyrics.WinUI3.Services
|
||||
// Album art
|
||||
SetDefault(IsCoverOverlayEnabledKey, true);
|
||||
SetDefault(IsDynamicCoverOverlayEnabledKey, true);
|
||||
SetDefault(CoverOverlayOpacityKey, 100); // 100 % = 1.1
|
||||
SetDefault(CoverOverlayOpacityKey, 75); // 100 % = 1.0
|
||||
SetDefault(CoverOverlayBlurAmountKey, 200);
|
||||
SetDefault(TitleBarTypeKey, (int)TitleBarType.Compact);
|
||||
SetDefault(CoverImageRadiusKey, 24); // 24 %
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using BetterLyrics.WinUI3.Services;
|
||||
using BetterLyrics.WinUI3.ViewModels;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
|
||||
namespace BetterLyrics.WinUI3.Rendering
|
||||
{
|
||||
public partial class BaseRendererViewModel(ISettingsService settingsService)
|
||||
: BaseViewModel(settingsService)
|
||||
{
|
||||
public TimeSpan TotalTime { get; set; } = TimeSpan.Zero;
|
||||
public TimeSpan ElapsedTime { get; set; } = TimeSpan.Zero;
|
||||
|
||||
public virtual void Calculate(
|
||||
ICanvasAnimatedControl control,
|
||||
CanvasAnimatedUpdateEventArgs args
|
||||
)
|
||||
{
|
||||
TotalTime += args.Timing.ElapsedTime;
|
||||
ElapsedTime = args.Timing.ElapsedTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BetterInAppLyrics.WinUI3.ViewModels;
|
||||
using BetterLyrics.WinUI3.Enums;
|
||||
using BetterLyrics.WinUI3.Events;
|
||||
using BetterLyrics.WinUI3.Helper;
|
||||
using BetterLyrics.WinUI3.Messages;
|
||||
using BetterLyrics.WinUI3.Models;
|
||||
using BetterLyrics.WinUI3.Rendering;
|
||||
using BetterLyrics.WinUI3.Services;
|
||||
using BetterLyrics.WinUI3.Services.BetterLyrics.WinUI3.Services;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||
@@ -25,11 +19,7 @@ using Microsoft.Graphics.Canvas.Effects;
|
||||
using Microsoft.Graphics.Canvas.Text;
|
||||
using Microsoft.Graphics.Canvas.UI.Xaml;
|
||||
using Microsoft.UI;
|
||||
using Microsoft.UI.Dispatching;
|
||||
using Microsoft.UI.Text;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Shapes;
|
||||
using Windows.Foundation;
|
||||
using Windows.Graphics.Imaging;
|
||||
using Windows.UI;
|
||||
@@ -37,7 +27,7 @@ using Windows.UI;
|
||||
namespace BetterLyrics.WinUI3.ViewModels
|
||||
{
|
||||
public partial class LyricsRendererViewModel
|
||||
: BaseRendererViewModel,
|
||||
: BaseViewModel,
|
||||
IRecipient<PropertyChangedMessage<int>>,
|
||||
IRecipient<PropertyChangedMessage<float>>,
|
||||
IRecipient<PropertyChangedMessage<double>>,
|
||||
@@ -58,6 +48,9 @@ namespace BetterLyrics.WinUI3.ViewModels
|
||||
VerticalAlignment = CanvasVerticalAlignment.Top,
|
||||
};
|
||||
|
||||
public TimeSpan TotalTime { get; set; } = TimeSpan.Zero;
|
||||
public TimeSpan ElapsedTime { get; set; } = TimeSpan.Zero;
|
||||
|
||||
public LyricsDisplayType DisplayType { get; set; }
|
||||
|
||||
private float _rotateAngle = 0f;
|
||||
@@ -101,7 +94,7 @@ namespace BetterLyrics.WinUI3.ViewModels
|
||||
public int CoverOverlayBlurAmount { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
public partial bool IsPlaying { get; set; }
|
||||
public partial bool IsPlaying { get; set; } = true;
|
||||
|
||||
[NotifyPropertyChangedRecipients]
|
||||
[ObservableProperty]
|
||||
@@ -885,12 +878,13 @@ namespace BetterLyrics.WinUI3.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public override void Calculate(
|
||||
ICanvasAnimatedControl control,
|
||||
CanvasAnimatedUpdateEventArgs args
|
||||
)
|
||||
public void Calculate(ICanvasAnimatedControl control, CanvasAnimatedUpdateEventArgs args)
|
||||
{
|
||||
base.Calculate(control, args);
|
||||
if (IsPlaying)
|
||||
{
|
||||
TotalTime += args.Timing.ElapsedTime;
|
||||
ElapsedTime = args.Timing.ElapsedTime;
|
||||
}
|
||||
|
||||
if (_isColorTransitioning)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user