当复制视频详情页的输入框中的字符时,不读取剪贴板内容

croire 3 years ago
parent bf87565165
commit 588599e1cf

@ -0,0 +1,7 @@
namespace DownKyi
{
public class AppConstant
{
public const string ClipboardId = "32ff00b1-1a09-4b25-9ca7-dcb6914b141c";
}
}

@ -95,6 +95,7 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="AppConstant.cs" />
<Compile Include="Converter\CountConverter.cs" /> <Compile Include="Converter\CountConverter.cs" />
<Compile Include="CustomControl\CustomPager.xaml.cs"> <Compile Include="CustomControl\CustomPager.xaml.cs">
<DependentUpon>CustomPager.xaml</DependentUpon> <DependentUpon>CustomPager.xaml</DependentUpon>

@ -354,7 +354,7 @@ namespace DownKyi.ViewModels
} }
SearchService searchService = new SearchService(); SearchService searchService = new SearchService();
searchService.BiliInput(input, ViewIndexViewModel.Tag, eventAggregator); searchService.BiliInput(input + AppConstant.ClipboardId, ViewIndexViewModel.Tag, eventAggregator);
} }
#endregion #endregion

@ -30,7 +30,7 @@ namespace DownKyi.ViewModels
private readonly IDialogService dialogService; private readonly IDialogService dialogService;
// 保存输入字符串,避免被用户修改 // 保存输入字符串,避免被用户修改
private string input; private string input = null;
#region 页面属性申明 #region 页面属性申明
@ -745,8 +745,6 @@ namespace DownKyi.ViewModels
/// <param name="navigationContext"></param> /// <param name="navigationContext"></param>
public override void OnNavigatedTo(NavigationContext navigationContext) public override void OnNavigatedTo(NavigationContext navigationContext)
{ {
base.OnNavigatedTo(navigationContext);
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark"); ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
DownloadManage = ButtonIcon.Instance().DownloadManage; DownloadManage = ButtonIcon.Instance().DownloadManage;
@ -757,13 +755,25 @@ namespace DownKyi.ViewModels
// Parent参数为null时表示是从下一个页面返回到本页面不需要执行任务 // Parent参数为null时表示是从下一个页面返回到本页面不需要执行任务
if (navigationContext.Parameters.GetValue<string>("Parent") != null) if (navigationContext.Parameters.GetValue<string>("Parent") != null)
{ {
string param = navigationContext.Parameters.GetValue<string>("Parameter");
// 移除剪贴板id
string intput = param.Replace(AppConstant.ClipboardId, "");
// 检测是否从剪贴板传入
if (InputText == intput && param.EndsWith(AppConstant.ClipboardId))
{
return;
}
// 正在执行任务时不开启新任务 // 正在执行任务时不开启新任务
if (LoadingVisibility != Visibility.Visible) if (LoadingVisibility != Visibility.Visible)
{ {
InputText = navigationContext.Parameters.GetValue<string>("Parameter"); InputText = intput;
PropertyChangeAsync(ExecuteInputCommand); PropertyChangeAsync(ExecuteInputCommand);
} }
} }
base.OnNavigatedTo(navigationContext);
} }
} }

Loading…
Cancel
Save