Ejemplo n.º 1
0
        private async Task InitForm()
        {
            try
            {
                IsBusy = true;
                var project = SimpleIoc.Default.GetInstance <IterationsListViewModel>()?.Project;
                if (project != null)
                {
                    _projectName = project.Name;
                    var iterations = await _tfsService.GetIterations(project.Id, project.DefaultTeam.Id);

                    var teamMembers = await _tfsService.GetTeamMembers(project.Id, project.DefaultTeam.Id);

                    TeamMembers = new ObservableCollection <string>(teamMembers.Value.Select(m => m.DisplayName));
                    Iterations  = new ObservableCollection <string>(iterations.Value.Select(i => $"{project.Name}\\{i.Name}"));
                }
                else
                {
                    // something went terribly wrong - invalid app state
                    GoBack();
                }
            }
            catch (ServiceException e)
            {
                HandleServiceException(e);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 2
0
        private async Task GetProjectDetails(string id)
        {
            try
            {
                IsBusy  = true;
                Project = await _tfsService.GetProject(id);

                var iterations = await _tfsService.GetIterations(id, _project.DefaultTeam.Id);

                if (iterations.Value.Any())
                {
                    Iterations = new ObservableCollection <Iteration>(iterations.Value);
                    var now = DateTime.Now;
                    var selectedIteration = Iterations.FirstOrDefault(i => i.Attributes.StartDate.HasValue && i.Attributes.StartDate.Value <= now &&
                                                                      i.Attributes.EndDate.HasValue && i.Attributes.EndDate.Value >= now) ?? Iterations.First();
                    await SetIteration(selectedIteration);
                }
            }
            catch (ServiceException e)
            {
                HandleServiceException(e);
            }
            finally
            {
                IsBusy = false;
            }
        }