Ejemplo n.º 1
0
        /// <summary>
        /// Called on activation of the view model.
        /// </summary>
        protected async override void OnActivate()
        {
            _editedWeapon = new WeaponProtDisplay();
            await Pull();

            base.OnActivate();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Remove weapon with the same type as edited weapon.
        /// </summary>
        public async void Remove(string weaponType)
        {
            var msg = await _data.Remove(_mapper.Map <WeaponProtModel>(_editedWeapon));

            if (msg != null)
            {
                MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            foreach (var weapon in Weapons.ToList())
            {
                if (weapon.WeaponType == weaponType)
                {
                    Weapons.Remove(weapon);
                }
            }
            _editedWeapon  = new WeaponProtDisplay();
            SelectedWeapon = null;
        }