示例#1
0
        /// <summary>
        /// Repopulates the team projects and children teams
        ///     returns a started Task so it can be awaited on
        /// </summary>
        private static Task <List <TeamProjectViewModel> > UpdateTeamProjects()
        {
            Task <List <TeamProjectViewModel> > t = Task.Run <List <TeamProjectViewModel> >(() =>
            {
                List <TeamProjectViewModel> result = new List <TeamProjectViewModel>();
                try
                {
                    var projects = FileIssueHelpers.GetProjectsAsync().Result;
                    foreach (var project in projects.OrderBy(project => project.Name))
                    {
                        var vm = new TeamProjectViewModel(project, new List <TeamProjectViewModel>());
                        result.Add(vm);
                    }
                    PopulateTreeviewWithTeams(result);
                    return(result);
                }
#pragma warning disable CA1031 // Do not catch general exception types
                catch (Exception e)
                {
                    e.ReportException();
                    return(null);
                }
#pragma warning restore CA1031 // Do not catch general exception types
            });

            return(t);
        }
        /// <summary>
        /// Repopulates the team projects and children teams
        ///     returns a started Task so it can be awaited on
        /// </summary>
        private static Task <List <TeamProjectViewModel> > UpdateTeamProjects()
        {
            Task <List <TeamProjectViewModel> > t = Task.Run <List <TeamProjectViewModel> >(() =>
            {
                List <TeamProjectViewModel> result = new List <TeamProjectViewModel>();
                try
                {
                    var projects = FileIssueHelpers.GetProjectsAsync().Result;
                    foreach (var project in projects.OrderBy(project => project.Name))
                    {
                        var vm = new TeamProjectViewModel(project, new List <TeamProjectViewModel>());
                        result.Add(vm);
                    }
                    PopulateTreeviewWithTeams(result);
                    return(result);
                }
                catch (Exception)
                {
                    return(null);
                }
            });

            return(t);
        }