本文整理汇总了C#中System.Windows.Forms.Form.invokeOnThread方法的典型用法代码示例。如果您正苦于以下问题:C# Form.invokeOnThread方法的具体用法?C# Form.invokeOnThread怎么用?C# Form.invokeOnThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.invokeOnThread方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowCompletionWindow
public static CodeCompletionWindow ShowCompletionWindow(Form parent, TextEditorControl control, string fileName, ICompletionDataProvider completionDataProvider, char firstChar, bool showDeclarationWindow, bool fixedListViewWidth)
{
if (busy) // DC to prevent multiple calls
{
"CodeCompletionWindow.ShowCompletionWindow was busy, skipping ShowCompletionWindow calculation".info();
return null;
}
busy = true;
return (CodeCompletionWindow)parent.invokeOnThread(
() =>
{
try
{
var tempCompletionData = new ICompletionData[] { };
CodeCompletionWindow codeCompletionWindow = new CodeCompletionWindow(completionDataProvider, tempCompletionData, parent, control, showDeclarationWindow, fixedListViewWidth);
codeCompletionWindow.CloseWhenCaretAtBeginning = firstChar == '\0';
codeCompletionWindow.ShowCompletionWindow();
O2Thread.mtaThread( // run in on a separate thread for performance reasons
() =>
{
try
{
ICompletionData[] completionData = completionDataProvider.GenerateCompletionData(fileName, control.ActiveTextAreaControl.TextArea, firstChar);
if (completionData == null || completionData.Length == 0)
{
//return null;
}
else
codeCompletionWindow.setCodeCompletionData(completionData);
busy = false;
}
catch (Exception ex)
{
ex.log("in CodeCompletionWindow.ShowCompletionWindow ");
}
});
return codeCompletionWindow;
}
catch (Exception ex)
{
busy = false;
return null;
}
});
}