public Task RefreshListGroupDice() { return(Task.Run(() => { var listGroupDice = _diceDataBase.GetGroupDice(Bag.ID); //First Login in app if (Bag == null || Bag.ID == 0) { ExecuteResetBagCommand(); } else if (listGroupDice == null || listGroupDice.Count == 0) { DesactiveBag(Bag); return; } GroupDices.Clear(); foreach (var item in listGroupDice) { GroupDices.Add(item); } var taskLog = _diceDataBase.GetLogRollAsync(); var log = taskLog.Result; LogRoll.Clear(); foreach (var item in log) { LogRoll.Add(item); } taskLog.Wait(); })); }
public void ExecuteRollDiceCommand(GroupDice groupDice) { var result = _diceService.RollDice(groupDice); LogRoll.Add(result); _diceDataBase.SaveLogRoll(result); groupDice.LastResult = result.Result; GroupDices.ReportItemChange(groupDice); }
public async void ExecuteResetBagCommand() { IsLoading = true; GroupDices.Clear(); await Task.Run(() => { _diceDataBase.ResetDataBase(); Bag = _diceService.GetDefaultBag(); _diceDataBase.SaveBag(Bag); Task.WaitAll(); RefreshListGroupDice(); IsLoading = false; base.RefreshMasterPage(); } ); }