From 63b7fd90632fa66882b716910cc4d9ecb2157852 Mon Sep 17 00:00:00 2001 From: leiurayer <1432593898@qq.com> Date: Thu, 1 Aug 2024 22:58:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=89=8D=E5=BE=80=E7=9A=84?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=B8=8E=E5=BD=93=E5=89=8D=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=EF=BC=8C=E5=88=99=E4=B8=8D=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=96=B0=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=88=B0=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=A0=88=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Downkyi.UI/ViewModels/Video/VideoDetailViewModel.cs | 8 +++++++- src/Downkyi/ViewModels/MainWindowViewModel.cs | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/Downkyi.UI/ViewModels/Video/VideoDetailViewModel.cs b/src/Downkyi.UI/ViewModels/Video/VideoDetailViewModel.cs index fc5585a..9dc06ab 100644 --- a/src/Downkyi.UI/ViewModels/Video/VideoDetailViewModel.cs +++ b/src/Downkyi.UI/ViewModels/Video/VideoDetailViewModel.cs @@ -11,7 +11,7 @@ public partial class VideoDetailViewModel : ViewModelBase public const string Key = "VideoDetail"; // 保存输入字符串,避免被用户修改 - private string? input = null; + private string? _input = null; #region 页面属性申明 @@ -85,6 +85,12 @@ public partial class VideoDetailViewModel : ViewModelBase { base.OnNavigatedTo(parameter); + if (parameter!.ContainsKey("value")) + { + _input = (string)parameter["value"]; + InputText = _input; + } + } } \ No newline at end of file diff --git a/src/Downkyi/ViewModels/MainWindowViewModel.cs b/src/Downkyi/ViewModels/MainWindowViewModel.cs index f810247..1fafadb 100644 --- a/src/Downkyi/ViewModels/MainWindowViewModel.cs +++ b/src/Downkyi/ViewModels/MainWindowViewModel.cs @@ -125,10 +125,15 @@ public partial class MainWindowViewModel : ViewModelBase var viewModel = SetContent(viewKey); if (viewModel == null) { return; } + // 如果前往的页面与当前页面相同, + // 则不添加新的页面到页面栈中 + if (viewModel != Content) + { + _pages.Push(viewKey); + } + viewModel.OnNavigatedTo(parameter); Content = viewModel; - - _pages.Push(viewKey); } public void Backward(Dictionary? parameter = null)