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


C# Automation.ProgressRecord类代码示例

本文整理汇总了C#中System.Management.Automation.ProgressRecord的典型用法代码示例。如果您正苦于以下问题:C# ProgressRecord类的具体用法?C# ProgressRecord怎么用?C# ProgressRecord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProgressRecord类属于System.Management.Automation命名空间,在下文中一共展示了ProgressRecord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetByWebAppName

        private void GetByWebAppName()
        {
            const string progressDescriptionFormat = "Progress: {0}/{1} web apps processed.";
            var progressRecord = new ProgressRecord(1, string.Format("Get web apps with name '{0}'", Name), "Progress:");

            WriteProgress(progressRecord);

            var sites = this.ResourcesClient.FilterPSResources(new PSResourceManagerModels.BasePSResourceParameters()
            {
                ResourceType = "Microsoft.Web/Sites"
            }).Where(s => string.Equals(s.Name, Name, StringComparison.OrdinalIgnoreCase)).ToArray();

            var list = new List<Site>();
            for (var i = 0; i < sites.Length; i++)
            {
                var s = sites[i];
                var result = WebsitesClient.GetWebApp(s.ResourceGroupName, s.Name, null);
                if (result != null)
                {
                    list.Add(result);
                }

                progressRecord.StatusDescription = string.Format(progressDescriptionFormat, i + 1, sites.Length);
                progressRecord.PercentComplete = (100 * (i + 1)) / sites.Length;
                WriteProgress(progressRecord);
            }

            WriteObject(list);
        }
开发者ID:kjohn-msft,项目名称:azure-powershell,代码行数:29,代码来源:GetAzureWebApp.cs

示例2: PowwaProgressRecord

		public PowwaProgressRecord(ProgressRecord record)
		{
			if (record != null)
			{
				this.ActivityId = record.ActivityId;
				this.ParentActivityId = record.ParentActivityId;
				this.Activity = record.Activity;
				this.StatusDescription = record.StatusDescription;
				this.CurrentOperation = record.CurrentOperation;
				this.PercentComplete = record.PercentComplete;
				this.RecordType = record.RecordType;
				if (record.SecondsRemaining <= 0)
				{
					this.TimeRemaining = string.Empty;
					return;
				}
				else
				{
					object[] objArray = new object[1];
					objArray[0] = TimeSpan.FromSeconds((double)record.SecondsRemaining);
					this.TimeRemaining = string.Format(CultureInfo.CurrentCulture, "{0}", objArray);
					return;
				}
			}
			else
			{
				throw new ArgumentNullException("record");
			}
		}
开发者ID:nickchal,项目名称:pash,代码行数:29,代码来源:PowwaProgressRecord.cs

示例3: HelpSystem_OnProgress

 private void HelpSystem_OnProgress(object sender, HelpProgressInfo arg)
 {
     ProgressRecord progressRecord = new ProgressRecord(0, base.CommandInfo.Name, arg.Activity) {
         PercentComplete = arg.PercentComplete
     };
     base.WriteProgress(progressRecord);
 }
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:GetHelpCommand.cs

示例4: CmdletListener

        //private readonly MemoryStream _MemoryStream = new MemoryStream();

        public CmdletListener(DomainCommand command, ProgressRecord progress)
        {
            //_MemoryStream
            //base.Writer = new StreamWriter();
            _command = command;
            _progress = progress;
        }
开发者ID:Wdovin,项目名称:vc-community,代码行数:9,代码来源:CmdletListener.cs

示例5: RunTransferJob

        protected async Task RunTransferJob(FileTransferJob job, ProgressRecord record)
        {
            this.SetRequestOptionsInTransferJob(job);
            job.AccessCondition = this.AccessCondition;
            job.OverwritePromptCallback = this.ConfirmOverwrite;

            try
            {
                await this.transferJobRunner.RunTransferJob(job,
                        (percent, speed) =>
                        {
                            record.PercentComplete = (int)percent;
                            record.StatusDescription = string.Format(CultureInfo.CurrentCulture, Resources.FileTransmitStatus, (int)percent, Util.BytesToHumanReadableSize(speed));
                            this.OutputStream.WriteProgress(record);
                        },
                        this.CmdletCancellationToken);

                record.PercentComplete = 100;
                record.StatusDescription = Resources.TransmitSuccessfully;
                this.OutputStream.WriteProgress(record);
            }
            catch (OperationCanceledException)
            {
                record.StatusDescription = Resources.TransmitCancelled;
                this.OutputStream.WriteProgress(record);
            }
            catch (Exception e)
            {
                record.StatusDescription = string.Format(CultureInfo.CurrentCulture, Resources.TransmitFailed, e.Message);
                this.OutputStream.WriteProgress(record);
                throw;
            }
        }
