//Thread.Sleep 不卡UI
//async await
//Task
//低版本也能用(委托的BeginInvoke);
AsyncCallback callBack = new AsyncCallback(s =>
{
Console.WriteLine("执行完毕,开始回调");
});
private void labCopyCode_Click(object sender, EventArgs e)
{
Clipboard.SetText(labCode.Text);
SucceedUI(labCopyCode);
Action<Label> act = new Action<Label>(ReCopyUI);
act.BeginInvoke(labCopyCode, callBack, null);
}
private void labCopyLink_Click(object sender, EventArgs e)
{
Clipboard.SetText(labLink.Text);
SucceedUI(labCopyLink);
Action<Label> act = new Action<Label>(ReCopyUI);
act.BeginInvoke(labCopyLink, callBack, null);
}
static Color _red = Color.FromArgb(236, 68, 68);
static Color _blue = Color.FromArgb(0, 138, 220);
private void ReCopyUI(Label label)
{
Console.WriteLine("ReUI线程ID:{0}", Thread.CurrentThread.ManagedThreadId);