返回提交历史
Added
HaloPixelToolBox/HaloPixelToolBox.Core/Models/HaloPixelTextLayout.cs
+11
-0
Added
HaloPixelToolBox/HaloPixelToolBox.Core/Models/HaloPixelUIModel.cs
+14
-0
Modified
HaloPixelToolBox/HaloPixelToolBox.Core/Utilities/HaloPixelDevice.cs
+24
-3
Modified
HaloPixelToolBox/HaloPixelToolBox.Core/Utilities/HidPacketBuilder.cs
+61
-13
Modified
HaloPixelToolBox/HaloPixelToolBox.Test/Program.cs
+20
-11
Modified
HaloPixelToolBox/HaloPixelToolBox/HaloPixelToolBox.csproj
+1
-1
Added
HaloPixelToolBox/HaloPixelToolBox/Profiles/CrossVersionProfiles/CloudMusicLyricsProfile.cs
+35
-0
Modified
HaloPixelToolBox/HaloPixelToolBox/Profiles/CrossVersionProfiles/SystemProfile.cs
+20
-26
Modified
HaloPixelToolBox/HaloPixelToolBox/ViewModels/CloudMusicLyricsToolPageViewModel.cs
+52
-4
Modified
HaloPixelToolBox/HaloPixelToolBox/Views/CloudMusicLyricsToolPage.xaml
+32
-0
Modified
HaloPixelToolBox/HaloPixelToolBox/Views/CloudMusicLyricsToolPage.xaml.cs
+6
-0
XFEstudio/HaloPixelToolBox
修复部分已知问题 优化歌词显示 新增个性化定制设置
5aa240d
代码差异
11 个文件
+276
-58
@@ -0,0 +1,11 @@
1
namespace HaloPixelToolBox.Core.Models;
2
3
public enum HaloPixelTextLayout
4
{
5
ScrollLeftToRight = 0,
6
ScrollRightToLeft = 1,
7
Left = 2,
8
Right = 3,
9
Center = 4,
10
Stretch = 5
11
}
@@ -0,0 +1,14 @@
1
namespace HaloPixelToolBox.Core.Models;
2
3
public enum HaloPixelUIModel
4
{
5
Clock = 0,
6
Game = 1,
7
Work = 2,
8
Read = 3,
9
Cats = 4,
10
Dogs = 5,
11
Memes = 6,
12
Cyber = 7,
13
Waves = 8
14
}
@@ -1,9 +1,10 @@
1
using HidSharp;
1
using HaloPixelToolBox.Core.Models;
2
using HidSharp;
2
3
using XFEExtension.NetCore.StringExtension;
3
4
4
5
namespace HaloPixelToolBox.Core.Utilities;
5
6
6
public class HaloPixelDevice
7
public partial class HaloPixelDevice
7
8
{
8
9
public HidDevice? CurrentDevice { get; set; }
9
10
@@ -34,7 +35,27 @@ public class HaloPixelDevice
34
35
{
35
36
using var stream = CurrentDevice?.Open();
36
37
byte[] package = new byte[64];
37
var data = HidPacketBuilder.Build(text);
38
var data = HidPacketBuilder.BuildText(text);
39
Array.Copy(data, package, data.Length);
40
stream?.Write(package);
41
stream?.Close();
42
}
43
44
public void SetTextLayout(HaloPixelTextLayout layout)
45
{
46
using var stream = CurrentDevice?.Open();
47
byte[] package = new byte[64];
48
var data = HidPacketBuilder.Build(HidPacketBuilder.ConvertLayout(layout));
49
Array.Copy(data, package, data.Length);
50
stream?.Write(package);
51
stream?.Close();
52
}
53
54
public void SetUIModel(HaloPixelUIModel haloPixelUIModel)
55
{
56
using var stream = CurrentDevice?.Open();
57
byte[] package = new byte[64];
58
var data = HidPacketBuilder.Build(HidPacketBuilder.ConvertUIModel(haloPixelUIModel));
38
59
Array.Copy(data, package, data.Length);
39
60
stream?.Write(package);
40
61
stream?.Close();
@@ -1,17 +1,26 @@
1
using System.Text;
1
using HaloPixelToolBox.Core.Models;
2
using System.Text;
2
3
3
4
namespace HaloPixelToolBox.Core.Utilities;
4
5
5
6
public class HidPacketBuilder
6
7
{
7
8
/// <summary>
8
/// 固定头 5 字节
9
/// 文本头
9
10
/// </summary>
10
private static readonly byte[] Header =
11
public static readonly byte[] TextHeader =
11
12
[
12
13
0x2E, 0xAA, 0xEC, 0xE8, 0x00
13
14
];
14
15
16
/// <summary>
17
/// 布局头
18
/// </summary>
19
public static readonly byte[] LayoutHeader =
20
[
21
0x2E, 0xAA, 0xEC, 0xEF, 0x00, 0x09, 0x01, 0xf0, 0xb4, 0xc8, 0x00, 0x02, 0x00
22
];
23
15
24
/// <summary>
16
25
/// 固定包长度(64 bytes)
17
26
/// </summary>
@@ -20,14 +29,14 @@ public class HidPacketBuilder
20
29
/// <summary>
21
30
/// 构造 HID 协议包
22
31
/// </summary>
23
public static byte[] Build(string text)
32
public static byte[] BuildText(string text)
24
33
{
25
34
var textBytes = Encoding.UTF8.GetBytes(text);
26
35
byte textLen = (byte)textBytes.Length;
27
36
// 有效载荷长度 = TextLen(1) + Text(N) + Checksum(1)
28
37
ushort totalLen = (ushort)(1 + textLen + 1);
29
38
30
var list = Header.ToList();
39
var list = TextHeader.ToList();
31
40
32
41
// TotalLen (2 bytes, little-endian)
33
42
list.AddRange(BitConverter.GetBytes(totalLen));
@@ -41,15 +50,54 @@ public class HidPacketBuilder
41
50
// Checksum (1 byte)
42
51
list.Add(byte.Parse(Checksum(textBytes).ToString()));
43
52
44
// Padding 补 0 到固定长度(64 字节)
45
while (list.Count < FixedPacketLength)
46
list.Add(0x00);
53
return Build(list);
54
}
55
56
/// <summary>
57
/// 转换布局枚举到对应的 HID 包字节数组
58
/// </summary>
59
/// <param name="haloPixelTextLayout"></param>
60
/// <returns></returns>
61
public static byte[] ConvertLayout(HaloPixelTextLayout haloPixelTextLayout) => haloPixelTextLayout switch
62
{
63
HaloPixelTextLayout.Left => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x01, 0xf0, 0xb4, 0xc8, 0x00, 0x02, 0x00, 0x00, 0xff, 0xfc, 0x00],
64
HaloPixelTextLayout.Center => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x01, 0xf0, 0xb4, 0xc8, 0x00, 0x02, 0x00, 0x01, 0xff, 0xfd, 0x00],
65
HaloPixelTextLayout.Right => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x01, 0xf0, 0xb4, 0xc8, 0x00, 0x02, 0x00, 0x02, 0xff, 0xfe, 0x00],
66
HaloPixelTextLayout.Stretch => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x01, 0xf0, 0xb4, 0xc8, 0x00, 0x02, 0x00, 0x03, 0xff, 0xff, 0x00],
67
HaloPixelTextLayout.ScrollLeftToRight => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x01, 0xf0, 0xb4, 0xc8, 0x00, 0x02, 0x01, 0x00, 0xff, 0xfd, 0x00],
68
HaloPixelTextLayout.ScrollRightToLeft => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x01, 0xf0, 0xb4, 0xc8, 0x00, 0x02, 0x01, 0x01, 0xff, 0xfe, 0x00],
69
_ => [],
70
};
47
71
48
// 如果超长则截断(一般不应发生)
49
if (list.Count > FixedPacketLength)
50
return [.. list.Take(FixedPacketLength)];
72
public static byte[] ConvertUIModel(HaloPixelUIModel haloPixelUIModel) => haloPixelUIModel switch
73
{
74
HaloPixelUIModel.Clock => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x02, 0xf0, 0xb4, 0xc8, 0x00, 0x01, 0x00, 0xff, 0xff, 0xfb, 0x00],
75
HaloPixelUIModel.Game => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x02, 0xf0, 0xb4, 0xc8, 0x00, 0x01, 0x01, 0xff, 0xff, 0xfc, 0x00],
76
HaloPixelUIModel.Work => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x02, 0xf0, 0xb4, 0xc8, 0x00, 0x01, 0x02, 0xff, 0xff, 0xfd, 0x00],
77
HaloPixelUIModel.Read => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x02, 0xf0, 0xb4, 0xc8, 0x00, 0x01, 0x03, 0xff, 0xff, 0xfe, 0x00],
78
HaloPixelUIModel.Cats => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x02, 0xf0, 0xb4, 0xc8, 0x00, 0x01, 0x04, 0xff, 0xff, 0xff, 0x00],
79
HaloPixelUIModel.Dogs => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x02, 0xf0, 0xb4, 0xc8, 0x00, 0x01, 0x05, 0xff, 0xff, 0x00, 0x00],
80
HaloPixelUIModel.Memes => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x02, 0xf0, 0xb4, 0xc8, 0x00, 0x01, 0x06, 0xff, 0xff, 0x01, 0x00],
81
HaloPixelUIModel.Cyber => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x02, 0xf0, 0xb4, 0xc8, 0x00, 0x01, 0x07, 0xff, 0xff, 0x02, 0x00],
82
HaloPixelUIModel.Waves => [0x2e, 0xaa, 0xec, 0xef, 0x00, 0x09, 0x02, 0xf0, 0xb4, 0xc8, 0x00, 0x01, 0x08, 0xff, 0xff, 0x03, 0x00],
83
_ => [],
84
};
85
86
/// <summary>
87
/// 构造 HID 协议包
88
/// </summary>
89
public static byte[] Build(byte[] bytes) => Build(bytes.ToList());
90
91
/// <summary>
92
/// 构造 HID 协议包
93
/// </summary>
94
public static byte[] Build(List<byte> bytes)
95
{
96
// Padding 补 0 到固定长度(64 字节)
97
while (bytes.Count < FixedPacketLength)
98
bytes.Add(0x00);
51
99
52
return [.. list];
100
return [.. bytes];
53
101
}
54
102
55
103
/// <summary>
@@ -58,7 +106,7 @@ public class HidPacketBuilder
58
106
public static int Checksum(byte[] textBytes)
59
107
{
60
108
int acc = 128;
61
foreach (char ch in textBytes)
109
foreach (char ch in textBytes.Select(v => (char)v))
62
110
{
63
111
acc += ch + 2;
64
112
}
@@ -1,16 +1,25 @@
1
using System.Runtime.Versioning;
1
using HaloPixelToolBox.Core.Models;
2
using HaloPixelToolBox.Core.Utilities;
3
using System.Runtime.Versioning;
2
4
3
namespace HaloPixelToolBox.Test
5
namespace HaloPixelToolBox.Test;
6
7
[SupportedOSPlatform("windows")]
8
internal class Program
4
9
{
5
[SupportedOSPlatform("windows")]
6
internal class Program
10
[SMTest]
11
public static void TestMethod()
7
12
{
8
[SMTest]
9
static void TestMethod()
10
{
11
// This is a test method that will be executed by the test runner.
12
// You can add your test logic here.
13
Console.WriteLine("TestMethod executed successfully.");
14
}
13
var device = new HaloPixelDevice();
14
device.Initialize();
15
device.SetUIModel(HaloPixelUIModel.Clock);
16
device.SetUIModel(HaloPixelUIModel.Game);
17
device.SetUIModel(HaloPixelUIModel.Work);
18
device.SetUIModel(HaloPixelUIModel.Read);
19
device.SetUIModel(HaloPixelUIModel.Cats);
20
device.SetUIModel(HaloPixelUIModel.Dogs);
21
device.SetUIModel(HaloPixelUIModel.Memes);
22
device.SetUIModel(HaloPixelUIModel.Cyber);
23
device.SetUIModel(HaloPixelUIModel.Waves);
15
24
}
16
25
}
@@ -9,7 +9,7 @@
9
9
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
10
10
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
11
11
<UseWinUI>true</UseWinUI>
12
<Version>1.0.1</Version>
12
<Version>1.1.0</Version>
13
13
<EnableMsixTooling>true</EnableMsixTooling>
14
14
<WindowsPackageType>None</WindowsPackageType>
15
15
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
@@ -0,0 +1,35 @@
1
using HaloPixelToolBox.Core.Models;
2
using XFEExtension.NetCore.AutoConfig;
3
using XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
4
5
namespace HaloPixelToolBox.Profiles.CrossVersionProfiles;
6
7
public partial class CloudMusicLyricsProfile : XFEProfile
8
{
9
public CloudMusicLyricsProfile() => ProfilePath = $@"{AppPathHelper.LocalProfile}\{nameof(CloudMusicLyricsProfile)}";
10
/// <summary>
11
/// 切换回默认显示内容的时间
12
/// </summary>
13
[ProfileProperty]
14
private int switchBackTimeout = 60;
15
/// <summary>
16
/// 是否启用网易云音乐歌词
17
/// </summary>
18
[ProfileProperty]
19
private bool enableCloudMusicLyrics = false;
20
/// <summary>
21
/// 当暂停时切换回默认显示内容
22
/// </summary>
23
[ProfileProperty]
24
private bool switchBackWhenPause = true;
25
/// <summary>
26
/// 默认歌词显示布局
27
/// </summary>
28
[ProfileProperty]
29
private HaloPixelTextLayout defaultHaloPixelTextLayout = HaloPixelTextLayout.Center;
30
/// <summary>
31
/// 默认暂停界面
32
/// </summary>
33
[ProfileProperty]
34
private HaloPixelUIModel defaultHaloPixelUIModel = HaloPixelUIModel.Clock;
35
}
@@ -1,33 +1,27 @@
1
1
using XFEExtension.NetCore.AutoConfig;
2
2
using XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
3
3
4
namespace HaloPixelToolBox.Profiles.CrossVersionProfiles
4
namespace HaloPixelToolBox.Profiles.CrossVersionProfiles;
5
6
public partial class SystemProfile : XFEProfile
5
7
{
6
public partial class SystemProfile : XFEProfile
7
{
8
public SystemProfile() => ProfilePath = $@"{AppPathHelper.LocalProfile}\{nameof(SystemProfile)}";
8
public SystemProfile() => ProfilePath = $@"{AppPathHelper.LocalProfile}\{nameof(SystemProfile)}";
9
9
10
/// <summary>
11
/// 主题颜色
12
/// </summary>
13
[ProfileProperty]
14
private ElementTheme theme = ElementTheme.Default;
15
/// <summary>
16
/// 是否自动启动
17
/// </summary>
18
[ProfileProperty]
19
private bool autoStart = false;
20
/// <summary>
21
/// 是否启用网易云音乐歌词
22
/// </summary>
23
[ProfileProperty]
24
private bool enableCloudMusicLyrics = false;
25
/// <summary>
26
/// 忽略的版本号
27
/// </summary>
28
[ProfileProperty]
29
private string ignoreVersion = string.Empty;
10
/// <summary>
11
/// 主题颜色
12
/// </summary>
13
[ProfileProperty]
14
private ElementTheme theme = ElementTheme.Default;
15
/// <summary>
16
/// 是否自动启动
17
/// </summary>
18
[ProfileProperty]
19
private bool autoStart = false;
20
/// <summary>
21
/// 忽略的版本号
22
/// </summary>
23
[ProfileProperty]
24
private string ignoreVersion = string.Empty;
30
25
31
static partial void SetThemeProperty(ref ElementTheme value) => AppThemeHelper.ChangeTheme(value);
32
}
26
static partial void SetThemeProperty(ref ElementTheme value) => AppThemeHelper.ChangeTheme(value);
33
27
}
@@ -1,7 +1,11 @@
1
1
using CommunityToolkit.Mvvm.ComponentModel;
2
2
using HaloPixelToolBox.Core.Utilities;
3
3
using HaloPixelToolBox.Profiles.CrossVersionProfiles;
4
using System.Diagnostics;
5
using XFEExtension.NetCore.StringExtension;
4
6
using XFEExtension.NetCore.WinUIHelper.Implements;
7
using XFEExtension.NetCore.WinUIHelper.Interface.Services;
8
using XFEExtension.NetCore.WinUIHelper.Utilities;
5
9
6
10
namespace HaloPixelToolBox.ViewModels;
7
11
@@ -12,11 +16,21 @@ public partial class CloudMusicLyricsToolPageViewModel : ServiceBaseViewModelBas
12
16
[ObservableProperty]
13
17
private bool cloudMusicReady;
14
18
[ObservableProperty]
15
private bool enableCloudMusicLyrics = SystemProfile.EnableCloudMusicLyrics;
19
private bool enableCloudMusicLyrics = CloudMusicLyricsProfile.EnableCloudMusicLyrics;
20
[ObservableProperty]
21
private bool switchBackWhenPause = CloudMusicLyricsProfile.SwitchBackWhenPause;
22
[ObservableProperty]
23
private int switchBackTimeout = CloudMusicLyricsProfile.SwitchBackTimeout;
16
24
public HaloPixelDevice Device { get; set; } = new();
17
25
public CloudMusicLyricsReader Reader { get; set; } = new();
18
26
19
partial void OnEnableCloudMusicLyricsChanged(bool value) => SystemProfile.EnableCloudMusicLyrics = value;
27
public ISettingService SettingService { get; } = ServiceManager.GetService<ISettingService>();
28
29
partial void OnEnableCloudMusicLyricsChanged(bool value) => CloudMusicLyricsProfile.EnableCloudMusicLyrics = value;
30
31
partial void OnSwitchBackWhenPauseChanged(bool value) => CloudMusicLyricsProfile.SwitchBackWhenPause = value;
32
33
partial void OnSwitchBackTimeoutChanged(int value) => CloudMusicLyricsProfile.SwitchBackTimeout = value;
20
34
21
35
public CloudMusicLyricsToolPageViewModel()
22
36
{
@@ -27,7 +41,11 @@ public partial class CloudMusicLyricsToolPageViewModel : ServiceBaseViewModelBas
27
41
Console.WriteLine("正在搜索花再设备...");
28
42
while (!DeviceReady)
29
43
{
30
DeviceReady = Device.Initialize();
44
var ready = Device.Initialize();
45
AutoNavigationParameterService.CurrentPage?.DispatcherQueue.TryEnqueue(() =>
46
{
47
DeviceReady = ready;
48
});
31
49
await Task.Delay(500);
32
50
}
33
51
Console.WriteLine("花再设备已连接");
@@ -37,7 +55,11 @@ public partial class CloudMusicLyricsToolPageViewModel : ServiceBaseViewModelBas
37
55
Console.WriteLine("正在搜索云音乐...");
38
56
while (!CloudMusicReady)
39
57
{
40
CloudMusicReady = Reader.Initialize();
58
var ready = Reader.Initialize();
59
AutoNavigationParameterService.CurrentPage?.DispatcherQueue.TryEnqueue(() =>
60
{
61
CloudMusicReady = ready;
62
});
41
63
await Task.Delay(500);
42
64
}
43
65
Console.WriteLine("云音乐已准备就绪");
@@ -46,12 +68,15 @@ public partial class CloudMusicLyricsToolPageViewModel : ServiceBaseViewModelBas
46
68
{
47
69
while (true)
48
70
{
71
bool isClockUI = false;
72
int time = 0;
49
73
try
50
74
{
51
75
if (DeviceReady && CloudMusicReady && EnableCloudMusicLyrics)
52
76
{
53
77
Console.WriteLine("[DEBUG]设备均在线,准备进入主循环");
54
78
string lastRead = string.Empty;
79
bool scrolled = false;
55
80
while (true)
56
81
{
57
82
try
@@ -61,10 +86,33 @@ public partial class CloudMusicLyricsToolPageViewModel : ServiceBaseViewModelBas
61
86
if (Reader.TryReadLyrics(out var lyrics) && lastRead != lyrics)
62
87
{
63
88
lastRead = lyrics;
89
isClockUI = false;
90
time = 0;
91
if (scrolled)
92
{
93
Device.ShowText(string.Empty);
94
await Task.Delay(100);
95
scrolled = false;
96
}
97
Device.SetTextLayout(CloudMusicLyricsProfile.DefaultHaloPixelTextLayout);
64
98
Device.ShowText(lyrics);
99
Debug.WriteLine(lyrics.DisplayLength());
100
if (lyrics.DisplayLength() > 30)
101
{
102
scrolled = true;
103
await Task.Delay(500);
104
Device.SetTextLayout(Core.Models.HaloPixelTextLayout.ScrollRightToLeft);
105
}
65
106
Console.WriteLine($"已读取到歌词:{lyrics}");
66
107
}
67
108
await Task.Delay(50);
109
time += 50;
110
if (!isClockUI && time >= CloudMusicLyricsProfile.SwitchBackTimeout * 1000)
111
{
112
isClockUI = true;
113
Device.SetUIModel(CloudMusicLyricsProfile.DefaultHaloPixelUIModel);
114
Console.WriteLine("已切换至时钟界面");
115
}
68
116
}
69
117
catch(Exception ex)
70
118
{
@@ -46,6 +46,38 @@
46
46
<controls:SettingsCard Header="启用歌词同步" Description="启用后,网易云的歌词会实时显示在花再 Halo Pixel 音响上">
47
47
<ToggleSwitch IsOn="{x:Bind ViewModel.EnableCloudMusicLyrics, Mode=TwoWay}"/>
48
48
</controls:SettingsCard>
49
<TextBlock Text="个性化" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}"/>
50
<controls:SettingsExpander Header="暂停后切换回默认界面" Description="一段时间后自动切换回时钟界面等音响自带页面">
51
<ToggleSwitch x:Name="switchBackWhenPauseToggleSwitch" IsOn="{x:Bind ViewModel.SwitchBackWhenPause, Mode=TwoWay}"/>
52
<controls:SettingsExpander.Items>
53
<controls:SettingsCard Header="暂停延迟" Description="设置多长时间后,音响切换回默认界面" IsEnabled="{x:Bind switchBackWhenPauseToggleSwitch.IsOn, Mode=OneWay}">
54
<StackPanel Orientation="Horizontal" Spacing="20">
55
<NumberBox SpinButtonPlacementMode="Compact" Value="{x:Bind ViewModel.SwitchBackTimeout, Mode=TwoWay}"/>
56
</StackPanel>
57
</controls:SettingsCard>
58
<controls:SettingsCard Header="暂停界面" Description="设置暂停后切换回的默认界面" IsEnabled="{x:Bind switchBackWhenPauseToggleSwitch.IsOn, Mode=OneWay}">
59
<ComboBox x:Name="defaultHaloPixelUIModelComboBox" Tag="HaloPixelToolBox.Profiles.CrossVersionProfiles.CloudMusicLyricsProfile.DefaultHaloPixelUIModel">
60
<ComboBoxItem Content="时钟类" Tag="Clock"/>
61
<ComboBoxItem Content="游戏类" Tag="Game"/>
62
<ComboBoxItem Content="打工类" Tag="Work"/>
63
<ComboBoxItem Content="读书类" Tag="Read"/>
64
<ComboBoxItem Content="猫咪类" Tag="Cats"/>
65
<ComboBoxItem Content="狗狗类" Tag="Dogs"/>
66
<ComboBoxItem Content="热更类" Tag="Memes"/>
67
<ComboBoxItem Content="赛博类" Tag="Cyber"/>
68
<ComboBoxItem Content="频谱类" Tag="Waves"/>
69
</ComboBox>
70
</controls:SettingsCard>
71
</controls:SettingsExpander.Items>
72
</controls:SettingsExpander>
73
<controls:SettingsCard Header="歌词位置" Description="设置歌词的默认显示位置">
74
<ComboBox x:Name="defaultHaloPixelTextLayoutComboBox" Tag="HaloPixelToolBox.Profiles.CrossVersionProfiles.CloudMusicLyricsProfile.DefaultHaloPixelTextLayout">
75
<ComboBoxItem Content="左对齐" Tag="Left"/>
76
<ComboBoxItem Content="右对齐" Tag="Right"/>
77
<ComboBoxItem Content="居中" Tag="Center"/>
78
<ComboBoxItem Content="伸展" Tag="Stretch"/>
79
</ComboBox>
80
</controls:SettingsCard>
49
81
</StackPanel>
50
82
</ScrollView>
51
83
</Grid>
@@ -1,4 +1,6 @@
1
using HaloPixelToolBox.Core.Models;
1
2
using Microsoft.UI.Xaml.Navigation;
3
using XFEExtension.NetCore.WinUIHelper.Utilities.Helper;
2
4
3
5
namespace HaloPixelToolBox.Views;
4
6
@@ -14,6 +16,10 @@ public sealed partial class CloudMusicLyricsToolPage : Page
14
16
Current = this;
15
17
InitializeComponent();
16
18
ViewModel.AutoNavigationParameterService.Initialize(this);
19
ViewModel.SettingService.AddComboBox(defaultHaloPixelTextLayoutComboBox, ProfileHelper.GetEnumProfileSaveFunc<HaloPixelTextLayout>(), ProfileHelper.GetEnumProfileLoadFuncForComboBox());
20
ViewModel.SettingService.AddComboBox(defaultHaloPixelUIModelComboBox, ProfileHelper.GetEnumProfileSaveFunc<HaloPixelUIModel>(), ProfileHelper.GetEnumProfileLoadFuncForComboBox());
21
ViewModel.SettingService.Initialize();
22
ViewModel.SettingService.RegisterEvents();
17
23
NavigationCacheMode = NavigationCacheMode.Enabled;
18
24
}
19
25