コード例 #1
0
        private void SetItemSource()
        {
            ShowProgressBar();
            Task.Factory.StartNew(() =>
            {
                Task.Delay(5000);
                projs = VSTSService.GetVSTSProjects();
            }).ContinueWith(async(Task t) =>
            {
                await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    source = new List <ItemDetails>();

                    foreach (var proj in projs)
                    {
                        source.Add(new ItemDetails(proj.Name));
                    }
                    itemSource = AlphaKeyGroup <ItemDetails> .CreateGroups(source,
                                                                           CultureInfo.CurrentUICulture, s => s.Name, true);

                    ((CollectionViewSource)Resources["ProjectGroups"]).Source = itemSource;

                    manuallyselected = true;
                    HideProgressBar();
                });
            });
        }
コード例 #2
0
        private void ShowDefintionDetails()
        {
            if (releaseDefList == null || releaseDefList.Count < 1 || ifRefresh)
            {
                ShowProgressBar();
                Task.Factory.StartNew(() =>
                {
                    releaseDefList = VSTSService.GetReleaseDefinitions();
                }).ContinueWith(async(Task t) =>
                {
                    await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        if (releaseDefList != null)
                        {
                            source = new List <ItemDetails>();

                            foreach (var bd in releaseDefList)
                            {
                                source.Add(new ItemDetails(bd.Name));
                            }
                            itemSource = AlphaKeyGroup <ItemDetails> .CreateGroups(source,
                                                                                   CultureInfo.CurrentUICulture, s => s.Name, true);

                            ((CollectionViewSource)Resources["DefinitionGroups"]).Source = itemSource;
                            manuallyselected = true;
                            HideProgressBar();
                        }
                        else
                        {
                            Utility.ShowMsg("Unable to get release definitions list. Check internet connection and try again later.");
                        }
                    });
                });
            }
            else
            {
                ((CollectionViewSource)Resources["DefinitionGroups"]).Source = itemSource;
                manuallyselected = true;
            }
        }
コード例 #3
0
        private void LoadDataAndSetPIItems()
        {
            Pivot p = BuildP;

            if (p != null)
            {
                PivotItem pi = p.SelectedItem as PivotItem;
                if (pi != null)
                {
                    if (pi.Name.Equals("definitionsPI"))
                    {
                        if (buildDefList == null || buildDefList.Count < 1 || ifRefresh)
                        {
                            ShowProgressBar();
                            Task.Factory.StartNew(() =>
                            {
                                buildDefList = VSTSService.GetBuildDefinitions();
                            }).ContinueWith(async(Task t) =>
                            {
                                await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                                {
                                    source = new List <ItemDetails>();

                                    foreach (var bd in buildDefList)
                                    {
                                        source.Add(new ItemDetails(bd.Name));
                                    }
                                    itemSource = AlphaKeyGroup <ItemDetails> .CreateGroups(source,
                                                                                           CultureInfo.CurrentUICulture, s => s.Name, true);

                                    ((CollectionViewSource)Resources["DefinitionGroups"]).Source = itemSource;
                                    manuallyselected = true;
                                    HideProgressBar();
                                }
                                                               );
                            });
                        }
                        else
                        {
                            ((CollectionViewSource)Resources["DefinitionGroups"]).Source = itemSource;
                            manuallyselected = true;
                        }
                    }
                    else if (pi.Name.Equals("completedBuildsPI"))
                    {
                        if (completedBuildsList == null || completedBuildsList.Count < 1 || ifRefresh)
                        {
                            ShowProgressBar();
                            Task.Factory.StartNew(() =>
                            {
                                completedBuildsList = VSTSService.GetBuilds();
                            }).ContinueWith(async(Task t) =>
                            {
                                await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                                {
                                    completedBuildsLV.ItemsSource = completedBuildsList;
                                    HideProgressBar();
                                });
                            });
                        }
                        else
                        {
                            completedBuildsLV.ItemsSource = completedBuildsList;
                        }
                    }
                    else if (pi.Name.Equals("queuedBuildsPI"))
                    {
                        if (queuedBuildsList == null || queuedBuildsList.Count < 1 || ifRefresh)
                        {
                            ShowProgressBar();
                            Task.Factory.StartNew(() =>
                            {
                                queuedBuildsList = VSTSService.GetQueuedBuilds();
                            }).ContinueWith(async(Task t) =>
                            {
                                await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                                {
                                    queuedBuildsLV.ItemsSource = queuedBuildsList;
                                    HideProgressBar();
                                });
                            });
                        }
                        else
                        {
                            queuedBuildsLV.ItemsSource = queuedBuildsList;
                        }
                    }
                    //else if(pi.Name.Equals(""))
                    //{
                    //    showCB();
                    //}
                    ifRefresh = false;
                }
            }
        }