public override void ExecuteCmdlet() { // register the subscription for this service if it has not been before // sebsequent call to register is redundent RegisterSubscriptionWithRdfeForRemoteApp(); switch (DetermineParameterSetName()) { case UploadLocalVhd: { string scriptBlock = "Test-Path -Path " + Path; Collection <bool> pathValid = CallPowershellWithReturnType <bool>(scriptBlock); TemplateImage image = null; if (pathValid[0] == false) { throw new RemoteAppServiceException(Commands_RemoteApp.FailedToValidateVhdPathError, ErrorCategory.ObjectNotFound); } task = new LongRunningTask <NewAzureRemoteAppTemplateImage>(this, "RemoteAppTemplateImageUpload", Commands_RemoteApp.UploadTemplateImageJobDescriptionMessage); task.ProcessJob(() => { image = VerifyPreconditions(); image = StartTemplateUpload(image); UploadVhd(image); task.SetStatus(Commands_RemoteApp.JobCompletionStatusMessage); }); WriteObject(task); break; } case AzureVmUpload: { if (IsFeatureEnabled(EnabledFeatures.goldImageImport)) { ImportTemplateImage(); } else { ErrorRecord er = RemoteAppCollectionErrorState.CreateErrorRecordFromString( string.Format(Commands_RemoteApp.ImportImageFeatureNotEnabledError), String.Empty, Client.Account, ErrorCategory.InvalidOperation ); ThrowTerminatingError(er); } break; } } }
public override void ExecuteCmdlet() { if (AsJob.IsPresent) { task = new LongRunningTask <PublishAzureRemoteAppProgram>(this, "RemoteAppBackgroundTask", "Publish RemoteApp"); task.ProcessJob(() => { PublishAction(); task.SetStatus("ProcessJob completed"); }); } else { PublishAction(); } }
public override void ExecuteCmdlet() { DateTime today = DateTime.Now; CollectionUsageDetailsResult detailsUsage = null; string locale = String.Empty; if (String.IsNullOrWhiteSpace(UsageMonth)) { UsageMonth = today.Month.ToString(); } if (String.IsNullOrWhiteSpace(UsageYear)) { UsageYear = today.Year.ToString(); } locale = System.Globalization.CultureInfo.CurrentCulture.ToString(); detailsUsage = CallClient(() => Client.Collections.GetUsageDetails(CollectionName, UsageYear, UsageMonth, locale), Client.Collections); if (detailsUsage == null) { return; } if (AsJob.IsPresent) { task = new LongRunningTask <GetAzureRemoteAppCollectionUsageDetails>(this, "RemoteAppBackgroundTask", Commands_RemoteApp.UsageDetails); task.ProcessJob(() => { task.SetStatus(Commands_RemoteApp.DownloadingUsageDetails); GetUsageDetails(detailsUsage); task.SetStatus(Commands_RemoteApp.JobComplete); }); WriteObject(task); } else { GetUsageDetails(detailsUsage); } }
public override void ExecuteCmdlet() { if (AsJob.IsPresent) { task = new LongRunningTask <PublishAzureRemoteAppProgram>(this, "RemoteAppBackgroundTask", Commands_RemoteApp.Publish); task.ProcessJob(() => { task.SetStatus(Commands_RemoteApp.Publishing); PublishAction(); task.SetStatus(Commands_RemoteApp.JobComplete); }); WriteObject(task); } else { PublishAction(); } }