private void UpdateDependence(int n) { _multiItemSelectorForm.SetSelectedItems(null); _multiItemSelectorForm.SetHighlightedItems(null); _multiItemSelectorForm.UpdateItems(); DialogResult R = _multiItemSelectorForm.ShowDialog(); if (R == DialogResult.OK) { var returned = _multiItemSelectorForm.ReturnItems; if (returned.Count == 0) { return; } foreach (var returnedItemId in returned) { var requiredItems = _logic.Logic[n].RequiredItems; if (!requiredItems.Contains(returnedItemId)) { requiredItems.Add(returnedItemId); } } FillDependence(n); } }
private void lConditional_MouseDoubleClick(object sender, MouseEventArgs e) { var index = lConditional.IndexFromPoint(e.Location); if (index != ListBox.NoMatches) { var conditions = _logic.Logic[n].ConditionalItems[index]; var conditionIndices = conditions.ToList(); if (conditionIndices.Count == 1) { nItem.Value = _logic.Logic.IndexOf(_itemsById[conditionIndices[0]]); } else { _singleItemSelectorForm.SetHighlightedItems(conditionIndices); _singleItemSelectorForm.SetShowLocationNames(false); _singleItemSelectorForm.UpdateItems(); var result = _singleItemSelectorForm.ShowDialog(); if (result == DialogResult.OK && _singleItemSelectorForm.ReturnItems.Any()) { var itemId = _singleItemSelectorForm.ReturnItems.First(); nItem.Value = _logic.Logic.IndexOf(_itemsById[itemId]); } } } }