void IActivationSite.TunnelActivation() { if (this.lastActiveChildSite == null) { if (this.host != null) { // We need to pick one. Pick the biggest one by area. var slotTable = new Dictionary <string, ActivatableTabControl>(); foreach (var child in this.host.Children.OfType <ActivatableTabControl>()) { slotTable[SlotPanel.GetSlotName(child)] = child; } var pair = slotTable.OrderBy(kvp => kvp.Value.ActualHeight * kvp.Value.ActualWidth).FirstOrDefault(); this.lastActiveChildSite = pair.Value; } } if (this.lastActiveChildSite != null) { this.lastActiveChildSite.TunnelActivation(); } }
void UpdateSlotTable() { if (slotTable == null || !slotStructureValid) { slotTable = new Dictionary <string, SlotData>(); topSlotData.Slot.Children.Clear(); if (SlotDefinition != null) { topSlotData.Slot.Children.Add(SlotDefinition); AddSlotToTable(SlotDefinition); } foreach (UIElement element in InternalChildren) { if (element != null) { string name = SlotPanel.GetSlotName(element) ?? ""; SlotData data; if (!slotTable.TryGetValue(name, out data)) { data = topSlotData; } if (data.Elements == null) { data.Elements = new List <UIElement>(); } data.Elements.Add(element); } } topSlotData.Slot.ElementCount = (topSlotData.Elements != null) ? topSlotData.Elements.Count : 0; foreach (var slotData in slotTable.Values) { slotData.Slot.ElementCount = (slotData.Elements != null) ? slotData.Elements.Count : 0; } slotStructureValid = true; } }