public bool Populate(cmnControlData cdata) { if (cdata == null) { return(false); } this._mGroups = new ArrayList(); this.SuspendLayout(); int num = 0; foreach (cmnGroupData group in cdata.GroupList) { System.Type type = group.GetType(); GroupControl groupControl = (GroupControl) new ButtonGroupCtrl(this); if (groupControl.Populate(group)) { groupControl.Left = 20; groupControl.Top = num; groupControl.Width = this.Width; groupControl.Height = groupControl.RestoredHeight; this.Groups.Add(groupControl); this.Controls.Add(groupControl); num = groupControl.Bottom + GroupsPane.GROUP_VERT_SPACE; } else { break; } } this.ReAlignControls(); this.ResumeLayout(true); return(true); }
public static void DeserializeUiLayout() { try { if (CMNControl.UIData != null) { return; } FileStream fileStream = new FileStream(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "CmnUi.xml"), FileMode.Open, FileAccess.Read, FileShare.Read); if (fileStream != null) { XmlSerializer xmlSerializer = (XmlSerializer) new LayoutParser(); if (xmlSerializer != null) { CMNControl.mLayoutData = (cmnControlData)xmlSerializer.Deserialize((Stream)fileStream); } fileStream.Close(); } //cmnControl.DeserializeVariables(); } catch (FileNotFoundException ex) { MessageBox.Show(ex.FileName + " not found!"); } }
private void Write1_AcCalcControlData(string n, string ns, cmnControlData o, bool isNullable, bool needType) { if (o == null) { if (isNullable) { base.WriteNullTagLiteral(n, ns); } return; } if (!needType && o.GetType() != typeof(cmnControlData)) { throw base.CreateUnknownTypeException(o); } base.WriteStartElement(n, ns, o); if (needType) { base.WriteXsiType("AcCalcControlData", ""); } base.WriteAttribute("AllowGroupHide", "", XmlConvert.ToString(o.mbAllowHide)); this.Write2_AcCalcToolbarData("ToolBar", "", o.mToolbarData, false, false); CMNBtnGroupData[] acCalcBtnGroupDataArray = o.mBtnGroups; if (acCalcBtnGroupDataArray != null) { for (int i = 0; i < (int)acCalcBtnGroupDataArray.Length; i++) { this.Write5_AcCalcBtnGroupData("ButtonGroup", "", acCalcBtnGroupDataArray[i], false, false); } } //this.Write12_AcCalcUnitGroupData("UnitsGroup", "", o.mUnitGroup, false, false); //this.Write15_AcCalcVariableGroupData("VariablesGroup", "", o.mVariableGroup, false, false); this.Write8_Size("ESWMinSize", "", o.mESWMinSize, false); this.Write8_Size("ESWDefaultSize", "", o.mESWDefaultSize, false); this.Write20_StringResource("StringResource", "", o.mStringResource, false, false); ArrayList groupList = o.GroupList; if (groupList != null) { base.WriteStartElement("GroupList", ""); for (int j = 0; j < groupList.Count; j++) { this.Write4_Object("anyType", "", groupList[j], true, false); } base.WriteEndElement(); } base.WriteEndElement(o); }