private void PositionBlank_Click(object sender, MouseButtonEventArgs e) { if (sender is PositionBlank) { if (SelectedBuff != null) { SelectedBuff.ChangeBackground(Brushes.LightGray); } if (SelectedBuff == sender as PositionBlank) { ChangeRow.Height = new GridLength(0); SelectedBuff = null; } else { //SelectedBuff.ChangeBackground(Brushes.LightGray); SelectedBuff = sender as PositionBlank; ProdName.Text = SelectedBuff.GetNames(); if (SelectedBuff.GetPosition() == 1) { InsertAmount.Text = Convert.ToString(SelectedBuff.GetAmount()); ChangeRow.Height = new GridLength(0); } else { InsertAmount.Text = "0"; ChangeRow.Height = new GridLength(50); } } } }
private void DeleteCourtElement() { if (SelectedBuff != null) { int id; int buff; int i; int j = 0; PositionBlank[] NewCourt = new PositionBlank[Court.Length - 1]; id = SelectedBuff.GetId(); buff = Storage[id].GetAmount() + SelectedBuff.GetAmount(); Storage[id].ChangeAmount(buff); CourtViewer.Children.Remove(SelectedBuff); for (i = 0; i < Court.Length; i++) { if (Court[i] != SelectedBuff) { NewCourt[j] = Court[i]; j++; } } Court = NewCourt; } }