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


C# ISolution.GetLifetime方法代码示例

本文整理汇总了C#中ISolution.GetLifetime方法的典型用法代码示例。如果您正苦于以下问题:C# ISolution.GetLifetime方法的具体用法?C# ISolution.GetLifetime怎么用?C# ISolution.GetLifetime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISolution的用法示例。


在下文中一共展示了ISolution.GetLifetime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        /// <summary>
        /// Arranges the BulbItems in the correct section.
        /// </summary>
        /// <param name="menu">
        /// The BulbMenu to add the items too. 
        /// </param>
        ////public void CreateBulbItems(BulbMenu menu)
        ////{
        ////    menu.ArrangeContextActions(this.Items);
        ////}

        /// <summary>
        /// Performs the QuickFix, inserts the configured modifier into the location specified by the violation.
        /// </summary>
        /// <param name="solution">
        /// Current Solution. 
        /// </param>
        /// <param name="textControl">
        /// Current Text Control to modify. 
        /// </param>
        public void Execute(ISolution solution, ITextControl textControl)
        {
            JetBrains.DataFlow.LifetimeDefinition definition = JetBrains.DataFlow.Lifetimes.Define(solution.GetLifetime());
            JetBrains.DataFlow.Lifetime lifetime = definition.Lifetime;
            try
            {
                unsafe
                {
                    ChangeInspectionSeverityDialog dialog = new ChangeInspectionSeverityDialog(lifetime, this.commonIconsComponent);
                    IContextBoundSettingsStore contextBoundSettingsStore =
                        this.settingsStore.BindToContextTransient(ContextRange.Smart(textControl.Document.ToDataContext()));
                    HighlightingSettingsManager.ConfigurableSeverityItem item = this.highlightingSettingsManager.GetSeverityItem(this.HighlightID);

                    dialog.Severity = this.highlightingSettingsManager.GetConfigurableSeverity(this.HighlightID, contextBoundSettingsStore);
                    dialog.SeverityOptionsTitle = string.Format(item.FullTitle + ":");
                    dialog.CanBeError = !item.SolutionAnalysisRequired;

                    if (dialog.ShowDialog(User32Dll.GetForegroundWindow()) == true)
                    {
                        IContextBoundSettingsStore store = contextBoundSettingsStore;
                        if (dialog.SelectedSettingsLayer != null)
                        {
                            store = dialog.SelectedSettingsLayer.Model.SettingsStoreContext;
                        }

                        store.SetIndexedValue(HighlightingSettingsAccessor.InspectionSeverities, this.HighlightID, dialog.Severity);
                    }
                }
            }
            finally
            {
                definition.Terminate();
            }
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:54,代码来源:ChangeStyleCopRuleAction.cs

示例2: ExecutePsiTransaction

        protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            var unitTestSessionManager = solution.GetComponent<IUnitTestSessionManager>();

              var element = solution.GetComponent<MethodRunnerProvider>().CreateElement(myClassDeclaration.GetSourceFile().GetProject(), new ClrTypeName(myClassDeclaration.CLRName), myMethodDeclaration.DeclaredName, myClassDeclaration.IsStatic, myMethodDeclaration.IsStatic);

              var unitTestElementManager = solution.GetComponent<IUnitTestElementManager>();
              unitTestElementManager.AddElement(element);

              var sessionView = unitTestSessionManager.GetSession(SessionID) ?? unitTestSessionManager.CreateSession(id: SessionID);
              sessionView.Title.Value = "Run Method " + myMethodDeclaration.DeclaredName;
              sessionView.Session.AddElement(element);

              var launchLifetime = Lifetimes.Define(solution.GetLifetime(), "MethodRunner");
              launchLifetime.Lifetime.AddAction(() =>
              {
            unitTestElementManager.RemoveElements(new[] {element});
            unitTestSessionManager.CloseSession(sessionView);
              });

              var unitTestResultManager = solution.GetComponent<IUnitTestResultManager>();

              EventHandler<UnitTestResultEventArgs> onUnitTestResultUpdated = (sender, args) =>
              {
            if (args.Element == element && args.Result.RunStatus == UnitTestRunStatus.Completed)
            {
              var exceptions = string.Empty;
              var resultData = unitTestResultManager.GetResultData(args.Element);
              if (resultData.Exceptions.Any())
            exceptions = resultData.Exceptions.First().StackTrace;
              MessageBox.ShowInfo(args.Result.Message + " " + resultData.Output + " " + exceptions);

              // cleanup
              launchLifetime.Terminate();
            }
              };

              unitTestResultManager.UnitTestResultUpdated += onUnitTestResultUpdated;
              launchLifetime.Lifetime.AddAction(() => unitTestResultManager.UnitTestResultUpdated -= onUnitTestResultUpdated);

              sessionView.Run(new UnitTestElements(new[] {element}), solution.GetComponent<ProcessHostProvider>());

              Assembly.LoadFile(typeof(RunMethodTask).Assembly.Location);

              return null;
        }
开发者ID:flcdrg,项目名称:ReSharper-TestToolsPlugin,代码行数:46,代码来源:RunMethodAction.cs


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