本文整理汇总了C#中IServiceProvider.GetUIThread方法的典型用法代码示例。如果您正苦于以下问题:C# IServiceProvider.GetUIThread方法的具体用法?C# IServiceProvider.GetUIThread怎么用?C# IServiceProvider.GetUIThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceProvider
的用法示例。
在下文中一共展示了IServiceProvider.GetUIThread方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PythonSuggestedActionsSource
public PythonSuggestedActionsSource(
IServiceProvider provider,
ITextView textView,
ITextBuffer textBuffer
) {
_provider = provider;
_view = textView;
_textBuffer = textBuffer;
_textBuffer.RegisterForNewAnalysis(OnNewAnalysisEntry);
_uiThread = provider.GetUIThread();
}
示例2: Get
/// <summary>
/// Gets or creates the specified output pane.
/// </summary>
/// <exception cref="InvalidOperationException">The output pane could
/// not be found or created.</exception>
public static OutputWindowRedirector Get(IServiceProvider provider, Guid id, string title) {
var outputWindow = provider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow;
if (outputWindow == null) {
throw new InvalidOperationException("Unable to get output window service");
}
IVsOutputWindowPane pane;
if (ErrorHandler.Failed(outputWindow.GetPane(id, out pane)) || pane == null) {
if (ErrorHandler.Failed(provider.GetUIThread().Invoke(() => outputWindow.CreatePane(id, title, 1, 0)))) {
throw new InvalidOperationException("Unable to create output pane");
}
}
return new OutputWindowRedirector(provider, id);
}
示例3: TryCreateNavigateToItemProvider
public bool TryCreateNavigateToItemProvider(IServiceProvider serviceProvider, out INavigateToItemProvider provider)
{
var shell = serviceProvider.GetShell();
var guid = GuidList.guidPythonToolsPackage;
IVsPackage pkg;
if (shell.IsPackageLoaded(ref guid, out pkg) == VSConstants.S_OK && pkg != null) {
provider = serviceProvider.GetUIThread().Invoke(() => {
return new PythonNavigateToItemProvider(serviceProvider, _glyphService);
});
return true;
}
// Not loaded, so nothing to provide
provider = null;
return false;
}
示例4: DropDownBarClient
public DropDownBarClient(IServiceProvider serviceProvider, IWpfTextView textView, AnalysisEntry analysisEntry) {
Utilities.ArgumentNotNull(nameof(serviceProvider), serviceProvider);
Utilities.ArgumentNotNull(nameof(textView), textView);
Utilities.ArgumentNotNull(nameof(analysisEntry), analysisEntry);
_serviceProvider = serviceProvider;
_uiThread = _serviceProvider.GetUIThread();
_analysisEntry = analysisEntry;
textView.TextBuffer.RegisterForParseTree(ParserOnNewParseTree);
_textView = textView;
_dispatcher = Dispatcher.CurrentDispatcher;
_textView.Caret.PositionChanged += CaretPositionChanged;
for (int i = 0; i < NavigationLevels; i++) {
_curSelection[i] = -1;
}
}
示例5: GetLauncher
internal static IProjectLauncher GetLauncher(IServiceProvider serviceProvider, IPythonProject project) {
var launchProvider = serviceProvider.GetUIThread().Invoke<string>(() => project.GetProperty(PythonConstants.LaunchProvider));
IPythonLauncherProvider defaultLaunchProvider = null;
foreach (var launcher in serviceProvider.GetComponentModel().GetExtensions<IPythonLauncherProvider>()) {
if (launcher.Name == launchProvider) {
return serviceProvider.GetUIThread().Invoke<IProjectLauncher>(() => launcher.CreateLauncher(project));
}
if (launcher.Name == DefaultLauncherProvider.DefaultLauncherName) {
defaultLaunchProvider = launcher;
}
}
// no launcher configured, use the default one.
Debug.Assert(defaultLaunchProvider != null);
return (defaultLaunchProvider != null) ?
serviceProvider.GetUIThread().Invoke<IProjectLauncher>(() => defaultLaunchProvider.CreateLauncher(project)) :
null;
}
示例6: IDEBuildLogger
/// <summary>
/// Constructor. Inititialize member data.
/// </summary>
public IDEBuildLogger(IVsOutputWindowPane output, TaskProvider taskProvider, IVsHierarchy hierarchy) {
Utilities.ArgumentNotNull("taskProvider", taskProvider);
Utilities.ArgumentNotNull("hierarchy", hierarchy);
Trace.WriteLineIf(Thread.CurrentThread.GetApartmentState() != ApartmentState.STA, "WARNING: IDEBuildLogger constructor running on the wrong thread.");
IOleServiceProvider site;
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(hierarchy.GetSite(out site));
this.taskProvider = taskProvider;
this.outputWindowPane = output;
this.hierarchy = hierarchy;
this.serviceProvider = new ServiceProvider(site);
serviceProvider.GetUIThread().MustBeCalledFromUIThread();
this.dispatcher = Dispatcher.CurrentDispatcher;
}
示例7: VariableRenamer
public VariableRenamer(ITextView textView, IServiceProvider serviceProvider) {
_view = textView;
_serviceProvider = serviceProvider;
_uiThread = _serviceProvider.GetUIThread();
}
示例8: IsDebugging
private static bool IsDebugging(IServiceProvider provider, IVsDebugger debugger) {
return provider.GetUIThread().Invoke(() => {
var mode = new[] { DBGMODE.DBGMODE_Design };
return ErrorHandler.Succeeded(debugger.GetMode(mode)) && mode[0] != DBGMODE.DBGMODE_Design;
});
}