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


C# IDataProvider.GetJobCollectionAsync方法代码示例

本文整理汇总了C#中IDataProvider.GetJobCollectionAsync方法的典型用法代码示例。如果您正苦于以下问题:C# IDataProvider.GetJobCollectionAsync方法的具体用法?C# IDataProvider.GetJobCollectionAsync怎么用?C# IDataProvider.GetJobCollectionAsync使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDataProvider的用法示例。


在下文中一共展示了IDataProvider.GetJobCollectionAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDataAsync

        /// <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()));
            }
//.........这里部分代码省略.........
开发者ID:mmacy,项目名称:azure-batch-samples,代码行数:101,代码来源:MainViewModel.cs


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