public DockControl Open(Type type, object key, bool focus) { DockControl control; if (this.controls.TryGetControl(type, key, out control)) { control.Open(); } else { control = (DockControl)Activator.CreateInstance(type); DockControlSettings settings; if (!this.settingsTable.TryGetValue(type, out settings)) { settings = new DockControlSettings(); this.settingsTable.Add(type, settings); } control.Init(key, settings); control.Manager = this; if (control.ShowFloating) { control.OpenFloating(); } else { DockContainer dockContainer = this.FindDockContainer(control.DefaultDockLocation); WindowOpenMethod openMethod = focus ? WindowOpenMethod.OnScreenActivate : WindowOpenMethod.OnScreenSelect; if (dockContainer == null) { control.OpenDocked(control.DefaultDockLocation, openMethod); } else { foreach (TD.SandDock.DockControl existingWindow in this.GetDockControls()) { if (existingWindow != control && existingWindow.LayoutSystem.DockContainer == dockContainer) { control.DockNextTo(existingWindow); ((TD.SandDock.DockControl)control).Open(openMethod); break; } } } } this.controls.Add(type, key, control); } return control; }
internal void Init(object key, DockControlSettings settings) { this.Key = key; this.Settings = settings; this.OnInit(); }
public void SetSettings(SettingsInfo settings) { this.settingsTable.Clear(); foreach (SettingsGroup settingsGroup in settings.Groups) { Type type = Type.GetType(settingsGroup.TypeName, false); if (type != null) { DockControlSettings dockControlSettings = new DockControlSettings(); this.settingsTable.Add(type, dockControlSettings); foreach (SettingsItem settingsItem in settingsGroup.Items) dockControlSettings.SetValue(settingsItem.Key, settingsItem.Value); } } }