public void CommandButtonCreateExecute(object parameter) { GameOutcome?outcome = EnumManager.ParseEnumString <GameOutcome>(parameter as string); this.ErrorMessage = null; if (tracker.ActiveDeck == null) { this.ErrorMessage += "Please select active deck" + Environment.NewLine; } if (!this.Game.OpponentClass.HasValue) { this.ErrorMessage += "Please select opponent class" + Environment.NewLine; } this.ErrorMessage = this.ErrorMessage?.Trim(); if ((tracker.ActiveDeck != null) && (outcome.HasValue) && this.Game.OpponentClass.HasValue) { UpdateGameData(outcome); DataModel.Game addedGame = this.Game; tracker.Games.Add(this.Game); messanger.Send( new Utils.Messages.EditDeck() { Deck = game.Deck }, Utils.Messages.EditDeck.Context.StatsUpdated); trackerFactory.GetFileManager().SaveDatabase(); this.Game = new DataModel.Game(); //restore values that are likely the same, like game type, player rank etc this.Game.Type = addedGame.Type; this.Game.PlayerRank = addedGame.PlayerRank; this.Game.PlayerLegendRank = addedGame.PlayerLegendRank; this.BeginEdit(); this.UpdateBindings(); RaisePropertyChangedEvent(String.Empty); } }