/// <summary> /// Removes the User selected Beer Cap from their collection. /// </summary> public void RemoveSelectedCap() { if (SelectedGridItem == null) { MessageBox.Show("Please select a Beer Cap.", "Non-Selection Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (MessageBox.Show($"Do you want to Remove Beer Cap #{SelectedGridItem.Id} from your collection?", "Remove Cap From Collection?", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes) { CollectedCaps.RemoveAt(SelectedGridItem.Id - 1); UpdateBeerCapIds(); CollectedCaps.ToList().SaveCapCollectionToFile(dataTableUser); MessageBox.Show("Beer Cap Removed", "Removed", MessageBoxButton.OK); } }
/// <summary> /// Adds a new Cap to the User's collection. /// </summary> public void AddNewCapForUser() { manager.ShowWindow(new AddNewCapViewModel(dataTableUser, CollectedCaps.ToList()), null, null); TryClose(); }