private void button1_Click(object sender, EventArgs e) { try { if (listBox1.SelectedIndices.Count > 0) { pictureBox1.Image.Dispose(); pictureBox1.InitialImage = null; pictureBox1.Image = null; pictureBox1.Update(); MapModel map = maps[listBox1.SelectedIndices[0]]; deleteImage?.Invoke(map); maps.RemoveAt(listBox1.SelectedIndex); listBox1.Items.RemoveAt(listBox1.SelectedIndex); } } catch (Exception exc) { MessageBox.Show(exc.ToString()); } }
private void onDeleteBtnClicked(object sender, RoutedEventArgs e) { DeleteImage?.Invoke(this, new DeleteImageEventArg { ImageId = ChatItemId }); }