From 07d42cedd1ce671a668706e0c2cec1fa17e40195 Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Tue, 31 Oct 2023 15:19:25 +0800
Subject: [PATCH 01/20] page style
---
.../Behavior/StartAnimationActionNoThrow.cs | 31 +
.../Control/Theme/ItemsPanelTemplate.xaml | 6 +
.../Snap.Hutao/View/Page/AchievementPage.xaml | 31 +-
.../View/Page/AnnouncementPage.xaml | 234 ++---
.../View/Page/AvatarPropertyPage.xaml | 850 ++++++++----------
.../Snap.Hutao/View/Page/CultivationPage.xaml | 52 +-
6 files changed, 602 insertions(+), 602 deletions(-)
create mode 100644 src/Snap.Hutao/Snap.Hutao/Control/Behavior/StartAnimationActionNoThrow.cs
diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Behavior/StartAnimationActionNoThrow.cs b/src/Snap.Hutao/Snap.Hutao/Control/Behavior/StartAnimationActionNoThrow.cs
new file mode 100644
index 00000000..b28641c0
--- /dev/null
+++ b/src/Snap.Hutao/Snap.Hutao/Control/Behavior/StartAnimationActionNoThrow.cs
@@ -0,0 +1,31 @@
+// Copyright (c) DGP Studio. All rights reserved.
+// Licensed under the MIT license.
+
+using CommunityToolkit.WinUI.Animations;
+using Microsoft.UI.Xaml;
+using Microsoft.Xaml.Interactivity;
+
+namespace Snap.Hutao.Control.Behavior;
+
+[DependencyProperty("Animation", typeof(AnimationSet))]
+[DependencyProperty("TargetObject", typeof(UIElement))]
+internal sealed partial class StartAnimationActionNoThrow : DependencyObject, IAction
+{
+ ///
+ public object Execute(object sender, object parameter)
+ {
+ if (Animation is not null)
+ {
+ if (TargetObject is not null)
+ {
+ Animation.Start(TargetObject);
+ }
+ else
+ {
+ Animation.Start(sender as UIElement);
+ }
+ }
+
+ return default!;
+ }
+}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml b/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
index 46d10041..d20b99d6 100644
--- a/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
@@ -20,4 +20,10 @@
Columns="5"
RowSpacing="4"/>
+
+
+
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/AchievementPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/AchievementPage.xaml
index 9aa68812..2677c78a 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/AchievementPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/AchievementPage.xaml
@@ -164,6 +164,21 @@
+
+
+
+
@@ -282,6 +297,7 @@
PaneBackground="{x:Null}">
-
-
-
@@ -301,16 +312,10 @@
-
-
-
-
+ SelectionMode="None"/>
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/AnnouncementPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/AnnouncementPage.xaml
index b5f3f6f3..cd672dbb 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/AnnouncementPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/AnnouncementPage.xaml
@@ -29,9 +29,126 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -184,7 +189,6 @@
-
@@ -223,11 +227,11 @@
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/AvatarPropertyPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/AvatarPropertyPage.xaml
index 8aef9263..f3295f40 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/AvatarPropertyPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/AvatarPropertyPage.xaml
@@ -58,6 +58,382 @@
GridValue="{x:Bind GridImageExportPanel}"
ListValue="{x:Bind ListImageExportPanel}"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -110,12 +486,10 @@
-
-
-
-
-
-
+
@@ -123,117 +497,9 @@
Margin="16,16,4,-8"
cwa:ItemsReorderAnimation.Duration="0:0:0.1"
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
+ ItemTemplate="{StaticResource AvatarGridViewTemplate}"
ItemsSource="{Binding Summary.Avatars}"
- SelectedItem="{Binding SelectedAvatar, Mode=TwoWay}">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ SelectedItem="{Binding SelectedAvatar, Mode=TwoWay}"/>
@@ -245,66 +511,10 @@
OpenPaneLength="{StaticResource CompatSplitViewOpenPaneLength2}"
PaneBackground="Transparent">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -449,12 +659,8 @@
Grid.Row="1"
Grid.Column="0"
Margin="16"
+ ItemsPanel="{StaticResource HorizontalStackPanelTemplate}"
ItemsSource="{Binding SelectedAvatar.Constellations}">
-
-
-
-
-
@@ -598,221 +742,19 @@
HorizontalContentAlignment="Stretch"
Background="{x:Null}"
Header="{shcm:ResourceString Name=ViewPageAvatarPropertyHeader}">
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ ItemTemplate="{StaticResource AvatarPropertyTemplate}"
+ ItemsSource="{Binding SelectedAvatar.Properties}"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml
index ba5c34e4..0dea4549 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml
@@ -20,27 +20,39 @@
mc:Ignorable="d">
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
- 0.4
-
-
- 1
-
-
+
+
+ 0.4
+
+
+ 1
+
+
-
-
-
-
-
-
-
+
+
@@ -176,7 +188,7 @@
Margin="6,0,0,0"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
- Background="{Binding IsToday, Converter={StaticResource BoolToBrushSelector}}"
+ Background="{Binding IsToday, Converter={ThemeResource BoolToBrushSelector}}"
Command="{Binding Path=DataContext.FinishStateCommand, Source={StaticResource BindingProxy}}"
CommandParameter="{Binding}"
Style="{StaticResource ButtonRevealStyle}">
From 10ba927136c37383699a0546a2784e94180ddee7 Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Tue, 31 Oct 2023 16:45:24 +0800
Subject: [PATCH 02/20] fix #1059
---
.../Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml
index a826c6da..d6bdc3e8 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml
@@ -28,7 +28,7 @@
Date: Wed, 1 Nov 2023 10:45:47 +0800
Subject: [PATCH 03/20] fix dailynote webhook error
---
src/Snap.Hutao/Snap.Hutao/App.xaml | 1 +
.../Snap.Hutao/Control/Theme/FlyoutStyle.xaml | 9 +
.../Model/Entity/SettingEntry.Constant.cs | 5 +
.../Service/DailyNote/DailyNoteOptions.cs | 4 +-
src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj | 7 +
.../Snap.Hutao/View/Page/CultivationPage.xaml | 411 ++++++++----------
.../Snap.Hutao/View/Page/DailyNotePage.xaml | 56 +--
7 files changed, 236 insertions(+), 257 deletions(-)
create mode 100644 src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
diff --git a/src/Snap.Hutao/Snap.Hutao/App.xaml b/src/Snap.Hutao/Snap.Hutao/App.xaml
index dd980061..590d52a5 100644
--- a/src/Snap.Hutao/Snap.Hutao/App.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/App.xaml
@@ -12,6 +12,7 @@
+
diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml b/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
new file mode 100644
index 00000000..801b8137
--- /dev/null
+++ b/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
@@ -0,0 +1,9 @@
+
+
+
+
diff --git a/src/Snap.Hutao/Snap.Hutao/Model/Entity/SettingEntry.Constant.cs b/src/Snap.Hutao/Snap.Hutao/Model/Entity/SettingEntry.Constant.cs
index e0884f67..964cd127 100644
--- a/src/Snap.Hutao/Snap.Hutao/Model/Entity/SettingEntry.Constant.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Model/Entity/SettingEntry.Constant.cs
@@ -48,6 +48,11 @@ internal sealed partial class SettingEntry
///
public const string DailyNoteSilentWhenPlayingGame = "DailyNote.SilentWhenPlayingGame";
+ ///
+ /// 实时便笺 WebhookUrl
+ ///
+ public const string DailyNoteWebhookUrl = "DailyNote.WebhookUrl";
+
///
/// 启动游戏 独占全屏
///
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/DailyNote/DailyNoteOptions.cs b/src/Snap.Hutao/Snap.Hutao/Service/DailyNote/DailyNoteOptions.cs
index 215137e8..3786ef2e 100644
--- a/src/Snap.Hutao/Snap.Hutao/Service/DailyNote/DailyNoteOptions.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Service/DailyNote/DailyNoteOptions.cs
@@ -126,7 +126,7 @@ internal sealed partial class DailyNoteOptions : DbStoreOptions
public string? WebhookUrl
{
- get => GetOption(ref webhookUrl, SettingEntry.DailyNoteSilentWhenPlayingGame);
- set => SetOption(ref webhookUrl, SettingEntry.DailyNoteSilentWhenPlayingGame, value);
+ get => GetOption(ref webhookUrl, SettingEntry.DailyNoteWebhookUrl);
+ set => SetOption(ref webhookUrl, SettingEntry.DailyNoteWebhookUrl, value);
}
}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj b/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj
index 7782e62a..3b267b78 100644
--- a/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj
+++ b/src/Snap.Hutao/Snap.Hutao/Snap.Hutao.csproj
@@ -79,6 +79,7 @@
+
@@ -307,6 +308,12 @@
+
+
+ MSBuild:Compile
+
+
+
MSBuild:Compile
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml
index 0dea4549..538ed33d 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml
@@ -52,6 +52,189 @@
x:Key="BoolToStyleSelector"
FalseValue="{StaticResource BodyTextBlockStyle}"
TrueValue="{StaticResource BaseTextBlockStyle}"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -97,6 +280,7 @@
@@ -107,158 +291,13 @@
MinItemWidth="300"
MinRowSpacing="-4"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Visible
-
-
-
-
-
-
-
-
-
- Collapsed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -269,42 +308,6 @@
MinItemWidth="300"
MinRowSpacing="-4"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -348,51 +351,15 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/DailyNotePage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/DailyNotePage.xaml
index 9ccec67a..97b6eb56 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/DailyNotePage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/DailyNotePage.xaml
@@ -27,6 +27,23 @@
+
+
+
+
+
+
+
@@ -46,54 +63,27 @@
Label="{shcm:ResourceString Name=ViewPageDailyNoteVerify}">
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
+
From 5943b1a1fb1d139d120204a7d26b9f16d1d99326 Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Wed, 1 Nov 2023 13:46:50 +0800
Subject: [PATCH 04/20] impl #886
---
.../Snap.Hutao/Control/Theme/FlyoutStyle.xaml | 3 +
.../Snap.Hutao/Resource/Localization/SH.resx | 3 +
.../Snap.Hutao/View/Page/CultivationPage.xaml | 5 +-
.../Snap.Hutao/View/Page/DailyNotePage.xaml | 719 +++++++++---------
.../Snap.Hutao/View/Page/GachaLogPage.xaml | 254 ++++---
5 files changed, 483 insertions(+), 501 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml b/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
index 801b8137..74d9ca6f 100644
--- a/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
@@ -6,4 +6,7 @@
+
diff --git a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
index 4dbcbd3e..3393d0f8 100644
--- a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
+++ b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
@@ -1796,6 +1796,9 @@
输入
+
+ 从胡桃云恢复祈愿记录
+
刷新
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml
index 538ed33d..33d02646 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/CultivationPage.xaml
@@ -134,10 +134,7 @@
Margin="8,0,0,0"
VerticalAlignment="Center"
Text="{Binding Name}"/>
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -175,7 +513,10 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Visible
-
-
-
-
-
-
-
-
-
- Collapsed
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/GachaLogPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/GachaLogPage.xaml
index 76fe9c82..ec1d56b2 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/GachaLogPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/GachaLogPage.xaml
@@ -7,6 +7,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mxi="using:Microsoft.Xaml.Interactivity"
+ xmlns:mxic="using:Microsoft.Xaml.Interactions.Core"
xmlns:shc="using:Snap.Hutao.Control"
xmlns:shcb="using:Snap.Hutao.Control.Behavior"
xmlns:shci="using:Snap.Hutao.Control.Image"
@@ -21,6 +22,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 16
+ 0
+ 0
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 16
- 0
- 0
- 0
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
From eec47b72c769ea67a4fdebbc63f5da876b65595f Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Wed, 1 Nov 2023 15:26:36 +0800
Subject: [PATCH 05/20] fix #1061
---
.../Control/Theme/ItemsPanelTemplate.xaml | 3 +
.../Model/Entity/SettingEntry.Constant.cs | 6 +
.../Snap.Hutao/Service/Game/LaunchOptions.cs | 21 +
.../Snap.Hutao/View/Page/GachaLogPage.xaml | 391 ++++++------------
.../Snap.Hutao/View/Page/LaunchGamePage.xaml | 76 ++--
5 files changed, 190 insertions(+), 307 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml b/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
index d20b99d6..70b5091f 100644
--- a/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
@@ -14,6 +14,9 @@
+
+
+
public const string LaunchScreenWidth = "Launch.ScreenWidth";
+ public const string LaunchIsScreenWidthEnabled = "Launch.IsScreenWidthEnabled";
+
///
/// 启动游戏 高度
///
public const string LaunchScreenHeight = "Launch.ScreenHeight";
+ public const string LaunchIsScreenHeightEnabled = "Launch.IsScreenHeightEnabled";
+
///
/// 启动游戏 解锁帧率
///
@@ -93,6 +97,8 @@ internal sealed partial class SettingEntry
///
public const string LaunchMonitor = "Launch.Monitor";
+ public const string LaunchIsMonitorEnabled = "Launch.IsMonitorEnabled";
+
///
/// 启动游戏 多倍启动
///
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchOptions.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchOptions.cs
index 71fe1fcd..c086cd15 100644
--- a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchOptions.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchOptions.cs
@@ -27,10 +27,13 @@ internal sealed class LaunchOptions : DbStoreOptions
private bool? isBorderless;
private bool? isExclusive;
private int? screenWidth;
+ private bool? isScreenWidthEnabled;
private int? screenHeight;
+ private bool? isScreenHeightEnabled;
private bool? unlockFps;
private int? targetFps;
private NameValue? monitor;
+ private bool? isMonitorEnabled;
///
/// 构造一个新的启动游戏选项
@@ -83,6 +86,12 @@ internal sealed class LaunchOptions : DbStoreOptions
set => SetOption(ref screenWidth, SettingEntry.LaunchScreenWidth, value);
}
+ public bool IsScreenWidthEnabled
+ {
+ get => GetOption(ref isScreenWidthEnabled, SettingEntry.LaunchIsScreenWidthEnabled, true);
+ set => SetOption(ref isScreenWidthEnabled, SettingEntry.LaunchIsScreenWidthEnabled, value);
+ }
+
///
/// 屏幕高度
///
@@ -92,6 +101,12 @@ internal sealed class LaunchOptions : DbStoreOptions
set => SetOption(ref screenHeight, SettingEntry.LaunchScreenHeight, value);
}
+ public bool IsScreenHeightEnabled
+ {
+ get => GetOption(ref isScreenHeightEnabled, SettingEntry.LaunchIsScreenHeightEnabled, true);
+ set => SetOption(ref isScreenHeightEnabled, SettingEntry.LaunchIsScreenHeightEnabled, value);
+ }
+
///
/// 是否全屏
///
@@ -131,6 +146,12 @@ internal sealed class LaunchOptions : DbStoreOptions
}
}
+ public bool IsMonitorEnabled
+ {
+ get => GetOption(ref isMonitorEnabled, SettingEntry.LaunchIsMonitorEnabled, true);
+ set => SetOption(ref isMonitorEnabled, SettingEntry.LaunchIsMonitorEnabled, value);
+ }
+
private static void InitializeMonitors(List> monitors)
{
// This list can't use foreach
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/GachaLogPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/GachaLogPage.xaml
index ec1d56b2..0f12787f 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/GachaLogPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/GachaLogPage.xaml
@@ -137,6 +137,89 @@
IsLoading="{Binding HutaoCloudViewModel.IsInitialized, Converter={StaticResource BoolNegationConverter}}"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -232,100 +315,10 @@
OpenPaneLength="323"
PaneBackground="Transparent">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -347,91 +340,35 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -444,55 +381,19 @@
Margin="0,16,0,8"
Style="{StaticResource BaseTextBlockStyle}"
Text="{shcm:ResourceString Name=ViewControlStatisticsCardOrangeText}"/>
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -503,82 +404,28 @@
Margin="0,16,0,8"
Style="{StaticResource BaseTextBlockStyle}"
Text="{shcm:ResourceString Name=ViewControlStatisticsCardOrangeText}"/>
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml
index 74de57d6..fe5be18d 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/LaunchGamePage.xaml
@@ -26,6 +26,14 @@
Collapsed
+
+
+
+
-
+
+
+
+
-
+
+
+
+
-
+
+
+
+
@@ -266,33 +286,19 @@
DataContext="{Binding GameResource.PreDownloadGame.Latest, Mode=OneWay}"
Header="{shcm:ResourceString Name=ViewPageLaunchGameResourcePreDownloadHeader}"
Visibility="{Binding FallbackValue={StaticResource VisibilityCollapsed}, Converter={StaticResource EmptyObjectToVisibilityConverter}}"/>
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
+
From 7cad996902825a3c50aa383c3471a31786562f4f Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Wed, 1 Nov 2023 15:28:44 +0800
Subject: [PATCH 06/20] process cmdline #1061
---
src/Snap.Hutao/Snap.Hutao/Service/Game/ProcessInterop.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/ProcessInterop.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/ProcessInterop.cs
index a1a4af71..15aafcd4 100644
--- a/src/Snap.Hutao/Snap.Hutao/Service/Game/ProcessInterop.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/ProcessInterop.cs
@@ -34,9 +34,9 @@ internal static class ProcessInterop
.AppendIf("-popupwindow", options.IsBorderless)
.AppendIf("-window-mode", options.IsExclusive, "exclusive")
.Append("-screen-fullscreen", options.IsFullScreen ? 1 : 0)
- .Append("-screen-width", options.ScreenWidth)
- .Append("-screen-height", options.ScreenHeight)
- .Append("-monitor", options.Monitor.Value)
+ .AppendIf("-screen-width", options.IsScreenWidthEnabled, options.ScreenWidth)
+ .AppendIf("-screen-height", options.IsScreenHeightEnabled, options.ScreenHeight)
+ .AppendIf("-monitor", options.IsMonitorEnabled, options.Monitor.Value)
.ToString();
return new()
From c8e8213df6424cdb61cb7b72804b69336f8bc554 Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Wed, 1 Nov 2023 15:56:22 +0800
Subject: [PATCH 07/20] code style
---
.../Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml | 2 +-
src/Snap.Hutao/Snap.Hutao/View/Page/AvatarPropertyPage.xaml | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml b/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
index 70b5091f..a7e91aa2 100644
--- a/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
@@ -11,7 +11,7 @@
-
+
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/AvatarPropertyPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/AvatarPropertyPage.xaml
index f3295f40..cadd6d8b 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/AvatarPropertyPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/AvatarPropertyPage.xaml
@@ -157,7 +157,7 @@
Margin="6,0,0,6"
VerticalAlignment="Bottom"
ItemTemplate="{StaticResource AvatarGridViewSkillTemplate}"
- ItemsPanel="{StaticResource HorizontalStackPanelTemplate}"
+ ItemsPanel="{StaticResource HorizontalStackPanelSpacing0Template}"
ItemsSource="{Binding Skills}"/>
@@ -659,7 +659,7 @@
Grid.Row="1"
Grid.Column="0"
Margin="16"
- ItemsPanel="{StaticResource HorizontalStackPanelTemplate}"
+ ItemsPanel="{StaticResource HorizontalStackPanelSpacing0Template}"
ItemsSource="{Binding SelectedAvatar.Constellations}">
From 70f30edd7c49e584f741ac7fbe6cf257d8a2e221 Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Wed, 1 Nov 2023 17:03:00 +0800
Subject: [PATCH 08/20] xaml style rework
---
.../Snap.Hutao/Control/Theme/FlyoutStyle.xaml | 10 +-
.../Control/Theme/ItemsPanelTemplate.xaml | 6 +
.../Control/Theme/TransitionCollection.xaml | 6 +
.../Snap.Hutao/Resource/Localization/SH.resx | 3 +
.../Snap.Hutao/View/InfoBarView.xaml | 6 +-
src/Snap.Hutao/Snap.Hutao/View/MainView.xaml | 13 +-
.../Snap.Hutao/View/Page/WikiAvatarPage.xaml | 326 ++++++++----------
.../Snap.Hutao/View/Page/WikiMonsterPage.xaml | 108 +++---
.../Snap.Hutao/View/Page/WikiWeaponPage.xaml | 137 ++++----
src/Snap.Hutao/Snap.Hutao/View/TitleView.xaml | 3 +-
10 files changed, 300 insertions(+), 318 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml b/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
index 74d9ca6f..bd38511d 100644
--- a/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
@@ -3,10 +3,16 @@
-
-
diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml b/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
index a7e91aa2..28a32452 100644
--- a/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/Control/Theme/ItemsPanelTemplate.xaml
@@ -17,6 +17,12 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
index 3393d0f8..ceda545a 100644
--- a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
+++ b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
@@ -2489,6 +2489,9 @@
上传数据
+
+ 自动连点
+
工具
diff --git a/src/Snap.Hutao/Snap.Hutao/View/InfoBarView.xaml b/src/Snap.Hutao/Snap.Hutao/View/InfoBarView.xaml
index c2b4e239..cb5f495f 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/InfoBarView.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/InfoBarView.xaml
@@ -12,11 +12,9 @@
MaxWidth="640"
Margin="32,48,32,32"
VerticalAlignment="Bottom"
+ ItemContainerTransitions="{StaticResource RepositionThemeTransition}"
ItemsSource="{x:Bind InfoBars}"
- Visibility="{Binding ElementName=VisibilityButton, Path=IsChecked, Converter={StaticResource BoolToVisibilityConverter}}">
-
-
-
+ Visibility="{x:Bind VisibilityButton.IsChecked, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
diff --git a/src/Snap.Hutao/Snap.Hutao/View/MainView.xaml b/src/Snap.Hutao/Snap.Hutao/View/MainView.xaml
index a652374d..0b2f163c 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/MainView.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/MainView.xaml
@@ -17,7 +17,7 @@
-
-
-
-
-
-
-
+
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/WikiAvatarPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/WikiAvatarPage.xaml
index 1fa863ef..3b929193 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/WikiAvatarPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/WikiAvatarPage.xaml
@@ -58,6 +58,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+
+
+
+
+
+ 1
+
+
+
+
+
+
+
+ 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -100,12 +226,10 @@
Icon="{shcm:FontIcon Glyph=}"
Label="{shcm:ResourceString Name=ViewPageWiKiGeneralAddToDevPlanButtonLabel}"/>
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
@@ -290,16 +394,9 @@
Text="{shcm:ResourceString Name=ViewPageWiKiAvatarAscensionMaterialsHeader}"/>
-
-
-
-
-
-
-
-
+ SelectionMode="None"/>
-
-
-
-
-
-
-
-
+ SelectionMode="None"/>
-
-
-
-
-
-
-
-
+ SelectionMode="None"/>
-
-
-
-
-
-
- 0
-
-
-
-
-
-
-
- 1
-
-
-
-
-
-
-
- 2
-
-
-
-
-
-
-
-
-
-
-
-
+ SelectionMode="None"/>
-
@@ -513,35 +543,10 @@
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
Header="{shcm:ResourceString Name=ViewPageWiKiAvatarCostumeHeader}">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
@@ -597,23 +582,16 @@
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left"
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
+ ItemTemplate="{StaticResource AvatarGridTemplate}"
ItemsSource="{Binding Avatars}"
SelectedItem="{Binding Selected, Mode=TwoWay}"
SelectionMode="Single">
-
-
-
-
-
-
-
-
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/WikiMonsterPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/WikiMonsterPage.xaml
index f9434cd6..9624fac5 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/WikiMonsterPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/WikiMonsterPage.xaml
@@ -22,6 +22,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -66,33 +107,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -126,27 +147,16 @@
HorizontalContentAlignment="Stretch"
BaseValueInfo="{Binding BaseValueInfo, Mode=OneWay}"
IsPromoteVisible="False"/>
-
+
0
0
0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Visibility="{Binding Selected.DropsView, Converter={StaticResource EmptyObjectToVisibilityConverter}}"/>
@@ -179,24 +182,13 @@
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left"
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
+ ItemTemplate="{StaticResource MonsterGridTemplate}"
ItemsSource="{Binding Monsters}"
SelectedItem="{Binding Selected, Mode=TwoWay}"
SelectionMode="Single">
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Page/WikiWeaponPage.xaml b/src/Snap.Hutao/Snap.Hutao/View/Page/WikiWeaponPage.xaml
index b02bcd8c..683c7c0d 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Page/WikiWeaponPage.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Page/WikiWeaponPage.xaml
@@ -30,6 +30,58 @@
PreferredSelectedIndex="13"
Source="{Binding Converter={StaticResource PropertyDescriptor}}"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -70,12 +122,10 @@
Icon="{shcm:FontIcon Glyph=}"
Label="{shcm:ResourceString Name=ViewPageWiKiGeneralAddToDevPlanButtonLabel}"/>
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -186,39 +215,18 @@
Text="{shcm:ResourceString Name=ViewPageWiKiAvatarAscensionMaterialsHeader}"/>
-
-
-
-
-
-
-
-
+ SelectionMode="None"/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
+ SelectionMode="None"/>
@@ -251,19 +252,13 @@
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Left"
ItemContainerStyle="{StaticResource LargeGridViewItemStyle}"
+ ItemTemplate="{StaticResource WeaponGridTemplate}"
ItemsSource="{Binding Weapons}"
SelectedItem="{Binding Selected, Mode=TwoWay}"
SelectionMode="Single">
-
-
-
-
-
-
-
diff --git a/src/Snap.Hutao/Snap.Hutao/View/TitleView.xaml b/src/Snap.Hutao/Snap.Hutao/View/TitleView.xaml
index fc883379..b7b25758 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/TitleView.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/TitleView.xaml
@@ -4,6 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:shcm="using:Snap.Hutao.Control.Markup"
Height="44"
VerticalAlignment="Top"
mc:Ignorable="d">
@@ -38,7 +39,7 @@
+ Text="{shcm:ResourceString Name=ViewTitleAutoClicking}"/>
From 4b2c82db629029f992934eb2a37ec988e8240ca2 Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 09:06:56 +0800
Subject: [PATCH 09/20] fix xaml parsing failed
---
src/Snap.Hutao/Snap.Hutao/View/InfoBarView.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/View/InfoBarView.xaml b/src/Snap.Hutao/Snap.Hutao/View/InfoBarView.xaml
index cb5f495f..20c46cb6 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/InfoBarView.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/InfoBarView.xaml
@@ -12,7 +12,7 @@
MaxWidth="640"
Margin="32,48,32,32"
VerticalAlignment="Bottom"
- ItemContainerTransitions="{StaticResource RepositionThemeTransition}"
+ ItemContainerTransitions="{StaticResource RepositionThemeTransitions}"
ItemsSource="{x:Bind InfoBars}"
Visibility="{x:Bind VisibilityButton.IsChecked, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
From dc9278eb4f67f9f5e680dc945da62e5d99f1e4c2 Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 09:42:08 +0800
Subject: [PATCH 10/20] fix verifycode crash
---
.../Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml | 2 +-
.../View/Dialog/HutaoPassportResetPasswordDialog.xaml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml
index d6bdc3e8..86e7e68e 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml
@@ -28,7 +28,7 @@
Date: Thu, 2 Nov 2023 09:48:22 +0800
Subject: [PATCH 11/20] clear username & password after logout
---
.../Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
index eb6bee68..3ae1ad21 100644
--- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
+++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
@@ -121,6 +121,8 @@ internal sealed partial class HutaoPassportViewModel : Abstraction.ViewModel
private void LogoutAsync()
{
hutaoUserOptions.LogoutOrUnregister();
+ LocalSetting.Set(SettingKeys.PassportUserName, string.Empty);
+ LocalSetting.Set(SettingKeys.PassportPassword, string.Empty);
}
[Command("ResetPasswordCommand")]
From 3ac0be42202177f3c81e1a475dfcccd9f78dbc7f Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 10:07:20 +0800
Subject: [PATCH 12/20] fix unregister passport
---
.../Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs | 2 +-
src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs | 2 ++
src/Snap.Hutao/Snap.Hutao/Web/Hutao/HutaoResponse.cs | 1 -
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
index 3ae1ad21..019a4e7b 100644
--- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
+++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
@@ -78,7 +78,7 @@ internal sealed partial class HutaoPassportViewModel : Abstraction.ViewModel
return;
}
- Response response = await homaPassportClient.UnregisterAsync(username, password).ConfigureAwait(false);
+ HutaoResponse response = await homaPassportClient.UnregisterAsync(username, password).ConfigureAwait(false);
if (response.IsOk())
{
diff --git a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
index 8c813881..0ae0796e 100644
--- a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
@@ -106,6 +106,8 @@ internal sealed partial class HomaPassportClient
.SetRequestUri(HutaoEndpoints.PassportCancel)
.PostJson(data);
+ await builder.TrySetTokenAsync(hutaoUserOptions).ConfigureAwait(false);
+
HutaoResponse? resp = await builder
.TryCatchSendAsync(httpClient, logger, token)
.ConfigureAwait(false);
diff --git a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HutaoResponse.cs b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HutaoResponse.cs
index 37b54b81..56397a7f 100644
--- a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HutaoResponse.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HutaoResponse.cs
@@ -1,7 +1,6 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
-using Snap.Hutao.Service.Notification;
using System.Runtime.CompilerServices;
namespace Snap.Hutao.Web.Hutao;
From c6435f30eb31a9a55c58aef2e835f7ffecfcc47e Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 10:26:27 +0800
Subject: [PATCH 13/20] add verify for cancel registration
---
.../HutaoPassportRegisterDialog.xaml.cs | 2 +-
.../HutaoPassportResetPasswordDialog.xaml.cs | 2 +-
.../Dialog/HutaoPassportUnregisterDialog.xaml | 13 ++++++++++
.../HutaoPassportUnregisterDialog.xaml.cs | 26 +++++++++++++++++++
.../Web/Hutao/HomaPassportClient.cs | 20 +++++++-------
.../Web/Hutao/VerifyCodeRequestType.cs | 12 +++++++++
6 files changed, 64 insertions(+), 11 deletions(-)
create mode 100644 src/Snap.Hutao/Snap.Hutao/Web/Hutao/VerifyCodeRequestType.cs
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml.cs b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml.cs
index e9801fcb..b2dbb09f 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml.cs
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml.cs
@@ -48,7 +48,7 @@ internal sealed partial class HutaoPassportRegisterDialog : ContentDialog
return;
}
- HutaoResponse response = await homaPassportClient.VerifyAsync(UserName, false).ConfigureAwait(false);
+ HutaoResponse response = await homaPassportClient.RequestVerifyAsync(UserName, VerifyCodeRequestType.Registration).ConfigureAwait(false);
infoBarService.Information(response.GetLocalizationMessage());
}
}
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml.cs b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml.cs
index c88a0a93..480a71ce 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml.cs
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml.cs
@@ -48,7 +48,7 @@ internal sealed partial class HutaoPassportResetPasswordDialog : ContentDialog
return;
}
- HutaoResponse response = await homaPassportClient.VerifyAsync(UserName, false).ConfigureAwait(false);
+ HutaoResponse response = await homaPassportClient.RequestVerifyAsync(UserName, VerifyCodeRequestType.ResetPassword).ConfigureAwait(false);
infoBarService.Information(response.GetLocalizationMessage());
}
}
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml
index 8b57b94c..7e36d3d6 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml
@@ -22,8 +22,21 @@
Margin="0,16,0,0"
PlaceholderText="{shcm:ResourceString Name=ViewPageHutaoPassportUserNameHint}"
Text="{x:Bind UserName, Mode=TwoWay}"/>
+
+
+
+
+
+
+
+
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml.cs b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml.cs
index bfde38a5..5fd8379c 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml.cs
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml.cs
@@ -1,14 +1,20 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
+using CommunityToolkit.Common;
using Microsoft.UI.Xaml.Controls;
+using Snap.Hutao.Service.Notification;
+using Snap.Hutao.Web.Hutao;
namespace Snap.Hutao.View.Dialog;
[DependencyProperty("UserName", typeof(string))]
[DependencyProperty("Password", typeof(string))]
+[DependencyProperty("VerifyCode", typeof(string))]
internal sealed partial class HutaoPassportUnregisterDialog : ContentDialog
{
+ private readonly HomaPassportClient homaPassportClient;
+ private readonly IInfoBarService infoBarService;
private readonly ITaskContext taskContext;
public HutaoPassportUnregisterDialog(IServiceProvider serviceProvider)
@@ -16,6 +22,8 @@ internal sealed partial class HutaoPassportUnregisterDialog : ContentDialog
InitializeComponent();
taskContext = serviceProvider.GetRequiredService();
+ homaPassportClient = serviceProvider.GetRequiredService();
+ infoBarService = serviceProvider.GetRequiredService();
}
public async ValueTask> GetInputAsync()
@@ -25,4 +33,22 @@ internal sealed partial class HutaoPassportUnregisterDialog : ContentDialog
return new(result is ContentDialogResult.Primary, (UserName, Password));
}
+
+ [Command("VerifyCommand")]
+ private async Task VerifyAsync()
+ {
+ if (string.IsNullOrEmpty(UserName))
+ {
+ return;
+ }
+
+ if (!UserName.IsEmail())
+ {
+ infoBarService.Warning(SH.ViewModelHutaoPassportEmailNotValidHint);
+ return;
+ }
+
+ HutaoResponse response = await homaPassportClient.RequestVerifyAsync(UserName, VerifyCodeRequestType.CancelRegistration).ConfigureAwait(false);
+ infoBarService.Information(response.GetLocalizationMessage());
+ }
}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
index 0ae0796e..15b12558 100644
--- a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
@@ -40,21 +40,23 @@ internal sealed partial class HomaPassportClient
private readonly HutaoUserOptions hutaoUserOptions;
private readonly HttpClient httpClient;
- ///
- /// 异步获取验证码
- ///
- /// 邮箱
- /// 是否重置账号密码
- /// 取消令牌
- /// 响应
- public async ValueTask VerifyAsync(string email, bool isResetPassword, CancellationToken token = default)
+ public async ValueTask RequestVerifyAsync(string email, VerifyCodeRequestType requestType, CancellationToken token = default)
{
Dictionary data = new()
{
["UserName"] = Encrypt(email),
- ["IsResetPassword"] = isResetPassword,
};
+ if (requestType.HasFlag(VerifyCodeRequestType.ResetPassword))
+ {
+ data["IsResetPassword"] = true;
+ }
+
+ if (requestType.HasFlag(VerifyCodeRequestType.CancelRegistration))
+ {
+ data["IsCancelRegistration"] = true;
+ }
+
HttpRequestMessageBuilder builder = httpRequestMessageBuilderFactory.Create()
.SetRequestUri(HutaoEndpoints.PassportVerify)
.PostJson(data);
diff --git a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/VerifyCodeRequestType.cs b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/VerifyCodeRequestType.cs
new file mode 100644
index 00000000..877ad67b
--- /dev/null
+++ b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/VerifyCodeRequestType.cs
@@ -0,0 +1,12 @@
+// Copyright (c) DGP Studio. All rights reserved.
+// Licensed under the MIT license.
+
+namespace Snap.Hutao.Web.Hutao;
+
+[Flags]
+internal enum VerifyCodeRequestType
+{
+ Registration = 0b0000,
+ ResetPassword = 0b0001,
+ CancelRegistration = 0b0010,
+}
\ No newline at end of file
From df019da8919bcd92af520d9bffce5ee1bb1586fd Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 10:42:55 +0800
Subject: [PATCH 14/20] complete cancel registration
---
.../View/Dialog/HutaoPassportUnregisterDialog.xaml.cs | 4 ++--
.../ViewModel/Setting/HutaoPassportViewModel.cs | 8 ++++----
src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs | 3 ++-
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml.cs b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml.cs
index 5fd8379c..b3c8b380 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml.cs
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml.cs
@@ -26,12 +26,12 @@ internal sealed partial class HutaoPassportUnregisterDialog : ContentDialog
infoBarService = serviceProvider.GetRequiredService();
}
- public async ValueTask> GetInputAsync()
+ public async ValueTask> GetInputAsync()
{
await taskContext.SwitchToMainThreadAsync();
ContentDialogResult result = await ShowAsync();
- return new(result is ContentDialogResult.Primary, (UserName, Password));
+ return new(result is ContentDialogResult.Primary, (UserName, Password, VerifyCode));
}
[Command("VerifyCommand")]
diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
index 019a4e7b..f63a5a4e 100644
--- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
+++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
@@ -67,18 +67,18 @@ internal sealed partial class HutaoPassportViewModel : Abstraction.ViewModel
private async Task UnregisterAsync()
{
HutaoPassportUnregisterDialog dialog = await contentDialogFactory.CreateInstanceAsync().ConfigureAwait(false);
- ValueResult result = await dialog.GetInputAsync().ConfigureAwait(false);
+ ValueResult result = await dialog.GetInputAsync().ConfigureAwait(false);
if (result.IsOk)
{
- (string username, string password) = result.Value;
+ (string username, string password, string verifyCode) = result.Value;
- if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
+ if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(verifyCode))
{
return;
}
- HutaoResponse response = await homaPassportClient.UnregisterAsync(username, password).ConfigureAwait(false);
+ HutaoResponse response = await homaPassportClient.UnregisterAsync(username, password, verifyCode).ConfigureAwait(false);
if (response.IsOk())
{
diff --git a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
index 15b12558..bd219590 100644
--- a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
@@ -96,12 +96,13 @@ internal sealed partial class HomaPassportClient
return HutaoResponse.DefaultIfNull(resp);
}
- public async ValueTask UnregisterAsync(string email, string password, CancellationToken token = default)
+ public async ValueTask UnregisterAsync(string email, string password, string verifyCode, CancellationToken token = default)
{
Dictionary data = new()
{
["UserName"] = Encrypt(email),
["Password"] = Encrypt(password),
+ ["VerifyCode"] = Encrypt(verifyCode),
};
HttpRequestMessageBuilder builder = httpRequestMessageBuilderFactory.Create()
From b753728b7e0315c4e64a558f08905ce207b865fe Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 11:12:26 +0800
Subject: [PATCH 15/20] verify code request set token
---
src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx | 6 ++++++
src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs | 2 ++
2 files changed, 8 insertions(+)
diff --git a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
index ceda545a..27e1b0e2 100644
--- a/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
+++ b/src/Snap.Hutao/Snap.Hutao/Resource/Localization/SH.resx
@@ -539,9 +539,15 @@
验证失败
+
+ 验证请求失败,不是当前登录的账号
+
验证码已发送至邮箱
+
+ 验证请求失败,当前邮箱已被注册
+
验证请求过快,请 1 分钟后再试
diff --git a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
index bd219590..f2e52f9f 100644
--- a/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Web/Hutao/HomaPassportClient.cs
@@ -61,6 +61,8 @@ internal sealed partial class HomaPassportClient
.SetRequestUri(HutaoEndpoints.PassportVerify)
.PostJson(data);
+ await builder.TrySetTokenAsync(hutaoUserOptions).ConfigureAwait(false);
+
HutaoResponse? resp = await builder
.TryCatchSendAsync(httpClient, logger, token)
.ConfigureAwait(false);
From 0e7afa8efbafd1c426a2d2638f09036aa74d15be Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 11:30:00 +0800
Subject: [PATCH 16/20] clear username & password after cancel registration
---
.../Service/Hutao/HutaoUserOptions.cs | 9 ++++++++-
.../Service/Hutao/HutaoUserService.cs | 2 +-
.../View/Dialog/HutaoPassportLoginDialog.xaml | 6 +++++-
.../Dialog/HutaoPassportRegisterDialog.xaml | 8 ++++++--
.../HutaoPassportResetPasswordDialog.xaml | 8 ++++++--
.../Dialog/HutaoPassportUnregisterDialog.xaml | 4 +++-
.../ViewModel/Setting/HutaoPassportViewModel.cs | 17 +++--------------
7 files changed, 32 insertions(+), 22 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Hutao/HutaoUserOptions.cs b/src/Snap.Hutao/Snap.Hutao/Service/Hutao/HutaoUserOptions.cs
index 2dacefe0..f61058ff 100644
--- a/src/Snap.Hutao/Snap.Hutao/Service/Hutao/HutaoUserOptions.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Service/Hutao/HutaoUserOptions.cs
@@ -4,6 +4,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.Extensions.Options;
+using Snap.Hutao.Core.Setting;
using Snap.Hutao.Web.Hutao;
using System.Text.RegularExpressions;
@@ -62,8 +63,11 @@ internal sealed class HutaoUserOptions : ObservableObject, IOptions
public HutaoUserOptions Value { get => this; }
- public async ValueTask PostLoginSucceedAsync(HomaPassportClient passportClient, ITaskContext taskContext, string username, string? token)
+ public async ValueTask PostLoginSucceedAsync(HomaPassportClient passportClient, ITaskContext taskContext, string username, string password, string? token)
{
+ LocalSetting.Set(SettingKeys.PassportUserName, username);
+ LocalSetting.Set(SettingKeys.PassportPassword, password);
+
await taskContext.SwitchToMainThreadAsync();
UserName = username;
this.token = token;
@@ -84,6 +88,9 @@ internal sealed class HutaoUserOptions : ObservableObject, IOptions
-
+
-
+
@@ -37,4 +41,4 @@
Style="{StaticResource CaptionTextBlockStyle}"
Text="{shcm:ResourceString Name=ViewPageHutaoPassportPasswordRequirementHint}"/>
-
+
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml
index fb5895c9..78bb7a19 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml
@@ -13,7 +13,11 @@
mc:Ignorable="d">
-
+
@@ -37,4 +41,4 @@
Style="{StaticResource CaptionTextBlockStyle}"
Text="{shcm:ResourceString Name=ViewPageHutaoPassportPasswordRequirementHint}"/>
-
+
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml
index 7e36d3d6..63e270ce 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml
@@ -20,6 +20,8 @@
Severity="Error"/>
@@ -40,4 +42,4 @@
Password="{x:Bind Password, Mode=TwoWay}"
PlaceholderText="{shcm:ResourceString Name=ViewPageHutaoPassportPasswordHint}"/>
-
+
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
index f63a5a4e..f0709654 100644
--- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
+++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Setting/HutaoPassportViewModel.cs
@@ -31,12 +31,6 @@ internal sealed partial class HutaoPassportViewModel : Abstraction.ViewModel
await Launcher.LaunchUriAsync("https://homa.snapgenshin.com/redeem.html".ToUri());
}
- private static void SaveUserNameAndPassword(string username, string password)
- {
- LocalSetting.Set(SettingKeys.PassportUserName, username);
- LocalSetting.Set(SettingKeys.PassportPassword, password);
- }
-
[Command("RegisterCommand")]
private async Task RegisterAsync()
{
@@ -56,9 +50,8 @@ internal sealed partial class HutaoPassportViewModel : Abstraction.ViewModel
if (response.IsOk())
{
- SaveUserNameAndPassword(username, password);
infoBarService.Information(response.Message);
- await hutaoUserOptions.PostLoginSucceedAsync(homaPassportClient, taskContext, username, response.Data).ConfigureAwait(false);
+ await hutaoUserOptions.PostLoginSucceedAsync(homaPassportClient, taskContext, username, password, response.Data).ConfigureAwait(false);
}
}
}
@@ -109,10 +102,8 @@ internal sealed partial class HutaoPassportViewModel : Abstraction.ViewModel
if (response.IsOk())
{
- SaveUserNameAndPassword(username, password);
infoBarService.Information(response.Message);
-
- await hutaoUserOptions.PostLoginSucceedAsync(homaPassportClient, taskContext, username, response.Data).ConfigureAwait(false);
+ await hutaoUserOptions.PostLoginSucceedAsync(homaPassportClient, taskContext, username, password, response.Data).ConfigureAwait(false);
}
}
}
@@ -144,10 +135,8 @@ internal sealed partial class HutaoPassportViewModel : Abstraction.ViewModel
if (response.IsOk())
{
- SaveUserNameAndPassword(username, password);
infoBarService.Information(response.Message);
-
- await hutaoUserOptions.PostLoginSucceedAsync(homaPassportClient, taskContext, username, response.Data).ConfigureAwait(false);
+ await hutaoUserOptions.PostLoginSucceedAsync(homaPassportClient, taskContext, username, password, response.Data).ConfigureAwait(false);
}
}
}
From 1cc072ba28e6021f445e2a04acc57e5231204c59 Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 11:35:31 +0800
Subject: [PATCH 17/20] EmailSmtpAddress
---
.../Snap.Hutao/View/Dialog/HutaoPassportLoginDialog.xaml | 2 +-
.../Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml | 2 +-
.../View/Dialog/HutaoPassportResetPasswordDialog.xaml | 2 +-
.../Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportLoginDialog.xaml b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportLoginDialog.xaml
index 7429a1a8..c1d84662 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportLoginDialog.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportLoginDialog.xaml
@@ -14,7 +14,7 @@
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml
index 1b0881c0..a72dd019 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportRegisterDialog.xaml
@@ -14,7 +14,7 @@
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml
index 78bb7a19..f388fc87 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportResetPasswordDialog.xaml
@@ -14,7 +14,7 @@
diff --git a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml
index 63e270ce..e589664a 100644
--- a/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/View/Dialog/HutaoPassportUnregisterDialog.xaml
@@ -20,7 +20,7 @@
Severity="Error"/>
From 067c7d7c4d28f7f4422b267ace1de043e9b1b005 Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 12:45:11 +0800
Subject: [PATCH 18/20] fix ci
---
src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml | 6 +++++-
.../Snap.Hutao/Service/Hutao/HutaoUserService.cs | 8 ++++----
src/Snap.Hutao/Snap.Hutao/View/UserView.xaml | 9 ++-------
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml b/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
index bd38511d..b2da9a2e 100644
--- a/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
+++ b/src/Snap.Hutao/Snap.Hutao/Control/Theme/FlyoutStyle.xaml
@@ -1,6 +1,10 @@
-
-
-
+
From 4cb3d5f03f4f6336c9ba2d963ccc2c552838d03c Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 14:23:34 +0800
Subject: [PATCH 19/20] launch scheme renewed
---
.../Service/Game/KnownLaunchSchemes.cs | 52 ++++++
.../Service/Game/LaunchScheme.KnownSchemes.cs | 160 ------------------
.../Snap.Hutao/Service/Game/LaunchScheme.cs | 14 +-
.../Service/Game/LaunchSchemeBilibili.cs | 22 +++
.../Service/Game/LaunchSchemeChinese.cs | 22 +++
.../Service/Game/LaunchSchemeOversea.cs | 22 +++
.../ViewModel/Game/LaunchGameViewModel.cs | 2 +-
7 files changed, 126 insertions(+), 168 deletions(-)
create mode 100644 src/Snap.Hutao/Snap.Hutao/Service/Game/KnownLaunchSchemes.cs
delete mode 100644 src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.KnownSchemes.cs
create mode 100644 src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeBilibili.cs
create mode 100644 src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeChinese.cs
create mode 100644 src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeOversea.cs
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/KnownLaunchSchemes.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/KnownLaunchSchemes.cs
new file mode 100644
index 00000000..16fac365
--- /dev/null
+++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/KnownLaunchSchemes.cs
@@ -0,0 +1,52 @@
+// Copyright (c) DGP Studio. All rights reserved.
+// Licensed under the MIT license.
+
+using Snap.Hutao.Model.Intrinsic;
+
+namespace Snap.Hutao.Service.Game;
+
+internal static class KnownLaunchSchemes
+{
+ private static readonly LaunchScheme ServerChineseChannelDefaultSubChannelDefaultCompat = new LaunchSchemeChinese(ChannelType.Default, SubChannelType.Default, false);
+ private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelDefault = new LaunchSchemeChinese(ChannelType.Official, SubChannelType.Default);
+ private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelOfficial = new LaunchSchemeChinese(ChannelType.Official, SubChannelType.Official);
+ private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelNoTapTap = new LaunchSchemeChinese(ChannelType.Official, SubChannelType.NoTapTap);
+ private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelEpicCompat = new LaunchSchemeChinese(ChannelType.Official, SubChannelType.Epic, false);
+
+ private static readonly LaunchScheme ServerChineseChannelBilibiliSubChannelDefault = new LaunchSchemeBilibili(SubChannelType.Default);
+ private static readonly LaunchScheme ServerChineseChannelBilibiliSubChannelOfficialCompat = new LaunchSchemeBilibili(SubChannelType.Official, false);
+
+ private static readonly LaunchScheme ServerGlobalChannelDefaultSubChannelDefaultCompat = new LaunchSchemeOversea(ChannelType.Default, SubChannelType.Default, false);
+ private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelDefault = new LaunchSchemeOversea(ChannelType.Official, SubChannelType.Default);
+ private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelOfficial = new LaunchSchemeOversea(ChannelType.Official, SubChannelType.Official);
+ private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelEpic = new LaunchSchemeOversea(ChannelType.Official, SubChannelType.Epic);
+ private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelGoogle = new LaunchSchemeOversea(ChannelType.Official, SubChannelType.Google);
+
+ ///
+ /// 获取已知的启动方案
+ ///
+ /// 已知的启动方案
+ public static List Get()
+ {
+ return new List()
+ {
+ // 官服
+ ServerChineseChannelDefaultSubChannelDefaultCompat,
+ ServerChineseChannelOfficialSubChannelDefault,
+ ServerChineseChannelOfficialSubChannelOfficial,
+ ServerChineseChannelOfficialSubChannelNoTapTap,
+ ServerChineseChannelOfficialSubChannelEpicCompat,
+
+ // 渠道服
+ ServerChineseChannelBilibiliSubChannelDefault,
+ ServerChineseChannelBilibiliSubChannelOfficialCompat,
+
+ // 国际服
+ ServerGlobalChannelDefaultSubChannelDefaultCompat,
+ ServerGlobalChannelOfficialSubChannelDefault,
+ ServerGlobalChannelOfficialSubChannelOfficial,
+ ServerGlobalChannelOfficialSubChannelEpic,
+ ServerGlobalChannelOfficialSubChannelGoogle,
+ };
+ }
+}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.KnownSchemes.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.KnownSchemes.cs
deleted file mode 100644
index 338b3989..00000000
--- a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.KnownSchemes.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright (c) DGP Studio. All rights reserved.
-// Licensed under the MIT license.
-
-using Snap.Hutao.Model.Intrinsic;
-
-namespace Snap.Hutao.Service.Game;
-
-///
-/// 方案列表部分
-///
-internal sealed partial class LaunchScheme
-{
- private const int SdkStaticLauncherChineseId = 18;
- private const int SdkStaticLauncherBilibiliId = 17;
- private const int SdkStaticLauncherGlobalId = 10;
-
- private const string SdkStaticLauncherChineseKey = "eYd89JmJ";
- private const string SdkStaticLauncherBilibiliKey = "KAtdSsoQ";
- private const string SdkStaticLauncherGlobalKey = "gcStgarh";
-
- private static readonly LaunchScheme ServerChineseChannelDefaultSubChannelDefaultCompatOnly = new()
- {
- LauncherId = SdkStaticLauncherChineseId,
- Key = SdkStaticLauncherChineseKey,
- Channel = ChannelType.Default,
- SubChannel = SubChannelType.Default,
- IsOversea = false,
- IsNotCompatOnly = false,
- };
-
- private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelDefault = new()
- {
- LauncherId = SdkStaticLauncherChineseId,
- Key = SdkStaticLauncherChineseKey,
- Channel = ChannelType.Official,
- SubChannel = SubChannelType.Default,
- IsOversea = false,
- };
-
- private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelOfficial = new()
- {
- LauncherId = SdkStaticLauncherChineseId,
- Key = SdkStaticLauncherChineseKey,
- Channel = ChannelType.Official,
- SubChannel = SubChannelType.Official,
- IsOversea = false,
- };
-
- private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelNoTapTap = new()
- {
- LauncherId = SdkStaticLauncherChineseId,
- Key = SdkStaticLauncherChineseKey,
- Channel = ChannelType.Official,
- SubChannel = SubChannelType.NoTapTap,
- IsOversea = false,
- };
-
- private static readonly LaunchScheme ServerChineseChannelOfficialSubChannelEpicCompatOnly = new()
- {
- LauncherId = SdkStaticLauncherChineseId,
- Key = SdkStaticLauncherChineseKey,
- Channel = ChannelType.Official,
- SubChannel = SubChannelType.Epic,
- IsOversea = false,
- IsNotCompatOnly = false,
- };
-
- private static readonly LaunchScheme ServerChineseChannelBilibiliSubChannelDefault = new()
- {
- LauncherId = SdkStaticLauncherBilibiliId,
- Key = SdkStaticLauncherBilibiliKey,
- Channel = ChannelType.Bili,
- SubChannel = SubChannelType.Default,
- IsOversea = false,
- };
-
- private static readonly LaunchScheme ServerChineseChannelBilibiliSubChannelOfficialCompatOnly = new()
- {
- LauncherId = SdkStaticLauncherBilibiliId,
- Key = SdkStaticLauncherBilibiliKey,
- Channel = ChannelType.Bili,
- SubChannel = SubChannelType.Official,
- IsOversea = false,
- IsNotCompatOnly = false,
- };
-
- private static readonly LaunchScheme ServerGlobalChannelDefaultSubChannelDefaultCompatOnly = new()
- {
- LauncherId = SdkStaticLauncherGlobalId,
- Key = SdkStaticLauncherGlobalKey,
- Channel = ChannelType.Default,
- SubChannel = SubChannelType.Default,
- IsOversea = true,
- IsNotCompatOnly = false,
- };
-
- private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelDefault = new()
- {
- LauncherId = SdkStaticLauncherGlobalId,
- Key = SdkStaticLauncherGlobalKey,
- Channel = ChannelType.Official,
- SubChannel = SubChannelType.Default,
- IsOversea = true,
- };
-
- private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelOfficial = new()
- {
- LauncherId = SdkStaticLauncherGlobalId,
- Key = SdkStaticLauncherGlobalKey,
- Channel = ChannelType.Official,
- SubChannel = SubChannelType.Official,
- IsOversea = true,
- };
-
- private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelEpic = new()
- {
- LauncherId = SdkStaticLauncherGlobalId,
- Key = SdkStaticLauncherGlobalKey,
- Channel = ChannelType.Official,
- SubChannel = SubChannelType.Epic,
- IsOversea = true,
- };
-
- private static readonly LaunchScheme ServerGlobalChannelOfficialSubChannelGoogle = new()
- {
- LauncherId = SdkStaticLauncherGlobalId,
- Key = SdkStaticLauncherGlobalKey,
- Channel = ChannelType.Official,
- SubChannel = SubChannelType.Google,
- IsOversea = true,
- };
-
- ///
- /// 获取已知的启动方案
- ///
- /// 已知的启动方案
- public static List GetKnownSchemes()
- {
- return new List()
- {
- // 官服
- ServerChineseChannelDefaultSubChannelDefaultCompatOnly,
- ServerChineseChannelOfficialSubChannelDefault,
- ServerChineseChannelOfficialSubChannelOfficial,
- ServerChineseChannelOfficialSubChannelNoTapTap,
- ServerChineseChannelOfficialSubChannelEpicCompatOnly,
-
- // 渠道服
- ServerChineseChannelBilibiliSubChannelDefault,
- ServerChineseChannelBilibiliSubChannelOfficialCompatOnly,
-
- // 国际服
- ServerGlobalChannelDefaultSubChannelDefaultCompatOnly,
- ServerGlobalChannelOfficialSubChannelDefault,
- ServerGlobalChannelOfficialSubChannelOfficial,
- ServerGlobalChannelOfficialSubChannelEpic,
- ServerGlobalChannelOfficialSubChannelGoogle,
- };
- }
-}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs
index 523e0de6..5aeede35 100644
--- a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs
+++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchScheme.cs
@@ -9,7 +9,7 @@ namespace Snap.Hutao.Service.Game;
/// 启动方案
///
[HighQuality]
-internal sealed partial class LaunchScheme
+internal partial class LaunchScheme
{
///
/// 显示名称
@@ -32,29 +32,29 @@ internal sealed partial class LaunchScheme
///
/// 通道
///
- public ChannelType Channel { get; private set; }
+ public ChannelType Channel { get; private protected set; }
///
/// 子通道
///
- public SubChannelType SubChannel { get; private set; }
+ public SubChannelType SubChannel { get; private protected set; }
///
/// 启动器 Id
///
- public int LauncherId { get; private set; }
+ public int LauncherId { get; private protected set; }
///
/// API Key
///
- public string Key { get; private set; } = default!;
+ public string Key { get; private protected set; } = default!;
///
/// 是否为海外
///
- public bool IsOversea { get; private set; }
+ public bool IsOversea { get; private protected set; }
- public bool IsNotCompatOnly { get; private set; } = true;
+ public bool IsNotCompatOnly { get; private protected set; } = true;
///
/// 多通道相等
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeBilibili.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeBilibili.cs
new file mode 100644
index 00000000..cd5057be
--- /dev/null
+++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeBilibili.cs
@@ -0,0 +1,22 @@
+// Copyright (c) DGP Studio. All rights reserved.
+// Licensed under the MIT license.
+
+using Snap.Hutao.Model.Intrinsic;
+
+namespace Snap.Hutao.Service.Game;
+
+internal sealed class LaunchSchemeBilibili : LaunchScheme
+{
+ private const int SdkStaticLauncherBilibiliId = 17;
+ private const string SdkStaticLauncherBilibiliKey = "KAtdSsoQ";
+
+ public LaunchSchemeBilibili(SubChannelType subChannel, bool isNotCompatOnly = true)
+ {
+ LauncherId = SdkStaticLauncherBilibiliId;
+ Key = SdkStaticLauncherBilibiliKey;
+ Channel = ChannelType.Bili;
+ SubChannel = subChannel;
+ IsOversea = false;
+ IsNotCompatOnly = isNotCompatOnly;
+ }
+}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeChinese.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeChinese.cs
new file mode 100644
index 00000000..1e8f0e9f
--- /dev/null
+++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeChinese.cs
@@ -0,0 +1,22 @@
+// Copyright (c) DGP Studio. All rights reserved.
+// Licensed under the MIT license.
+
+using Snap.Hutao.Model.Intrinsic;
+
+namespace Snap.Hutao.Service.Game;
+
+internal sealed class LaunchSchemeChinese : LaunchScheme
+{
+ private const int SdkStaticLauncherChineseId = 18;
+ private const string SdkStaticLauncherChineseKey = "eYd89JmJ";
+
+ public LaunchSchemeChinese(ChannelType channel, SubChannelType subChannel, bool isNotCompatOnly = true)
+ {
+ LauncherId = SdkStaticLauncherChineseId;
+ Key = SdkStaticLauncherChineseKey;
+ Channel = channel;
+ SubChannel = subChannel;
+ IsOversea = false;
+ IsNotCompatOnly = isNotCompatOnly;
+ }
+}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeOversea.cs b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeOversea.cs
new file mode 100644
index 00000000..2838d82e
--- /dev/null
+++ b/src/Snap.Hutao/Snap.Hutao/Service/Game/LaunchSchemeOversea.cs
@@ -0,0 +1,22 @@
+// Copyright (c) DGP Studio. All rights reserved.
+// Licensed under the MIT license.
+
+using Snap.Hutao.Model.Intrinsic;
+
+namespace Snap.Hutao.Service.Game;
+
+internal sealed class LaunchSchemeOversea : LaunchScheme
+{
+ private const int SdkStaticLauncherOverseaId = 10;
+ private const string SdkStaticLauncherOverseaKey = "gcStgarh";
+
+ public LaunchSchemeOversea(ChannelType channel, SubChannelType subChannel, bool isNotCompatOnly = true)
+ {
+ LauncherId = SdkStaticLauncherOverseaId;
+ Key = SdkStaticLauncherOverseaKey;
+ Channel = channel;
+ SubChannel = subChannel;
+ IsOversea = true;
+ IsNotCompatOnly = isNotCompatOnly;
+ }
+}
\ No newline at end of file
diff --git a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs
index 4badbf36..24dc9524 100644
--- a/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs
+++ b/src/Snap.Hutao/Snap.Hutao/ViewModel/Game/LaunchGameViewModel.cs
@@ -55,7 +55,7 @@ internal sealed partial class LaunchGameViewModel : Abstraction.ViewModel
/// 已知的服务器方案
///
[SuppressMessage("", "CA1822")]
- public List KnownSchemes { get => LaunchScheme.GetKnownSchemes(); }
+ public List KnownSchemes { get => KnownLaunchSchemes.Get(); }
///
/// 当前选择的服务器方案
From 59f889567505623f05128bbfbc93b63c2b05b4b5 Mon Sep 17 00:00:00 2001
From: Lightczx <1686188646@qq.com>
Date: Thu, 2 Nov 2023 15:05:06 +0800
Subject: [PATCH 20/20] MarqueeText
---
.../Control/Behavior/MarqueeTextBehavior.cs | 46 +++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100644 src/Snap.Hutao/Snap.Hutao/Control/Behavior/MarqueeTextBehavior.cs
diff --git a/src/Snap.Hutao/Snap.Hutao/Control/Behavior/MarqueeTextBehavior.cs b/src/Snap.Hutao/Snap.Hutao/Control/Behavior/MarqueeTextBehavior.cs
new file mode 100644
index 00000000..9f27b0e6
--- /dev/null
+++ b/src/Snap.Hutao/Snap.Hutao/Control/Behavior/MarqueeTextBehavior.cs
@@ -0,0 +1,46 @@
+// Copyright (c) DGP Studio. All rights reserved.
+// Licensed under the MIT license.
+
+using CommunityToolkit.Labs.WinUI.MarqueeTextRns;
+using CommunityToolkit.WinUI.Behaviors;
+using Microsoft.UI.Xaml.Input;
+
+namespace Snap.Hutao.Control.Behavior;
+
+internal sealed class MarqueeTextBehavior : BehaviorBase
+{
+ private readonly PointerEventHandler pointerEnteredEventHandler;
+ private readonly PointerEventHandler pointerExitedEventHandler;
+
+ public MarqueeTextBehavior()
+ {
+ pointerEnteredEventHandler = OnPointerEntered;
+ pointerExitedEventHandler = OnPointerExited;
+ }
+
+ protected override bool Initialize()
+ {
+ AssociatedObject.PointerEntered += pointerEnteredEventHandler;
+ AssociatedObject.PointerExited += pointerExitedEventHandler;
+
+ return true;
+ }
+
+ protected override bool Uninitialize()
+ {
+ AssociatedObject.PointerEntered -= pointerEnteredEventHandler;
+ AssociatedObject.PointerExited -= pointerExitedEventHandler;
+
+ return true;
+ }
+
+ private void OnPointerEntered(object sender, PointerRoutedEventArgs e)
+ {
+ AssociatedObject.StartMarquee();
+ }
+
+ private void OnPointerExited(object sender, PointerRoutedEventArgs e)
+ {
+ AssociatedObject.StopMarquee();
+ }
+}
\ No newline at end of file