/// <summary> /// Pobiera kolekcje z bazy danych i pakuje je w kontenery /// </summary> private async Task GetContainers() { try { HttpWorkItemCollectionClient client = new HttpWorkItemCollectionClient(); IEnumerable <WorkItemCollectionPublic> response = await client.GetAllWorkItemCollections(mTaskBoard.ID).ConfigureAwait(false); foreach (WorkItemCollectionPublic wic in response) { wic.WorkItems = new List <WorkItemPublic>(); await GetWorkItems(wic).ConfigureAwait(false); } await Application.Current.Dispatcher.BeginInvoke(() => { foreach (WorkItemCollectionPublic wic in response) { ContainerCollection.Add(new CtrlWorkItemContainer(mContext, wic)); } }); } catch (Exception ex) { mContext.DialogBuilder.ErrorDialog("Could not retrieve collections, due to server error.", ex); } }
/// <summary> /// Metoda dodajaca nowy kontener do obserwowalnej kolekcji kontenerow /// </summary> private async Task AddContainer() { try { HttpWorkItemCollectionClient client = new HttpWorkItemCollectionClient(); WorkItemCollectionPublic workItemCollection = new WorkItemCollectionPublic() { Name = "Unnamed Collection", TaskBoardID = mTaskBoard.ID }; WorkItemCollectionPublic response = await client.CreateWorkItemCollection(workItemCollection).ConfigureAwait(false); response.WorkItems = new List <WorkItemPublic>(); await Application.Current.Dispatcher.BeginInvoke(() => { ContainerCollection.Add(new CtrlWorkItemContainer(mContext, response)); }); } catch (Exception ex) { mContext.DialogBuilder.ErrorDialog("Could not create a collection, due to server error.", ex); } }
private async Task UpdateWorkItemCollection() { try { HttpWorkItemCollectionClient client = new HttpWorkItemCollectionClient(); await client.UpdateWorkItemCollection(WorkItemCollection).ConfigureAwait(false); } catch (Exception) { mContext.DialogBuilder.ErrorDialog("Could not update collection, due to server error."); } }
private async Task DeleteWorkItemCollection() { try { HttpWorkItemCollectionClient client = new HttpWorkItemCollectionClient(); await client.DeleteWorkItemCollection(WorkItemCollection.ID).ConfigureAwait(false); await Application.Current.Dispatcher.BeginInvoke(() => { mContext.WorkItemMediator.UpdateCollection(WorkItemCollection); mContext.WorkItemMediator.UpdateWorkItems(); mContext.DialogBuilder.SuccessDialog("Collection was successfully deleted"); }); } catch (Exception) { mContext.DialogBuilder.ErrorDialog("Could not delete collection, due to server error."); } }