开发者ID:hovsepm,项目名称:azure-sdk-tools,代码行数:33,代码来源:StorageFileDataManagementCmdletBase.cs

示例6: AddProgress

 internal void AddProgress(ProgressRecord item)
 {
     if (this.progress != null)
     {
         this.progress.InternalAdd(this.psInstanceId, item);
     }
 }
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:PSInformationalBuffers.cs

示例7: HandleTransferException

 static private void HandleTransferException(Exception e, ProgressRecord record, TaskOutputStream outputStream)
 {
     if (record != null)
     {
         record.StatusDescription = string.Format(CultureInfo.CurrentCulture, Resources.TransmitFailed, e.Message);
         outputStream.WriteProgress(record);
     }
 }
开发者ID:Azure,项目名称:azure-powershell,代码行数:8,代码来源:DataMovementTransferHelper.cs

示例8: Validate

 private static ProgressRecord Validate(ProgressRecord progressRecord)
 {
     if (progressRecord == null)
     {
         throw new ArgumentNullException("progressRecord");
     }
     return progressRecord;
 }
开发者ID:nickchal,项目名称:pash,代码行数:8,代码来源:RemotingProgressRecord.cs

示例9: OnStartTest

 public void OnStartTest()
 {
     ProgressRecord pr = null;
     command.OnTaskStart(pr);
     pr = new ProgressRecord(0, "a", "b");
     pr.PercentComplete = 10;
     command.OnTaskStart(pr);
     Assert.AreEqual(0, pr.PercentComplete);
 }
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:9,代码来源:SetAzureStorageBlobContentTest.cs

示例10: WriteProgress

        public override void WriteProgress(long sourceId, ProgressRecord record)
        {
            var ev = Progress;
            if (null == ev)
            {
                return;
            }

            ev(this, new ProgressRecordEventArgs(sourceId, record));
        }
开发者ID:beefarino,项目名称:bips,代码行数:10,代码来源:HostUI.cs

示例11: ProcessRecord

 protected override void ProcessRecord()
 {
     ProgressRecord progressRecord = new ProgressRecord(this.Id, this.Activity, this.Status) {
         ParentActivityId = this.ParentId,
         PercentComplete = this.PercentComplete,
         SecondsRemaining = this.SecondsRemaining,
         CurrentOperation = this.CurrentOperation,
         RecordType = (this.Completed != 0) ? ProgressRecordType.Completed : ProgressRecordType.Processing
     };
     base.WriteProgress((long) this.SourceId, progressRecord);
 }
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:WriteProgressCommand.cs

示例12: ProgressRecord

 /// <summary>
 /// Cloning constructor (all fields are value types - can treat our implementation of cloning as "deep" copy) 
 /// </summary>
 /// <param name="other"></param>
 internal ProgressRecord(ProgressRecord other)
 {
     _activity = other._activity;
     _currentOperation = other._currentOperation;
     _id = other._id;
     _parentId = other._parentId;
     _percent = other._percent;
     _secondsRemaining = other._secondsRemaining;
     _status = other._status;
     _type = other._type;
 }
开发者ID:40a,项目名称:PowerShell,代码行数:15,代码来源:ProgressRecord.cs

示例13: ProgressNode

		internal ProgressNode(long sourceId, ProgressRecord record) : base(record.ActivityId, record.Activity, record.StatusDescription)
		{
			this.Style = ProgressNode.RenderStyle.FullPlus;
			base.ParentActivityId = record.ParentActivityId;
			base.CurrentOperation = record.CurrentOperation;
			base.PercentComplete = Math.Min(record.PercentComplete, 100);
			base.SecondsRemaining = record.SecondsRemaining;
			base.RecordType = record.RecordType;
			this.Style = ProgressNode.RenderStyle.FullPlus;
			this.SourceId = sourceId;
		}
开发者ID:nickchal,项目名称:pash,代码行数:11,代码来源:ProgressNode.cs

示例14: SafeWriteProgress

 public void SafeWriteProgress(ProgressRecord progress)
 {
     if (CommandRuntime != null)
     {
         WriteProgress(progress);
     }
     else
     {
         Trace.WriteLine(progress.StatusDescription);
     }
 }
开发者ID:Wdovin,项目名称:vc-community,代码行数:11,代码来源:DbDomainCommand.cs

示例15: Create

        internal static ProgressDetails Create(ProgressRecord progressRecord)
        {
            //progressRecord.RecordType == ProgressRecordType.Completed;
            //progressRecord.Activity;
            //progressRecord.

            return new ProgressDetails
            {
                PercentComplete = progressRecord.PercentComplete
            };
        }
开发者ID:modulexcite,项目名称:PowerShellEditorServices,代码行数:11,代码来源:ProgressDetails.cs


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