From 588599e1cfd3c99bada6c52bfd8be36a168657a9 Mon Sep 17 00:00:00 2001 From: croire <1432593898@qq.com> Date: Tue, 3 May 2022 23:37:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E5=A4=8D=E5=88=B6=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E7=9A=84=E8=BE=93=E5=85=A5=E6=A1=86?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=AD=97=E7=AC=A6=E6=97=B6=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E5=89=AA=E8=B4=B4=E6=9D=BF=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DownKyi/AppConstant.cs | 7 +++++++ DownKyi/DownKyi.csproj | 1 + DownKyi/ViewModels/MainWindowViewModel.cs | 2 +- DownKyi/ViewModels/ViewVideoDetailViewModel.cs | 18 ++++++++++++++---- 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 DownKyi/AppConstant.cs diff --git a/DownKyi/AppConstant.cs b/DownKyi/AppConstant.cs new file mode 100644 index 0000000..cad527c --- /dev/null +++ b/DownKyi/AppConstant.cs @@ -0,0 +1,7 @@ +namespace DownKyi +{ + public class AppConstant + { + public const string ClipboardId = "32ff00b1-1a09-4b25-9ca7-dcb6914b141c"; + } +} diff --git a/DownKyi/DownKyi.csproj b/DownKyi/DownKyi.csproj index 467afb2..1f6c474 100644 --- a/DownKyi/DownKyi.csproj +++ b/DownKyi/DownKyi.csproj @@ -95,6 +95,7 @@ MSBuild:Compile Designer + CustomPager.xaml diff --git a/DownKyi/ViewModels/MainWindowViewModel.cs b/DownKyi/ViewModels/MainWindowViewModel.cs index c806981..47714da 100644 --- a/DownKyi/ViewModels/MainWindowViewModel.cs +++ b/DownKyi/ViewModels/MainWindowViewModel.cs @@ -354,7 +354,7 @@ namespace DownKyi.ViewModels } SearchService searchService = new SearchService(); - searchService.BiliInput(input, ViewIndexViewModel.Tag, eventAggregator); + searchService.BiliInput(input + AppConstant.ClipboardId, ViewIndexViewModel.Tag, eventAggregator); } #endregion diff --git a/DownKyi/ViewModels/ViewVideoDetailViewModel.cs b/DownKyi/ViewModels/ViewVideoDetailViewModel.cs index dcc1e02..edb6cf2 100644 --- a/DownKyi/ViewModels/ViewVideoDetailViewModel.cs +++ b/DownKyi/ViewModels/ViewVideoDetailViewModel.cs @@ -30,7 +30,7 @@ namespace DownKyi.ViewModels private readonly IDialogService dialogService; // 保存输入字符串,避免被用户修改 - private string input; + private string input = null; #region 页面属性申明 @@ -745,8 +745,6 @@ namespace DownKyi.ViewModels /// public override void OnNavigatedTo(NavigationContext navigationContext) { - base.OnNavigatedTo(navigationContext); - ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); DownloadManage = ButtonIcon.Instance().DownloadManage; @@ -757,13 +755,25 @@ namespace DownKyi.ViewModels // Parent参数为null时,表示是从下一个页面返回到本页面,不需要执行任务 if (navigationContext.Parameters.GetValue("Parent") != null) { + string param = navigationContext.Parameters.GetValue("Parameter"); + // 移除剪贴板id + string intput = param.Replace(AppConstant.ClipboardId, ""); + + // 检测是否从剪贴板传入 + if (InputText == intput && param.EndsWith(AppConstant.ClipboardId)) + { + return; + } + // 正在执行任务时不开启新任务 if (LoadingVisibility != Visibility.Visible) { - InputText = navigationContext.Parameters.GetValue("Parameter"); + InputText = intput; PropertyChangeAsync(ExecuteInputCommand); } } + + base.OnNavigatedTo(navigationContext); } }