public async Task <ObservableCollection <SpaceViewModel> > FetchChildren() { var newSpacesList = new ObservableCollection <SpaceViewModel>(); var spacesResponse = await CloudFoundryService.GetSpacesForOrgAsync(Org); if (spacesResponse.Succeeded) { var spaces = new ObservableCollection <CloudFoundrySpace>(spacesResponse.Content); foreach (CloudFoundrySpace space in spaces) { var newSpace = new SpaceViewModel(space, this, ParentTasExplorer, Services); newSpacesList.Add(newSpace); } } else if (spacesResponse.FailureType == Toolkit.Services.FailureType.InvalidRefreshToken) { Parent.IsExpanded = false; ParentTasExplorer.AuthenticationRequired = true; } else { _dialogService.DisplayErrorDialog(_getSpacesFailureMsg, spacesResponse.Explanation); } return(newSpacesList); }
public async Task <List <SpaceViewModel> > FetchChildren() { var newSpacesList = new List <SpaceViewModel>(); var spaces = await CloudFoundryService.GetSpacesForOrgAsync(Org); foreach (CloudFoundrySpace space in spaces) { var newSpace = new SpaceViewModel(space, Services); newSpacesList.Add(newSpace); } return(newSpacesList); }
protected override async Task LoadChildren() { var spaces = await CloudFoundryService.GetSpacesForOrgAsync(Org); if (spaces.Count == 0) { DisplayText += " (no spaces)"; } var updatedSpacesList = new ObservableCollection <TreeViewItemViewModel>(); foreach (CloudFoundrySpace space in spaces) { updatedSpacesList.Add(new SpaceViewModel(new CloudFoundrySpace(space.SpaceName, space.SpaceId, Org), Services)); } Children = updatedSpacesList; }
protected internal override async Task LoadChildren() { var spacesResponse = await CloudFoundryService.GetSpacesForOrgAsync(Org); if (spacesResponse.Succeeded) { if (spacesResponse.Content.Count == 0) { var noChildrenList = new ObservableCollection <TreeViewItemViewModel> { EmptyPlaceholder, }; Children = noChildrenList; HasEmptyPlaceholder = true; } else { var updatedSpacesList = new ObservableCollection <TreeViewItemViewModel>(); foreach (CloudFoundrySpace space in spacesResponse.Content) { var newSpace = new SpaceViewModel(space, this, ParentTasExplorer, Services); updatedSpacesList.Add(newSpace); } Children = updatedSpacesList; HasEmptyPlaceholder = false; } IsLoading = false; } else { IsLoading = false; _dialogService.DisplayErrorDialog(_getSpacesFailureMsg, spacesResponse.Explanation); IsExpanded = false; } }