private void ButtonDeleteClick(object sender, EventArgs e) { if (listBoxFileNames.Items.Count == 0) { return; } int oldComboBoxIndex = comboBoxTexts.SelectedIndex; string target = GetSelectedFileName(); XmlNode node = _compareDoc.DocumentElement.SelectSingleNode("Item[.='" + target + "']"); if (node != null) { _compareDoc.DocumentElement.RemoveChild(node); if (Additions != null && Additions.Count > 0) { for (int i = Additions.Count - 1; i >= 0; i--) { if (Additions[i].Name == target) { Additions.RemoveAt(i); Refill(Additions); break; } } } Refill(Additions); if (Additions == null || Additions.Count == 0) { if (oldComboBoxIndex < comboBoxTexts.Items.Count) { comboBoxTexts.SelectedIndex = oldComboBoxIndex; } } } }
private void ButtonDeleteClick(object sender, EventArgs e) { if (listBoxFileNames.Items.Count == 0) { return; } int oldComboBoxIndex = comboBoxTexts.SelectedIndex; string target = GetSelectedFileName(); if (_binOcrDb != null) { BinaryOcrBitmap bob = GetSelectedBinOcrBitmap(); if (bob != null) { if (bob.ExpandCount > 0) { _binOcrDb.CompareImagesExpanded.Remove(bob); } else { _binOcrDb.CompareImages.Remove(bob); } if (Additions != null && Additions.Count > 0) { for (int i = Additions.Count - 1; i >= 0; i--) { if (Additions[i].Name == bob.Key) { Additions.RemoveAt(i); Refill(Additions); break; } } } Refill(Additions); } if (oldComboBoxIndex >= 0 && oldComboBoxIndex < comboBoxTexts.Items.Count) { comboBoxTexts.SelectedIndex = oldComboBoxIndex; } return; } XmlNode node = _compareDoc.DocumentElement.SelectSingleNode("Item[.='" + target + "']"); if (node != null) { _compareDoc.DocumentElement.RemoveChild(node); if (Additions != null && Additions.Count > 0) { for (int i = Additions.Count - 1; i >= 0; i--) { if (Additions[i].Name == target) { Additions.RemoveAt(i); Refill(Additions); break; } } } Refill(Additions); if (Additions == null || Additions.Count == 0) { if (oldComboBoxIndex < comboBoxTexts.Items.Count) { comboBoxTexts.SelectedIndex = oldComboBoxIndex; } } } }