private void BCA_ColorButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (Collection.SelectedItem() == null || tb_price.Text == string.Empty || Convert.ToInt32(tb_price.Text) <= 0 || tb_quantity.Text == string.Empty || Convert.ToInt32(tb_quantity.Text) <= 0) { return; } selected_index = Collection.SelectedIndex(); SelectedCard?.Invoke((PlayerCard)Collection.SelectedItem(), Convert.ToInt32(tb_price.Text), Convert.ToInt32(tb_quantity.Text)); }
// method to select card private void ButtonClick(object sender, EventArgs e) { // catch what card has been clicked Button btnClicked = (Button)sender; btnClicked.IsEnabled = false; // get the number of the card int selectedCard = int.Parse(btnClicked.Name.Remove(0, 3)); // fires event to pick card SelectedCard?.Invoke(selectedCard, null); }
private void CardClick(TR card) { if (IsSelf == false || card.IsEnabled == false || card.Visible == false) { return; //because you can't do anything anyways. hopefully this simple. } if (card.IsSelected == true) { card.IsSelected = false; return; } CardList.UnselectAllObjects(); card.IsSelected = true; SelectedCard?.Invoke(); }