Ejemplo n.º 1
0
        private IEnumerable <PictureBox> LoadSlots(int after, Action <Control> enableDragDropContext)
        {
            var generated = new List <PictureBox>();
            int before    = SlotCount;

            SlotCount = after;
            int diff = after - before;

            if (diff > 0)
            {
                AddSlots(diff);
                for (int i = before; i < after; i++)
                {
                    var slot = slots[i];
                    enableDragDropContext(slot);
                    FLP_Slots.Controls.Add(slot);
                    FLP_Slots.SetFlowBreak(slot, true);
                    generated.Add(slot);
                }
            }
            else
            {
                for (int i = before - 1; i >= after; i--)
                {
                    FLP_Slots.Controls.Remove(slots[i]);
                }
            }
            SetLabelVisibility();
            return(generated);
        }
Ejemplo n.º 2
0
 private void AddLabels()
 {
     for (var i = 0; i < names.Length; i++)
     {
         var name = names[i];
         Enum.TryParse <StorageSlotType>(name, out var val);
         var label = new LabelType
         {
             Name     = $"L_{name}",
             Text     = name,
             Type     = val,
             AutoSize = true,
             Visible  = false,
         };
         Labels[i] = label;
         FLP_Slots.Controls.Add(label);
         FLP_Slots.SetFlowBreak(label, true);
     }
 }