/// <summary>
/// 界面同步
/// </summary>
private class UISync
{
private static ISynchronizeInvoke Sync;
public static void Init(ISynchronizeInvoke sync)
{
Sync = sync;
}
public static void Execute(Action action)
{
try { Sync.BeginInvoke(action, null); }
catch { }
}
}
使用
UISync.Execute(() => textBox2.Text+= System.Text.Encoding.Unicode.GetString(bt));
时间: 2024-12-22 08:57:32