private void DeleteButton_Click(object sender, RoutedEventArgs e) { Button button = (Button)sender; CurrencyRankInventoryContainer item = (CurrencyRankInventoryContainer)button.DataContext; this.DeleteItem(item); }
private void EditButton_Click(object sender, RoutedEventArgs e) { Button button = (Button)sender; CurrencyRankInventoryContainer item = (CurrencyRankInventoryContainer)button.DataContext; if (item.Inventory != null) { InventoryWindow window = new InventoryWindow(item.Inventory); window.Closed += Window_Closed; window.Show(); } else { CurrencyWindow window = new CurrencyWindow(item.Currency); window.Closed += Window_Closed; window.Show(); } }
public async void DeleteItem(CurrencyRankInventoryContainer item) { await this.Window.RunAsyncOperation(async() => { if (await MessageBoxHelper.ShowConfirmationDialog("Are you sure you wish to delete this?")) { if (item.Inventory != null) { await item.Inventory.Reset(); ChannelSession.Settings.Inventories.Remove(item.Inventory.ID); } else { await item.Currency.Reset(); ChannelSession.Settings.Currencies.Remove(item.Currency.ID); } this.RefreshList(); } }); }