/// <summary> /// Fills the slot canvas with instances according to given slot definition. /// </summary> /// <param name="slotCanvas">The slot canvas that will be filled.</param> /// <param name="slot">The slot definition.</param> public void FillSlot(SlotCanvas slotCanvas, SlotDefinition slot) { //recursive check is required only for diagram items //filling some slots - only some of its children can be recursive slotCanvas.SetOwner(this); var ancestors = new HashSet<DiagramItemDefinition>(); var current = this; while (current != null) { ancestors.Add(current.Definition); current = current.ParentItem; } foreach (var itemReference in slot.References) { var itemDefinition = DiagramContext.Diagram.GetItemDefinition(itemReference.DefinitionID); var item = new DiagramItem(itemDefinition, this, slotCanvas); item.IsRecursive = ancestors.Contains(itemDefinition); DiagramContext.Provider.InitializeItemDrawing(item); slotCanvas.Children.Add(item); } }
/// <summary> /// Add drawing slot to current definition. /// </summary> /// <param name="slot">Added slot.</param> public void AddSlot(SlotDefinition slot) { _slots.Add(slot); }