当前位置: 首页>>代码示例>>C#>>正文


C# IServiceProvider.GetUIThread方法代码示例

本文整理汇总了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();
 }
开发者ID:jsschultz,项目名称:PTVS,代码行数:11,代码来源:PythonSuggestedActionsSource.cs

示例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);
        }
开发者ID:bnavarma,项目名称:ScalaTools,代码行数:19,代码来源:OutputWindowRedirector.cs

示例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;
        }
开发者ID:,项目名称:,代码行数:16,代码来源:

示例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;
            }
        }
开发者ID:jsschultz,项目名称:PTVS,代码行数:16,代码来源:DropDownBarClient.cs

示例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;
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:20,代码来源:PythonToolsPackage.cs

示例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;
        }
开发者ID:omnimark,项目名称:PTVS,代码行数:19,代码来源:IDEBuildLogger.cs

示例7: VariableRenamer

 public VariableRenamer(ITextView textView, IServiceProvider serviceProvider) {
     _view = textView;
     _serviceProvider = serviceProvider;
     _uiThread = _serviceProvider.GetUIThread();
 }
开发者ID:jsschultz,项目名称:PTVS,代码行数:5,代码来源:VariableRenamer.cs

示例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;
     });
 }
开发者ID:zooba,项目名称:PTVS,代码行数:6,代码来源:PythonWebLauncher.cs


注:本文中的IServiceProvider.GetUIThread方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。