我在尝试将我的流程放入线程时遇到问题。我希望我的进程在一个子线程中,每当它设置标志真值时,主线程打开UI表单。这是我的代码
public static bool flagThread = false;
private void btngenerateNew_Click(object sender, RibbonControlEventArgs e)
{
supportThread(sender, e);
int i=1;
while (i > 0)
{
if (flagThread)
{
_Document _doc = Globals.ThisAddIn.Application.ActiveDocument;
IDesignSpecWord2007.UI_Forms.DisplayError c1 = new IDesignSpecWord2007.UI_Forms.DisplayError(IDSApplyTransformations.ArrErrorsDisp, ref Globals.ThisAddIn.Application, ref _doc);
Globals.ThisAddIn.DispError = c1;
c1.Show();
break;
}
}
}
private void supportThread(object sender, RibbonControlEventArgs e)
{
ThreadObject thrdObj = new ThreadObject();
thrdObj.sender = sender;
thrdObj.e = e;
Thread thrStart = new System.Threading.Thread(new ParameterizedThreadStart(createThread));
thrStart.Start(thrdObj);
}
我收到错误"功能评估被禁用,因为之前的..."当我试图访问文档时
docm = Globals.ThisAddIn.docm;