private CharacterChoices GetCharacter(int id) { CharacterChoices character = null; FileIoStatus = FileIoMessage.None; try { using (CharacterRepo cRepo = new CharacterRepo()) { character = cRepo.GetById(id); }; if (character != null) { FileIoStatus = FileIoMessage.Complete; } else { FileIoStatus = FileIoMessage.RecordNotFound; } } catch (Exception) { FileIoStatus = FileIoMessage.FileAccessError; } return(character); }
public AddCharacterView(CharacterChoices character) { InitializeComponent(); CharacterBusiness charBusiness = new CharacterBusiness(); AddCharVM addChar = new AddCharVM(character); DataContext = addChar; }
public async Task LoadAsync() { foreach (var characterType in (await CharacterChoices.GetAsync()).CharacterTypes) { CharacterTypes.Add(characterType); } PlayerNumbers = GetPlayerNumbers(); }
private void BuildEnemyTeam(CharacterChoices character) { CharacterChoices[] rndIndex = _characters.ToArray(); var rnd = new Random(); int rndId = rnd.Next(1, rndIndex.Length); CharacterChoices rndChoice = rndIndex[rndId]; RandomEnemy = _charBusiness.GetCharacterById(rndChoice.Id); }
public void Add(CharacterChoices character) { try { _characters.Add(character); _dataService.WriteAll(_characters); } catch (Exception) { throw; } }
public void Update(CharacterChoices character) { try { _characters.Remove(_characters.FirstOrDefault(c => c.Id == character.Id)); _characters.Add(character); _dataService.WriteAll(_characters); } catch (Exception) { throw; } }
private void AddCharacter() { CharacterChoices cc = new CharacterChoices(); AddCharacterView av = new AddCharacterView(cc); av.ShowDialog(); if (cc.Rank != 0) { cc.Id = AddId(); _charBusiness.AddCharacter(cc); Characters.Add(cc); } }
private void ConfirmAdd() { ErrMsg = ""; if (IsValidateForm() == true) { _character.Rank = rand.Next(1, 5); _character.Name = AddName; _character.Race = AddRace; _character.Weapon = AddWeapon; _character.Weakness = AddWeakness; _character.Morality = AddMorality; _character.Series = AddSeries; _character = Character; } }
public void AddCharacter(CharacterChoices character) { try { if (character != null) { using (CharacterRepo cRepo = new CharacterRepo()) { cRepo.Add(character); }; FileIoStatus = FileIoMessage.Complete; } } catch (Exception) { FileIoStatus = FileIoMessage.FileAccessError; } }
public void UpdateCharacter(CharacterChoices updatedCharacter) { try { if (GetCharacter(updatedCharacter.Id) != null) { using (CharacterRepo cRepo = new CharacterRepo()) { cRepo.Update(updatedCharacter); } FileIoStatus = FileIoMessage.Complete; } else { FileIoStatus = FileIoMessage.RecordNotFound; } } catch (Exception) { FileIoStatus = FileIoMessage.FileAccessError; } }
public AddCharVM(CharacterChoices character) { _character = character; }