public ListofItems() { logicsData = Logics.Instance; this.InitializeComponent(); allItemsListView.ItemsSource = logicsData.GetAllLibraryItems(); HideOption(); }
private async void deleteBtn_Click(object sender, RoutedEventArgs e) { if (allItemsListView.SelectedItem != null) { MessageDialog msg = new MessageDialog("Are you sure to delete this item?"); msg.Commands.Add(new UICommand("Yes")); msg.Commands.Add(new UICommand("No")); IUICommand selectedCommand = await msg.ShowAsync(); if (selectedCommand.Label == "Yes") { logicsData.SelectedItem = (AbstractItem)allItemsListView.SelectedItem; logicsData.removeItem((AbstractItem)allItemsListView.SelectedItem); allItemsListView.ItemsSource = logicsData.GetAllLibraryItems(); } } else { await new MessageDialog("Please select an item to delete!", "No item selected").ShowAsync(); } }