public void CloseLevel(String Level) { for (int i = 0; i < MainDockObjects.Count; i++) { BaseDockObjects.DockItemObject tempDockItem = (BaseDockObjects.DockItemObject)MainDockObjects[i]; if (tempDockItem.DockItemSectionName.StartsWith(Level)) { tempDockItem.Close(); MainDockObjects.RemoveAt(i); i--; } } }
public void RemoveDockItem(BaseDockObjects.DockItemObject ItemToRemove) { String ItemToRemoveSectionHeader = @ItemToRemove.DockItemSectionName + @"-"; CloseLevel(@ItemToRemoveSectionHeader); MainDockObjects.Remove(ItemToRemove); ItemToRemove.Close(); String[] AllSectionNames = DockItemSettings.GetSectionNames(); for (int i = 0; i < AllSectionNames.Length; i++) { if (AllSectionNames[i].StartsWith(ItemToRemoveSectionHeader) && AllSectionNames[i].Substring(ItemToRemoveSectionHeader.Length, AllSectionNames[i].Length - ItemToRemoveSectionHeader.Length).Contains("-") == false) { DockItemSettings.RemoveSection(AllSectionNames[i]); } } DockItemSettings.RemoveSection(ItemToRemoveSectionHeader.Substring(0, ItemToRemoveSectionHeader.Length - 1)); ShowLevel(CurrentLevelShown); }