Merge pull request #52 from jayfunc/dev

fix
This commit is contained in:
Zhe Fang
2025-07-21 09:51:41 -04:00
committed by GitHub
9 changed files with 53 additions and 35 deletions

View File

@@ -12,7 +12,7 @@
<Identity
Name="37412.BetterLyrics"
Publisher="CN=E1428B0E-DC1D-4EA4-ACB1-4556569D5BA9"
Version="1.0.20.0" />
Version="1.0.21.0" />
<mp:PhoneIdentity PhoneProductId="ca4a4830-fc19-40d9-b823-53e2bff3d816" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

View File

@@ -16,6 +16,7 @@ using ShadowViewer.Controls;
using System;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace BetterLyrics.WinUI3

View File

@@ -73,6 +73,14 @@ namespace BetterLyrics.WinUI3.Helper
int targetX = _settingsService.DesktopWindowLeft;
int targetY = _settingsService.DesktopWindowTop;
if (targetWidth <= 0 || targetHeight <= 0 || targetX < 0 || targetY < 0)
{
targetWidth = 1200;
targetHeight = 600;
targetX = 200;
targetY = 200;
}
// <20><><EFBFBD>ô<EFBFBD><C3B4>ڴ<EFBFBD>С<EFBFBD><D0A1>λ<EFBFBD><CEBB>
window.AppWindow.MoveAndResize(
new Windows.Graphics.RectInt32(targetX, targetY, targetWidth, targetHeight)

View File

@@ -26,15 +26,6 @@ namespace BetterLyrics.WinUI3.Helper
}
}
public static void ExitAllWindows()
{
while (_activeWindows.Count > 0)
{
var window = (Window)_activeWindows[0];
window.Close();
}
}
public static T? GetWindowByWindowType<T>()
{
foreach (var window in _activeWindows)

View File

@@ -49,10 +49,10 @@ namespace BetterLyrics.WinUI3.ViewModels
IsSongPlaying = _playbackService.IsPlaying;
}
private void SystemVolumeHelper_VolumeChanged(int volume)
{
Volume = volume;
}
//private void SystemVolumeHelper_VolumeChanged(int volume)
//{
// Volume = volume;
//}
private void PlaybackService_IsPlayingChanged(object? sender, Events.IsPlayingChangedEventArgs e)
{
@@ -245,10 +245,10 @@ namespace BetterLyrics.WinUI3.ViewModels
}
}
partial void OnVolumeChanged(int value)
{
SystemVolumeHelper.SetMasterVolume(value);
}
//partial void OnVolumeChanged(int value)
//{
// SystemVolumeHelper.SetMasterVolume(value);
//}
public void Receive(PropertyChangedMessage<TimeSpan> message)
{

View File

@@ -34,7 +34,12 @@ namespace BetterLyrics.WinUI3.ViewModels
[RelayCommand]
private static void ExitApp()
{
WindowHelper.ExitAllWindows();
LyricsWindow? lyricsWindow = WindowHelper.GetWindowByWindowType<LyricsWindow>();
if (lyricsWindow != null)
{
DockModeHelper.Disable(lyricsWindow);
}
App.Current.Exit();
}
[RelayCommand]

View File

@@ -193,13 +193,12 @@
Spacing="3">
<!-- Volume -->
<Button
Click="VolumeButton_Click"
Style="{StaticResource GhostButtonStyle}"
Visibility="Collapsed">
<!--<Button Click="VolumeButton_Click" Style="{StaticResource GhostButtonStyle}">
<Grid>
<!-- Volumn: 0 -->
-->
<!-- Volumn: 0 -->
<!--
<FontIcon
x:Name="VolumeLevel0"
FontFamily="{StaticResource IconFontFamily}"
@@ -209,7 +208,9 @@
</FontIcon.OpacityTransition>
</FontIcon>
<!-- Volumn: 1-32 -->
-->
<!-- Volumn: 1-32 -->
<!--
<FontIcon
x:Name="VolumeLevel1"
FontFamily="{StaticResource IconFontFamily}"
@@ -219,7 +220,9 @@
</FontIcon.OpacityTransition>
</FontIcon>
<!-- Volumn: 33-65 -->
-->
<!-- Volumn: 33-65 -->
<!--
<FontIcon
x:Name="VolumeLevel2"
FontFamily="{StaticResource IconFontFamily}"
@@ -229,7 +232,9 @@
</FontIcon.OpacityTransition>
</FontIcon>
<!-- Volumn: 66-100 -->
-->
<!-- Volumn: 66-100 -->
<!--
<FontIcon
x:Name="VolumeLevel3"
FontFamily="{StaticResource IconFontFamily}"
@@ -257,7 +262,7 @@
</StackPanel>
</Flyout>
</Button.DataContext>
</Button>
</Button>-->
<!-- Translation -->
<Button
@@ -395,10 +400,10 @@
IsOpen="{x:Bind ViewModel.IsWelcomeTeachingTipOpen, Mode=OneWay}"
Target="{x:Bind RootGrid}" />
<!--<uc:SystemTray />-->
<uc:SystemTray />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="VolumeState">
<!--<VisualStateGroup x:Name="VolumeState">
<VisualState x:Name="Volume0">
<VisualState.StateTriggers>
<ui:CompareStateTrigger
@@ -455,7 +460,7 @@
<Setter Target="VolumeLevel3.Opacity" Value="1" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroup>-->
</VisualStateManager.VisualStateGroups>
</Grid>
</Page>

View File

@@ -116,10 +116,10 @@ namespace BetterLyrics.WinUI3.Views
await _playbackService.ChangePosition(e.NewValue);
}
private void VolumeButton_Click(object sender, RoutedEventArgs e)
{
VolumeFlyout.ShowAt(BottomRightCommandStackPanel);
}
//private void VolumeButton_Click(object sender, RoutedEventArgs e)
//{
// VolumeFlyout.ShowAt(BottomRightCommandStackPanel);
//}
private void BottomCommandFlyoutTrigger_PointerEntered(object sender, Microsoft.UI.Xaml.Input.PointerRoutedEventArgs e)
{

View File

@@ -69,6 +69,14 @@ namespace BetterLyrics.WinUI3.Views
switch (type!)
{
case AutoStartWindowType.StandardMode:
if (_settingsService.StandardWindowLeft < 0 || _settingsService.StandardWindowTop < 0 ||
_settingsService.StandardWindowWidth <= 0 || _settingsService.StandardWindowHeight <= 0)
{
_settingsService.StandardWindowLeft = 200;
_settingsService.StandardWindowTop = 200;
_settingsService.StandardWindowWidth = 1600;
_settingsService.StandardWindowHeight = 800;
}
AppWindow.MoveAndResize(new Windows.Graphics.RectInt32(
_settingsService.StandardWindowLeft,
_settingsService.StandardWindowTop,