From ec1cee0f3732cff59c6ed66a6e4325b40b195032 Mon Sep 17 00:00:00 2001 From: ywmoyue Date: Mon, 17 Feb 2025 22:01:26 +0800 Subject: [PATCH] =?UTF-8?q?#1062=20=E5=A4=84=E7=90=86=E5=80=8D=E9=80=9F?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=8E=92=E5=BA=8F=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8C=E5=8F=AF=E6=81=A2=E5=A4=8D=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=80=8D=E9=80=9F=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BiliLite.UWP/Dialogs/EditPlaySpeedMenuDialog.xaml | 7 ++++++- src/BiliLite.UWP/Dialogs/EditPlaySpeedMenuDialog.xaml.cs | 6 ++++++ src/BiliLite.UWP/Services/PlaySpeedMenuService.cs | 3 ++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/BiliLite.UWP/Dialogs/EditPlaySpeedMenuDialog.xaml b/src/BiliLite.UWP/Dialogs/EditPlaySpeedMenuDialog.xaml index cabd0b76b..f265258c8 100644 --- a/src/BiliLite.UWP/Dialogs/EditPlaySpeedMenuDialog.xaml +++ b/src/BiliLite.UWP/Dialogs/EditPlaySpeedMenuDialog.xaml @@ -16,7 +16,7 @@ @@ -55,6 +55,10 @@ + + + + diff --git a/src/BiliLite.UWP/Dialogs/EditPlaySpeedMenuDialog.xaml.cs b/src/BiliLite.UWP/Dialogs/EditPlaySpeedMenuDialog.xaml.cs index 595ba71f5..823e3d303 100644 --- a/src/BiliLite.UWP/Dialogs/EditPlaySpeedMenuDialog.xaml.cs +++ b/src/BiliLite.UWP/Dialogs/EditPlaySpeedMenuDialog.xaml.cs @@ -57,5 +57,11 @@ private void BtnAddPlaySpeed_OnTapped(object sender, TappedRoutedEventArgs e) m_viewModel.PlaySpeedMenuItems = new ObservableCollection(m_viewModel.PlaySpeedMenuItems.OrderBy(x => x.Value)); } + + private void BtnBackToDefault_OnClick(object sender, RoutedEventArgs e) + { + m_viewModel.PlaySpeedMenuItems = + new ObservableCollection(m_playSpeedMenuService.GetDefaultPlaySpeedMenu()); + } } } diff --git a/src/BiliLite.UWP/Services/PlaySpeedMenuService.cs b/src/BiliLite.UWP/Services/PlaySpeedMenuService.cs index 68c2ff6c0..6876c3cd9 100644 --- a/src/BiliLite.UWP/Services/PlaySpeedMenuService.cs +++ b/src/BiliLite.UWP/Services/PlaySpeedMenuService.cs @@ -13,6 +13,7 @@ public class PlaySpeedMenuService public PlaySpeedMenuService() { MenuItems = SettingService.GetValue(SettingConstants.Player.PLAY_SPEED_MENU, GetDefaultPlaySpeedMenu()); + MenuItems = MenuItems.OrderBy(x => x.Value).ToList(); } public void SetMenuItems(List menuItems) @@ -26,7 +27,7 @@ public int SpeedIndexOf(double speed) return MenuItems.FindIndex(x => x.Value == speed); } - private List GetDefaultPlaySpeedMenu() + public List GetDefaultPlaySpeedMenu() { return [.. new ObservableCollection() {