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


C# IProgressIndicator.CreateSubProgress方法代码示例

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


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

示例1: ConvertMethods

        private bool ConvertMethods(IProgressIndicator pi)
        {
            if (base.NewMembers == null) return false;

            const int totalWorkUnits = 3;
            pi.Start(totalWorkUnits);

            var myWorkflow = Workflow as SharedToExtensionWorkflow;
            if (myWorkflow != null)
                Methods = base.NewMembers.OfType<IMethod>().ToList();

            using (var progressIndicator = pi.CreateSubProgress(1.0))
                FindUsages(progressIndicator);

            var isSharedToExtension = (this.Direction == SharedToExtensionWorkflow.WorkflowDirection.SharedToExtension);

            this.Methods.ForEachWithProgress(pi.CreateSubProgress(1.0), "",
                method => {
                    this.Constructors[method.PresentationLanguage].MakeFirstPrameterThis(method, isSharedToExtension, this.Driver);
                    method.GetPsiServices().Caches.Update();
                });

            if (isSharedToExtension)
                using (var progressIndicator = pi.CreateSubProgress(1.0))
                    MakeCallExtension(progressIndicator);
            else
                using (var progressIndicator = pi.CreateSubProgress(1.0))
                    MakeCallShared(progressIndicator);

            return true;
        }
开发者ID:ThatShawGuy,项目名称:VBSharper,代码行数:31,代码来源:SharedToExtensionRefactoring.cs

示例2: Format

        public override ITreeRange Format(
            ITreeNode firstElement,
            ITreeNode lastElement,
            CodeFormatProfile profile,
            IProgressIndicator pi,
            IContextBoundSettingsStore overrideSettingsStore = null)
        {
            ITreeNode firstNode;
            ITreeNode lastNode;

            GetFirstAndLastNode(firstElement, lastElement, out firstNode, out lastNode);

            var contextBoundSettingsStore = this.GetProperContextBoundSettingsStore(overrideSettingsStore, firstNode);

            var globalSettings = GlobalFormatSettingsHelper
                .GetService(firstNode.GetSolution())
                .GetSettingsForLanguage(this.myLanguage, firstNode.GetProjectFileType(), contextBoundSettingsStore);

            using (pi.SafeTotal(4))
            {
                var context = new PsiCodeFormattingContext(this, firstNode, lastNode);
                if (profile != CodeFormatProfile.INDENT)
                {
                    using (IProgressIndicator subPi = pi.CreateSubProgress(2))
                    {
                        using (subPi.SafeTotal(2))
                        {
                            SecretFormattingStage.DoFormat(context, subPi.CreateSubProgress(1));
                            SecretIndentingStage.DoIndent(context, globalSettings, subPi.CreateSubProgress(1), false);
                        }
                    }
                }
                else
                {
                    using (IProgressIndicator subPi = pi.CreateSubProgress(4))
                    {
                        SecretIndentingStage.DoIndent(context, globalSettings, subPi, true);
                    }
                }
            }
            return new TreeRange(firstElement, lastElement);
        }
开发者ID:xsburg,项目名称:ReSharper.NTriples,代码行数:42,代码来源:SecretCodeFormatter.cs

示例3: Process

        public void Process(
            IPsiSourceFile sourceFile,
            IRangeMarker rangeMarkerMarker,
            CodeCleanupProfile profile,
            IProgressIndicator progressIndicator)
        {
            ISolution solution = sourceFile.GetSolution();
            if (!profile.GetSetting(OurDescriptor))
            {
                return;
            }

            INTriplesFile[] files = sourceFile.GetPsiFiles<NTriplesLanguage>().Cast<INTriplesFile>().ToArray();
            using (progressIndicator.SafeTotal("Reformat Psi", files.Length))
            {
                foreach (INTriplesFile file in files)
                {
                    using (IProgressIndicator pi = progressIndicator.CreateSubProgress(1))
                    {
                        using (WriteLockCookie.Create())
                        {
                            var languageService = file.Language.LanguageService();
                            Assertion.Assert(languageService != null, "languageService != null");
                            var formatter = languageService.CodeFormatter;
                            Assertion.Assert(formatter != null, "formatter != null");

                            PsiManager.GetInstance(sourceFile.GetSolution()).DoTransaction(
                                delegate
                                {
                                    if (rangeMarkerMarker != null && rangeMarkerMarker.IsValid)
                                    {
                                        formatter.Format(
                                            solution,
                                            rangeMarkerMarker.DocumentRange,
                                            CodeFormatProfile.DEFAULT,
                                            true,
                                            false,
                                            pi);
                                    }
                                    else
                                    {
                                        formatter.FormatFile(
                                            file,
                                            CodeFormatProfile.DEFAULT,
                                            pi);
                                    }
                                },
                                "Code cleanup");
                        }
                    }
                }
            }
        }
开发者ID:xsburg,项目名称:ReSharper.NTriples,代码行数:53,代码来源:ReformatCode.cs

示例4: Execute

 public override bool Execute(IProgressIndicator pi)
 {
     const int totalWorkUnits = 2;
     pi.Start(totalWorkUnits);
     return base.Execute(pi.CreateSubProgress(1.0)) && ConvertMethods(pi.CreateSubProgress(1.0));
 }
开发者ID:ThatShawGuy,项目名称:VBSharper,代码行数:6,代码来源:SharedToExtensionRefactoring.cs


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