/// <summary> /// Saves the current data to the MacroDesignerTree object. /// </summary> public override void StoreData() { if (CurrentGroup.IsLeaf) { CurrentGroup.GroupOperator = GroupOperator; if (pnlGroups.Controls.Count > 0) { MacroBoolExpression expr = (MacroBoolExpression)pnlGroups.Controls[0]; CurrentGroup.LeftExpression = expr.LeftExpression; CurrentGroup.RightExpression = expr.RightExpression; CurrentGroup.Operator = expr.Operator; } } else { CurrentGroup.GroupOperator = GroupOperator; foreach (Control item in pnlGroups.Controls) { if (item is MacroDesignerGroup) { MacroDesignerGroup group = (MacroDesignerGroup)item; group.StoreData(); } } } }
/// <summary> /// Adds an expression to a child panel controls collection. /// </summary> /// <param name="left">Left part of the expression</param> /// <param name="right">Right part of the expression</param> /// <param name="op">Operator to use</param> /// <param name="idPath">IDPath to ensure unique ID of the control</param> public void AddExpression(string left, string right, string op, string idPath) { // Add control to a controls collection MacroBoolExpression expr = (MacroBoolExpression)this.Page.LoadControl("~/CMSAdminControls/UI/Macros/MacroBoolExpression.ascx"); expr.LeftExpression = left; expr.RightExpression = right; expr.Operator = op; expr.ID = "e" + idPath.Replace(".", "_"); this.pnlGroups.Controls.Add(expr); }