/// <summary> /// Gets a specific set of data from the Batch service /// </summary> /// <param name="provider">The provider to retrieve the data with</param> /// <param name="jobSchedules">True if job schedule data should be retrieved</param> /// <param name="jobs">True if job data should be retrieved</param> /// <param name="pools">True if pool data should be retrieved</param> /// <returns></returns> private async Task GetDataAsync(IDataProvider provider, bool jobSchedules, bool jobs, bool pools, bool certificates) { //Turn on the correct wait spinners LeftSpinnerIsVisible = true; UpperRightSpinnerIsVisible = false; LowerRightSpinnerIsVisible = false; try { // // Get all the job schedules // if (jobSchedules) { System.Threading.Tasks.Task<IList<JobScheduleModel>> getJobSchedulesTask = provider.GetJobScheduleCollectionAsync(); AsyncOperationTracker.Instance.AddTrackedOperation(new AsyncOperationModel( getJobSchedulesTask, new AccountOperation(AccountOperation.ListJobSchedules))); this.jobSchedules = new ObservableCollection<JobScheduleModel>(await getJobSchedulesTask); this.jobScheduleCollection = CollectionViewSource.GetDefaultView(this.jobSchedules); this.JobSchedules.Refresh(); FirePropertyChangedEvent("JobSchedules"); FirePropertyChangedEvent("JobScheduleTabTitle"); } this.SelectedJobSchedule = null; // // Get all jobs // if (jobs) { System.Threading.Tasks.Task<IList<JobModel>> getJobTask = provider.GetJobCollectionAsync(this.JobsSearchFilter); AsyncOperationTracker.Instance.AddTrackedOperation(new AsyncOperationModel( getJobTask, new AccountOperation(AccountOperation.ListJobs))); this.jobs = new ObservableCollection<JobModel>(await getJobTask); this.jobCollection = CollectionViewSource.GetDefaultView(this.jobs); this.Jobs.Refresh(); FirePropertyChangedEvent("Jobs"); FirePropertyChangedEvent("JobTabTitle"); } this.SelectedJob = null; // // Get all pools // if (pools) { System.Threading.Tasks.Task<IList<PoolModel>> getPoolsTask = provider.GetPoolCollectionAsync(); AsyncOperationTracker.Instance.AddTrackedOperation(new AsyncOperationModel( getPoolsTask, new AccountOperation(AccountOperation.ListPools))); this.pools = new ObservableCollection<PoolModel>(await getPoolsTask); Pools = CollectionViewSource.GetDefaultView(this.pools); Pools.Refresh(); FirePropertyChangedEvent("Pools"); FirePropertyChangedEvent("PoolTabTitle"); } SelectedPool = null; this.SelectedComputeNode = null; // // Get all certificates // if (certificates) { System.Threading.Tasks.Task<IList<CertificateModel>> getCertificatesTask = provider.GetCertificatesCollectionAsync(); AsyncOperationTracker.Instance.AddTrackedOperation(new AsyncOperationModel( getCertificatesTask, new AccountOperation(AccountOperation.ListCertificates))); this.certificates = new ObservableCollection<CertificateModel>(await getCertificatesTask); Certificates = CollectionViewSource.GetDefaultView(this.certificates); Certificates.Refresh(); FirePropertyChangedEvent("Certificates"); FirePropertyChangedEvent("CertificatesTabTitle"); } SelectedCertificate = null; } catch (Exception e) { Messenger.Default.Send(new GenericDialogMessage(e.ToString())); } finally { //Turn off the wait spinners LowerRightSpinnerIsVisible = false; UpperRightSpinnerIsVisible = false; LeftSpinnerIsVisible = false; } }