/// <summary> /// Called on activation of the view model. /// </summary> protected async override void OnActivate() { _editedArmour = new ArmourProtDisplay(); await Pull(); base.OnActivate(); }
/// <summary> /// Remove armour with the same type as edited armour. /// </summary> public async void Remove(string armourType) { var msg = await _data.Remove(_mapper.Map <ArmourProtModel>(_editedArmour)); if (msg != null) { MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Warning); return; } foreach (var armour in Armours.ToList()) { if (armour.ArmourType == armourType) { Armours.Remove(armour); } } _editedArmour = new ArmourProtDisplay(); SelectedArmour = null; }