// // // // ***************************************************************** // **** Initialize MultiPanel() **** // ***************************************************************** private void InitializeMultiPanel(IEngineContainer parentContainer, EngineContainerGui guiContainer) { m_EngineContainerID = parentContainer.EngineContainerID; // Try to create any hudpanels discovered List <HudPanel> newHudPanels = new List <HudPanel>(); foreach (EngineGui engineGui in guiContainer.m_Engines) { if (string.IsNullOrEmpty(engineGui.LowerHudFullName)) { continue; } Control newControl = null; Type guiType = typeof(EngineControl); if (Stringifiable.TryGetType(engineGui.LowerHudFullName, out guiType)) // Check whether this control is known to us! { if (Utilities.GuiCreator.TryCreateControl(out newControl, guiType, engineGui)) { // We have successfully created the desired control. if (newControl is HudPanel) { newHudPanels.Add((HudPanel)newControl); } } } } int maxX = 0; int maxY = 0; this.SuspendLayout(); foreach (HudPanel control in newHudPanels) { if (control != null) // each engine has entry here, even if its null. (but why?) { m_EngineControlList.Add(control.EngineId, control); control.Size = control.SmallestSize; // force panel to be smallest size possible. control.Location = new Point(m_NextPanelXLoc, m_NextPanelYLoc); // update layout control parameters. m_NextPanelXLoc += control.Size.Width; maxX = Math.Max(maxX, control.Location.X + control.Width); maxY = Math.Max(maxY, control.Location.Y + control.Height); this.Controls.Add(control); } }//next engine // Resize myself. this.ClientSize = new Size(maxX, maxY); // make this as small as possible, Cluster will resize again. if (m_EngineControlList.Count == 0) { this.Visible = false; } this.ResumeLayout(false); }//InitializeMultiPanel()
}//end Initialize() // // // // ************************************************* // **** Setup Complete() **** // ************************************************* public void SetupComplete() { // Next, initialize my EngineContainer template m_EngineContainerGui = new EngineContainerGui(); m_EngineContainerGui.EngineContainerID = this.ID; m_EngineContainerGui.DisplayName = this.Name; foreach (Engine engine in m_Engines) { m_EngineContainerGui.m_Engines.AddRange(engine.GetGuiTemplates()); } // Next allow engines to connect to each other. // Engines will assume that all other necessary engines are available. foreach (Engine engine in m_Engines) { engine.SetupComplete(); } }
// ***************************************************************** // **** Constructors **** // ***************************************************************** // public MultiPanel(IEngineContainer parent, EngineContainerGui guiContainer) : this() { InitializeMultiPanel(parent, guiContainer); }// constructor.