diff --git a/DownKyi/ViewModels/MainWindowViewModel.cs b/DownKyi/ViewModels/MainWindowViewModel.cs
index 22279ee..2f9f1fa 100644
--- a/DownKyi/ViewModels/MainWindowViewModel.cs
+++ b/DownKyi/ViewModels/MainWindowViewModel.cs
@@ -149,6 +149,7 @@ namespace DownKyi.ViewModels
clipboardHooker = new ClipboardHooker(Application.Current.MainWindow);
clipboardHooker.ClipboardUpdated += OnClipboardUpdated;
+ // 进入首页
var param = new NavigationParameters
{
{ "Parent", "" },
@@ -292,8 +293,32 @@ namespace DownKyi.ViewModels
icon.Fill = DictionaryResource.GetColor("ColorSystemBtnTintDark");
}
+ #region 剪贴板
+
+ private int times = 0;
+
+ ///
+ /// 监听剪贴板更新事件,会执行两遍以上
+ ///
+ ///
+ ///
private void OnClipboardUpdated(object sender, EventArgs e)
{
+ times += 1;
+ DispatcherTimer timer = new DispatcherTimer
+ {
+ Interval = new TimeSpan(0, 0, 0, 0, 300)
+ };
+ timer.Tick += (s, ex) => { timer.IsEnabled = false; times = 0; };
+ timer.IsEnabled = true;
+
+ if (times % 2 == 0)
+ {
+ timer.IsEnabled = false;
+ times = 0;
+ return;
+ }
+
AllowStatus isListenClipboard = SettingsManager.GetInstance().IsListenClipboard();
if (isListenClipboard != AllowStatus.YES)
{
@@ -381,5 +406,7 @@ namespace DownKyi.ViewModels
}
}
+ #endregion
+
}
}