• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Automation.ProgressRecord类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnFinishTest

 public void OnFinishTest()
 {
     ProgressRecord pr = null;
     ArgumentException e = new ArgumentException("test");
     command.OnTaskFinish(pr, null);
     pr = new ProgressRecord(0, "a", "b");
     command.OnTaskFinish(pr, null);
     Assert.AreEqual(100, pr.PercentComplete);
     Assert.AreEqual(String.Format(Resources.TransmitSuccessfully), pr.StatusDescription);
     command.OnTaskFinish(pr, e);
     Assert.AreEqual(100, pr.PercentComplete);
     Assert.AreEqual(String.Format(Resources.TransmitFailed, e.Message), pr.StatusDescription);
 }
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:13,代码来源:SetAzureStorageBlobContentTest.cs


示例17: ProgressRecord

 internal ProgressRecord(ProgressRecord other)
 {
     this.parentId = -1;
     this.percent = -1;
     this.secondsRemaining = -1;
     this.activity = other.activity;
     this.currentOperation = other.currentOperation;
     this.id = other.id;
     this.parentId = other.parentId;
     this.percent = other.percent;
     this.secondsRemaining = other.secondsRemaining;
     this.status = other.status;
     this.type = other.type;
 }
开发者ID:nickchal,项目名称:pash,代码行数:14,代码来源:ProgressRecord.cs


示例18: ProgressNode

        ProgressNode(Int64 sourceId, ProgressRecord record)
            :
            base(record.ActivityId, record.Activity, record.StatusDescription)
        {
            Dbg.Assert(record.RecordType == ProgressRecordType.Processing, "should only create node for Processing records");

            this.ParentActivityId = record.ParentActivityId;
            this.CurrentOperation = record.CurrentOperation;
            this.PercentComplete = Math.Min(record.PercentComplete, 100);
            this.SecondsRemaining = record.SecondsRemaining;
            this.RecordType = record.RecordType;
            this.Style = RenderStyle.FullPlus;
            this.SourceId = sourceId;
        }
开发者ID:40a,项目名称:PowerShell,代码行数:14,代码来源:ProgressNode.cs


示例19: ProcessRecord

        protected override void ProcessRecord()
        {
            ProgressRecord pr = new ProgressRecord(1, "Upload file", string.Format("Upload file \"{0}\" into Azure ML Studio", Path.GetFileName(UploadFileName)));
            pr.PercentComplete = 1;
            pr.CurrentOperation = "Uploading...";
            WriteProgress(pr);

            // step 1. upload file
            Task<string> uploadTask = Sdk.UploadResourceAsnyc(GetWorkspaceSetting(), FileFormat, UploadFileName);
            while (!uploadTask.IsCompleted)
            {
                if (pr.PercentComplete < 100)
                    pr.PercentComplete++;
                else
                    pr.PercentComplete = 1;
                Thread.Sleep(500);
                WriteProgress(pr);
            }

            // step 2. generate schema
            pr.PercentComplete = 2;
            pr.StatusDescription = "Generating schema for dataset \"" + DatasetName + "\"";
            pr.CurrentOperation = "Generating schema...";
            WriteProgress(pr);
            JavaScriptSerializer jss = new JavaScriptSerializer();
            dynamic parsed = jss.Deserialize<object>(uploadTask.Result);
            string dtId = parsed["DataTypeId"];
            string uploadId = parsed["Id"];
            string dataSourceId = Sdk.StartDatasetSchemaGen(GetWorkspaceSetting(), dtId, uploadId, DatasetName, Description, UploadFileName);

            // step 3. get status for schema generation
            string schemaJobStatus = "NotStarted";
            while (true)
            {
                if (pr.PercentComplete < 100)
                    pr.PercentComplete++;
                else
                    pr.PercentComplete = 1;
                pr.CurrentOperation = "Schema generation status: " + schemaJobStatus;
                WriteProgress(pr);

                schemaJobStatus = Sdk.GetDatasetSchemaGenStatus(GetWorkspaceSetting(), dataSourceId);
                if (schemaJobStatus == "NotSupported" || schemaJobStatus == "Complete" || schemaJobStatus == "Failed")
                    break;
            }
            pr.PercentComplete = 100;
            WriteProgress(pr);

            WriteObject("Dataset upload status: " + schemaJobStatus);
        }
开发者ID:hning86,项目名称:azuremlps,代码行数:50,代码来源:DatasetCmdlets.cs


示例20: BeginProcessing

        protected override void BeginProcessing()
        {
            ProgressRecord pr = new ProgressRecord(1, "Create Custom Module", string.Format("Upload custom module ZIP file \"{0}\" into Azure ML Studio", CustomModuleZipFileName));
            pr.PercentComplete = 1;
            pr.CurrentOperation = "Uploading custom module ZIP file...";
            WriteProgress(pr);
            string uploadedResourceMetadata = Sdk.UploadResource(GetWorkspaceSetting(), "Zip");
            JavaScriptSerializer jss = new JavaScriptSerializer();
            dynamic m = jss.Deserialize<object>(uploadedResourceMetadata);
            string uploadId = m["Id"];
            Task<string> task = Sdk.UploadResourceInChunksAsnyc(GetWorkspaceSetting(), 1, 0, uploadId, CustomModuleZipFileName, "Zip");
            while (!task.IsCompleted)
            {
                if (pr.PercentComplete < 100)
                    pr.PercentComplete++;
                else
                    pr.PercentComplete = 1;
                Thread.Sleep(500);
                WriteProgress(pr);
            }
            string uploadMetadata = task.Result;
            string activityId = Sdk.BeginParseCustomModuleJob(GetWorkspaceSetting(), uploadMetadata);

            pr.CurrentOperation = "Creating custom module...";
            WriteProgress(pr);
            dynamic statusObj = jss.Deserialize<object>(Sdk.GetCustomModuleBuildJobStatus(GetWorkspaceSetting(), activityId));
            string jobStatus = statusObj[0];
            while (jobStatus == "Pending")
            {
                if (pr.PercentComplete < 100)
                    pr.PercentComplete++;
                else
                    pr.PercentComplete = 1;
                statusObj = jss.Deserialize<object>(Sdk.GetCustomModuleBuildJobStatus(GetWorkspaceSetting(), activityId));
                jobStatus = statusObj[0].ToString();
                Thread.Sleep(500);
                WriteProgress(pr);
            }

            pr.PercentComplete = 100;
            WriteProgress(pr);

            if (jobStatus == "Finished")
            {
                string moduleId = statusObj[1];
                WriteObject(moduleId);
            }
            else
                throw new System.Exception("Custom module upload failed: " + statusObj[1]);
        }
开发者ID:hning86,项目名称:azuremlps,代码行数:50,代码来源:CustomModuleCmdlets.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Automation.ProviderInfo类代码示例发布时间:2022-05-26
下一篇:
C# Automation.PSVariable类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap