private void OnStoreResult() { var facade = FacadeFactory.Create(); var overview = facade.Get <ResultOverview>(Bootstrap.Results) as ResultOverview; if (overview != null) { // Build the result and store it var paoResult = new PAOResult(); foreach (var item in RecentCards) { var resultItem = new PAOResultItem(); FillResultItem(item, resultItem); paoResult.Items.Add(resultItem); } // Add it to the overview. paoResult.Comment = "Added at " + DateTime.Now.ToShortDateString(); paoResult.DeckTitle = CurrentDeck.Title; overview.Add(paoResult); //TODO: Fire event that a reload is required in the result overview? var eventManager = facade.Get <EventController>(Bootstrap.EventManager); var newCardGameResult = eventManager.GetEvent(Bootstrap.EventNewCardGame); newCardGameResult.Trigger(); } }
private void FillResultItem(PAOItem item, PAOResultItem resultItem) { resultItem.Person = item.Person; resultItem.Action = item.Action; resultItem.Object = item.Object; if (item.RecallOk.HasValue) { if (item.RecallOk.Value) { resultItem.RecallState = 1; } else { resultItem.RecallState = 2; } } }
private void RenderCards() { if (CurrentResultOverview != null) { var id = CurrentResultOverview.Id; var containsKey = resultDict.ContainsKey(id); if (containsKey) { var result = resultDict[id]; var cards = result.Items; var tempList = new List <PAOResultItem>(); foreach (var curItem in cards) { var paoResultItem = new PAOResultItem() { Person = curItem.Person, Action = curItem.Action, Object = curItem.Object, RecallState = curItem.RecallState }; tempList.Add(paoResultItem); } oldCurrentDeck = CurrentResultOverview.Deck; oldComment = CurrentResultOverview.Comment; SelectedCards = new ObservableCollection <PAOResultItem>(tempList); CurrentDeck = CurrentResultOverview.Deck; CurrentComment = CurrentResultOverview.Comment; RaisePropertyChange("SelectedCards"); RaisePropertyChange("CurrentDeck"); RaisePropertyChange("CurrentComment"); } } }