Exemple #1
0
 private void updateUiWithTransferProgress(RunbookTransferProgress progress)
 {
     if (progress.Status == RunbookTransferProgress.TransferStatus.Starting)
     {
         if (progress.Job.Operation == RunbookTransferJob.TransferOperation.Download)
         {
             ProgressLabel.Text = "Downloading runbook " + progress.Job.Runbook.Name + "...";
         }
         else
         {
             ProgressLabel.Text = "Uploading runbook " + progress.Job.Runbook.Name + "...";
         }
         if (fileTransferQueue.Count > 0)
         {
             JobsRemainingLabel.Text = "(" + fileTransferQueue.Count + " tasks remaining)";
         }
         else
         {
             JobsRemainingLabel.Text = "";
         }
     }
     else if (progress.Status == RunbookTransferProgress.TransferStatus.Completed)
     {
         ProgressLabel.Text = "";
         progress.Job.Runbook.UpdateSyncStatus();
     }
 }
Exemple #2
0
 private async Task processJobsFromQueue(IProgress <RunbookTransferProgress> progress)
 {
     while (true)
     {
         RunbookTransferJob      job             = fileTransferQueue.Take(); //blocks until there is something to take
         RunbookTransferProgress currentProgress = new RunbookTransferProgress(job);
         progress.Report(currentProgress);
         if (job.Operation == RunbookTransferJob.TransferOperation.Download)
         {
             try
             {
                 await AutomationRunbookManager.DownloadRunbook(job.Runbook, iseClient.automationManagementClient,
                                                                iseClient.currWorkspace, iseClient.accountResourceGroups[iseClient.currAccount].Name, iseClient.currAccount);
             }
             catch (Exception ex)
             {
                 MessageBox.Show("The runbook " + job.Runbook.Name + " could not be downloaded.\r\nError details: " + ex.Message);
             }
         }
         else
         {
             try
             {
                 await AutomationRunbookManager.UploadRunbookAsDraft(job.Runbook, iseClient.automationManagementClient,
                                                                     iseClient.accountResourceGroups[iseClient.currAccount].Name, iseClient.currAccount);
             }
             catch (Exception ex)
             {
                 MessageBox.Show("The runbook " + job.Runbook.Name + " could not be uploaded.\r\nError details: " + ex.Message);
             }
         }
         //await Task.Delay(5000); //simulate work taking longer, for testing
         currentProgress.Status = RunbookTransferProgress.TransferStatus.Completed;
         progress.Report(currentProgress);
     }
 }