public void RemoveRifle(Models.Rifle rifle) { riflesModel.Delete(rifle); NotifyOfPropertyChange(() => Rifles); eventAggregator.PublishOnBackgroundThread(new AppEvent { Type = Constants.RifleRemovedMessage }); }
public void EditRifle(Models.Rifle rifle) { var editRifleViewModel = new EditRifleViewModel( configurationModel, cartridgesModel, scopesModel, rifle); if (windowManager.ShowDialog(editRifleViewModel) ?? false) { Task.Run(() => { IsBusy = true; BusyText = "Saving rifle changes..."; NotifyOfPropertyChange(() => IsBusy); NotifyOfPropertyChange(() => BusyText); editRifleViewModel.Rifle.IsUsingNonListedAmmo = false; editRifleViewModel.Rifle.IsUsingNonListedScope = false; riflesModel.InsertOrUpdate(editRifleViewModel.Rifle); NotifyOfPropertyChange(() => Rifles); Refresh(); eventAggregator.PublishOnBackgroundThread(new AppEvent { Type = Constants.ConfigurationChangedMessage }); eventAggregator.PublishOnBackgroundThread(new RifleChangedEvent { ChangedRifle = editRifleViewModel.Rifle }); IsBusy = false; NotifyOfPropertyChange(() => IsBusy); }); } }