Skip to content

Commit 61b9280

Browse files
committed
粘贴板clear后加入await
1 parent 84464cd commit 61b9280

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

MainWindow.xaml.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public MainWindow()
9393

9494
_globalMouseKeyHook = Hook.GlobalEvents();
9595

96-
_globalMouseKeyHook.MouseUp += OnMouseUp;
96+
_globalMouseKeyHook.MouseDownExt += OnMouseDownExt;
9797
_globalMouseKeyHook.MouseDragFinished += OnMouseDragFinished;
9898
_globalMouseKeyHook.MouseWheel += OnMouseWheel;
9999

@@ -115,10 +115,11 @@ private async void AfterKeySequence()
115115
if (Clipboard.ContainsText()) ProcessText(Clipboard.GetText());
116116
}
117117

118-
private static void OnMouseUp(object sender, MouseEventArgs e)
118+
private static async void OnMouseDownExt(object sender, MouseEventArgs e)
119119
{
120120
if (e.Clicks != 1) return;
121121

122+
await Task.Delay(5);
122123
Application.Current.Windows
123124
.Cast<Window>()
124125
.LastOrDefault(window => window is IconPopup)?.Close();
@@ -140,6 +141,7 @@ private async void OnMouseDragFinished(object sender, MouseEventArgs e)
140141
var clipboardBefore = Clipboard.GetDataObject();
141142

142143
Clipboard.Clear();
144+
await Task.Delay(50);
143145
SendKeys.SendWait("^c");
144146
await Task.Delay(500);
145147

@@ -586,9 +588,9 @@ public void CheckUpdate()
586588
var notifyUpdate = new
587589
NotifyUpdate("打扰一下,您已经使用这个软件版本很久啦!\n\n或许已经有新版本了,欢迎前去公众号获取最新版。✨",
588590
"知道啦", "别再提示")
589-
{
590-
Owner = this
591-
};
591+
{
592+
Owner = this
593+
};
592594
notifyUpdate.Show();
593595
}
594596

0 commit comments

Comments
 (0)