public void SetPanel(ObjectPanelInfo type, Core.Controls.WinForms.ObjectPanel panel) { System.Diagnostics.Debug.Assert(m_panel == null); System.Diagnostics.Debug.Assert(m_loadSpecification == null); m_panelType = type; m_panel = panel; m_objectName = (panel.BoundObject != null) ? panel.BoundObject.FullName : null; this.SetupPanel(); this.UpdateWindowFromPanelState(); }
public void SetupFromLoadSpecification(string[] specification) { if (specification == null) { throw new System.ArgumentNullException(); } System.Diagnostics.Debug.Assert(m_panel == null); System.Diagnostics.Debug.Assert(m_loadSpecification == null); System.Diagnostics.Debug.Assert(m_services != null); System.Diagnostics.Debug.Assert(specification.Length >= 1); m_loadSpecification = specification; m_objectName = (m_loadSpecification.Length > 1) ? m_loadSpecification[1] : null; var panelManager = m_services.Get <IObjectPanelManager>(); m_panelType = panelManager.FindPanel(m_loadSpecification[0]); if (m_panelType != null) { if (m_loadSpecification.Length >= 2) { m_panel = panelManager.CreateObjectWinFormsPanel(m_panelType, m_loadSpecification[1]); } else { m_panel = panelManager.CreateStaticWinFormsPanel(m_panelType); } if (m_panel != null) { this.SetupPanel(); //if (m_panel.IsBindable && m_loadSpecification.Length >= 2) //{ // m_panel.SetObjectReference(); //} this.UpdateWindowFromPanelState(); } else { labelErrorMessage.Text = "Failed to create panel named \"" + specification[0] + "\"."; } } else { labelErrorMessage.Text = "Unable to find panel named \"" + specification[0] + "\"."; } }