public MultiNodePanel(Panel parent, MultiNode node) : base(parent, node) { Height = PanelHeight + 6; ChildPanel = new Panel(); ChildPanel.BorderStyle = BorderStyle.FixedSingle; ChildPanel.Height = 1; ChildPanel.Width = ClientSize.Width - 35; ChildPanel.Left = 30; ChildPanel.Top = PanelHeight; ChildPanel.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom; Controls.Add(ChildPanel); var cmb = new MultiModeComboBox(); cmb.MultiNode = node; cmb.Top = MarginTop; cmb.Left = MarginLeft; cmb.SelectionChangeCommitted += (s, e) => UpdateLabels(); Controls.Add(cmb); var lbl = new Label(); lbl.Text = "of the following conditions apply:"; lbl.AutoSize = true; lbl.Top = MarginTop + 3; lbl.Left = 70; Controls.Add(lbl); }
/// <summary> /// Injects a new MultiNode into the tree, in place of the current node, and makes the current node a child of the MultiNode. /// </summary> /// <returns>The injected MultiNode</returns> public MultiNode PromoteToMulti() { var multi = new MultiNode(); if (Parent != null) { var i = Parent.Children.IndexOf(this); Parent.Children.Remove(this); Parent.AddNode(multi, i); } multi.AddNode(this); return(multi); }
static private MultiNode BuildMulti(BinaryExpression be, BaseNode parent, bool negate) { var result = new MultiNode(); result.Not = negate; result.Mode = be.NodeType == ExpressionType.AndAlso ? MultiNode.Operator.All : MultiNode.Operator.Any; if ((parent as MultiNode)?.Mode == result.Mode) { (parent as MultiNode).AddNode(BuildFromExpression(be.Left, parent)); (parent as MultiNode).AddNode(BuildFromExpression(be.Right, parent)); return(null); } else { result.AddNode(BuildFromExpression(be.Left, result)); result.AddNode(BuildFromExpression(be.Right, result)); } return(result); }