try
{
Thread t = new Thread(() =>
{
try
{
result = myclass.Start(mode, Check, Tasks,exeMode);
}
catch (GeneralException ge)
{
}
finally
{
if (Master)
{
}
}
});
t.IsBackground = true;
t.Start();
bResult = true;
}
catch(GeneralException ge)
{
}
mode = Mode.Continue;
if (ErrorCode != 0)
{
this.Invoke(new System.EventHandler(_showErrorMsg), execErrorCode, EventArgs.Empty);
}
else if (result == Result.RegainRequest)
{
this.Invoke(new System.EventHandler(_showMsg), Modes.RegainRequest, new EventArgs());
}
else if (result == Result.RegainRequestNoClear)
{
this.Invoke(new System.EventHandler(_showMsg), Modes.RegainRequestNoClear, new EventArgs());
}
else if (result == Result.PathRemain)
{
this.Invoke(new System.EventHandler(_showMsg), Modes.PathRemain, new EventArgs());
}
else
{
_regainmode = RegainMode.Continue;
}
这里我们有一个名为t的线程,它是后台线程。其中我调用了Start方法返回值,如上面的代码所示。
我必须在我的GUI线程中使用此结果,该线程位于以下代码中
else if (result == Result.RegainRequest)
{
this.Invoke(new System.EventHandler(_showMsg), Modes.RegainRequest, new EventArgs());
}
请告诉我该怎么做才能在GUI线程中使用这个值。