Commit 29829eb5 authored by 罗显健's avatar 罗显健

更新器:忽而设置剪贴板操作失败的异常。

parent fc5d15e5
...@@ -557,8 +557,13 @@ namespace UpdateExecuter ...@@ -557,8 +557,13 @@ namespace UpdateExecuter
{ {
Invoke(new Action<string, string, string>((a, b, c) => Invoke(new Action<string, string, string>((a, b, c) =>
{ {
if (!string.IsNullOrEmpty(c)) Clipboard.SetData(DataFormats.Text, c); // 跨线程操作会报错 “在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式。请确保您的 Main 函数带有 STAThreadAttribute 标记。” try
{
//设置剪贴板操作有时候会失败,不影响发布更新。
if (!string.IsNullOrEmpty(c))
Clipboard.SetData(DataFormats.Text, c); // 跨线程操作会报错 “在可以调用 OLE 之前,必须将当前线程设置为单线程单元(STA)模式。请确保您的 Main 函数带有 STAThreadAttribute 标记。”
}
catch { }
lblSpeed.Text = $"{a},{b}"; lblSpeed.Text = $"{a},{b}";
}), process, msg, sql); }), process, msg, sql);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment