void onLootSave(object sender, RoutedEventArgs e) { TMLoot loot = (sender as Button).DataContext as TMLoot; if (loot != null) { int index = loots.IndexOf(loot); creature.loots[index].id = loot.id; creature.loots[index].count = loot.units; creature.loots[index].probability = loot.drop; onLoadLoots(); } }
void onLootDelete(object sender, RoutedEventArgs e) { TMLoot loot = (sender as Button).DataContext as TMLoot; if (loot != null) { var result = MessageBox.Show(this, "¿Desea eliminar este loot?", "Confirmar", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result != MessageBoxResult.Yes) { return; } int index = loots.IndexOf(loot); creature.loots.RemoveAt(index); onLoadLoots(); } }