public static ABCDockPanel AddNewDockPanel(ABCView view) { ABCDockPanel panel = new ABCDockPanel(); panel.Dock = DevExpress.XtraBars.Docking.DockingStyle.Left; DevExpress.XtraBars.Docking.ControlContainer ctrl = new ControlContainer(); ctrl.Dock = DockStyle.Fill; ctrl.Parent = panel; return(panel); }
public static Component LoadComponent(ABCView ViewOwner, XmlNode node) { String strName = node.Attributes["name"].Value.ToString(); String strType = node.Attributes["type"].Value.ToString(); Type type = TypeResolutionService.CurrentService.GetType(strType); if (type == null) { return(null); } #region Node Component comp = null; #region ABCView if (type == typeof(ABCView)) { if (node.Attributes["isRoot"] != null && node.Attributes["isRoot"].Value.ToString() == "true") { #region root DeSerialization(ViewOwner, node); ViewOwner.IsRoot = true; ViewOwner.Name = node.Attributes["name"].Value.ToString(); if (String.IsNullOrWhiteSpace(ViewOwner.Caption)) { ViewOwner.Caption = ViewOwner.Name; } comp = ViewOwner; LoadChildrenComponent(ViewOwner, node, comp); #endregion } else { #region Included ABCView if (ViewOwner.Mode == ViewMode.Design) { comp = (Component)ViewOwner.Surface.DesignerHost.CreateComponent(type); } else { comp = (Component)ABCDynamicInvoker.CreateInstanceObject(type); } DeSerialization(comp, node); ((ABCView)comp).IsRoot = false; Guid iID = ABCHelper.DataConverter.ConvertToGuid(node.Attributes["ID"].Value); STViewsInfo viewInfo = (STViewsInfo) new STViewsController().GetObjectByID(iID); if (viewInfo != null) { ((ABCView)comp).DataField = viewInfo; ViewOwner.ChildrenView.Add((ABCView)comp); } #endregion } ((IABCControl)comp).OwnerView = ViewOwner; ((IABCControl)comp).InitControl(); return(comp); } #endregion #region ABCDockPanel if (type == typeof(DevExpress.XtraBars.Docking.DockPanel) || type == typeof(ABCControls.ABCDockPanel)) { comp = (Component)ABCDockPanel.AddNewDockPanel(ViewOwner); DeSerialization(comp, node); ((ABCDockPanel)comp).InitLayout(ViewOwner, node); return(comp); } #endregion comp = CreateComponent(ViewOwner, type); if (comp is Control) { (comp as Control).SuspendLayout(); } if (comp is IABCControl) { ((IABCControl)comp).OwnerView = ViewOwner; ((IABCControl)comp).InitControl(); } DeSerialization(comp, node); if (comp is IABCCustomControl) { ((IABCCustomControl)comp).InitLayout(ViewOwner, node); } else { LoadChildrenComponent(ViewOwner, node, comp); } #endregion if (comp is Control) { (comp as Control).ResumeLayout(false); } if (comp is ABCSimpleButton) { ViewOwner.ButtonList.Add(comp as ABCSimpleButton); } if (comp is ABCComment) { ViewOwner.CommentList.Add(comp as ABCComment); } return(comp); }
public XmlElement ComponentSerialization(XmlDocument doc, IComponent currentCom) { if (currentCom is ABCView && currentCom == this.Surface.DesignerHost.RootComponent) { ((ABCView)currentCom).Location = new Point(0, 0); } Type type = currentCom.GetType(); XmlElement ele = ABCPresentHelper.Serialization(doc, currentCom, "C"); if (currentCom is ABCView) { if (currentCom == this.Surface.DesignerHost.RootComponent) { ele.SetAttribute("isRoot", "true"); } else { ele.SetAttribute("ID", ((ABCView)currentCom).ViewID.ToString()); CompNameList.Add(currentCom.Site.Name); return(ele); } } #region Get ChildrenNode if (currentCom is ABCGridControl) { ((ABCGridControl)currentCom).GetChildrenXMLLayout(ele); } else if (currentCom is ABCGridBandedControl) { ((ABCGridBandedControl)currentCom).GetChildrenXMLLayout(ele); } else if (currentCom is ABCPivotGridControl) { ((ABCPivotGridControl)currentCom).GetChildrenXMLLayout(ele); } else if (currentCom is ABCTreeList) { ((ABCTreeList)currentCom).GetChildrenXMLLayout(ele); } else if (currentCom is ABCChartBaseControl) { ((ABCChartBaseControl)currentCom).GetChildrenXMLLayout(ele); } else if (currentCom is DevExpress.XtraBars.Docking.DockPanel) { ABCDockPanel.GetChildrenXMLLayout(this, (DevExpress.XtraBars.Docking.DockPanel)currentCom, ele); } else if (currentCom is ABCBindingBaseEdit) { ((ABCBindingBaseEdit)currentCom).GetChildrenXMLLayout(ele); } else if (currentCom is ABCSearchPanel) { ((ABCSearchPanel)currentCom).GetChildrenXMLLayout(this, ele); } //else if ( currentCom is ABCDataPanel ) //{ // ( (ABCDataPanel)currentCom ).GetChildrenXMLLayout( this , ele ); //} else { #region Default Component if (OwnerView != null && OwnerView.Mode == ViewMode.Design) { ComponentDesigner designer = (ComponentDesigner)this.Surface.DesignerHost.GetDesigner(currentCom); if (designer != null && designer.AssociatedComponents != null) { List <XmlElement> lstTemp = new List <XmlElement>(); foreach (object associatedComponent in designer.AssociatedComponents) { XmlElement eleChild = ComponentSerialization(doc, (IComponent)associatedComponent); if (eleChild != null) { ele.AppendChild(eleChild); } } } } else { List <XmlElement> lstTemp = new List <XmlElement>(); foreach (object associatedComponent in (currentCom as Control).Controls) { XmlElement eleChild = ComponentSerialization(doc, (IComponent)associatedComponent); if (eleChild != null) { ele.AppendChild(eleChild); } } } #endregion } #endregion if (OwnerView != null && OwnerView.Mode == ViewMode.Design) { CompNameList.Add(currentCom.Site.Name); } else { CompNameList.Add((currentCom as Control).Name); } return(ele); }