Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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]);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void UpdateConditional(int n, int?conditionalIndex = null)
        {
            List <int> selectedItems = null;

            if (conditionalIndex.HasValue)
            {
                selectedItems = ItemList[n].Conditional[conditionalIndex.Value];
            }
            ItemSelectorForm ItemSelect = new ItemSelectorForm(selectedItems);
            DialogResult     R          = ItemSelect.ShowDialog();

            if (R == DialogResult.OK)
            {
                List <int> Returned = ItemSelectorForm.ReturnItems;
                if (Returned.Count == 0)
                {
                    return;
                }
                ;
                if (conditionalIndex.HasValue)
                {
                    ItemList[n].Conditional[conditionalIndex.Value] = Returned;
                }
                else
                {
                    ItemList[n].Conditional.Add(Returned);
                }
                FillConditional(n);
            }
            ;
        }
Ejemplo n.º 4
0
        private void UpdateDependence(int n)
        {
            ItemSelectorForm ItemSelect = new ItemSelectorForm();
            DialogResult     R          = ItemSelect.ShowDialog();

            if (R == DialogResult.OK)
            {
                List <int> Returned = ItemSelectorForm.ReturnItems;
                if (Returned.Count == 0)
                {
                    return;
                }
                ;
                for (int i = 0; i < Returned.Count; i++)
                {
                    if (!ItemList[n].Dependence.Contains(Returned[i]))
                    {
                        ItemList[n].Dependence.Add(Returned[i]);
                    }
                    ;
                }
                ;
                FillDependence(n);
            }
            ;
        }
Ejemplo n.º 5
0
        private void button_goto_Click(object sender, EventArgs e)
        {
            var itemSelect = new ItemSelectorForm(checkboxes: false);
            var result     = itemSelect.ShowDialog();

            if (result == DialogResult.OK && ItemSelectorForm.ReturnItems.Any())
            {
                var itemIndex = ItemSelectorForm.ReturnItems.First();
                nItem.Value = itemIndex;
            }
        }
Ejemplo n.º 6
0
        private void bAddLevel_Click(object sender, EventArgs e)
        {
            var form = new ItemSelectorForm(ItemUtils.AllLocations(), Enumerable.Empty <Item>());

            form.ShowDialog();

            if (form.DialogResult == DialogResult.OK && form.ReturnItems.Count > 0)
            {
                Result.Add(form.ReturnItems);

                tHintPriorities.SuspendLayout();
                AddItems(form.ReturnItems, false);
                tHintPriorities.ResumeLayout();
            }
        }
Ejemplo n.º 7
0
        private void lConditional_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var index = lConditional.IndexFromPoint(e.Location);

            if (index != ListBox.NoMatches)
            {
                var conditions = ItemList[n].Conditional[index];
                if (conditions.Count == 1)
                {
                    nItem.Value = conditions[0];
                }
                else
                {
                    var itemSelect = new ItemSelectorForm(checkboxes: false, highlightedItems: conditions);
                    var result     = itemSelect.ShowDialog();
                    if (result == DialogResult.OK && ItemSelectorForm.ReturnItems.Any())
                    {
                        var itemIndex = ItemSelectorForm.ReturnItems.First();
                        nItem.Value = itemIndex;
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void editButton_Click(object sender, EventArgs e)
        {
            var control = (Control)sender;
            var index   = tHintPriorities.GetRow(control);

            var form = new ItemSelectorForm(ItemUtils.AllLocations(), Result[index]);

            form.ShowDialog();

            if (form.DialogResult == DialogResult.OK)
            {
                if (form.ReturnItems.Count > 0)
                {
                    Result[index] = form.ReturnItems;
                    var label = (Label)tHintPriorities.GetControlFromPosition(3, index);
                    label.Text = string.Join(", ", Result[index].Select(item => item.Location()));
                }
                else
                {
                    DeleteRow(index);
                }
            }
        }