Ejemplo n.º 1
0
        private TreeNode ProcessOr(SHXmlCore xmlCore, TreeNode nodeParent, SHOr or)
        {
            if (or == null || nodeParent == null)
            {
                return(null);
            }

            TreeNode nodeThis = new TreeNode(or.GetString(xmlCore));

            nodeThis.ImageIndex         = 5;
            nodeThis.SelectedImageIndex = 5;
            nodeThis.Tag = or;
            nodeParent.Nodes.Add(nodeThis);

            if (or.and != null)
            {
                ProcessAnd(xmlCore, nodeThis, or.and);
            }

            if (or.or != null)
            {
                ProcessOr(xmlCore, nodeThis, or.or);
            }

            for (int i = 0; i < or.dataList.Count; i++)
            {
                SHCondition  cond = or.dataList[i] as SHCondition;
                ListViewItem lvi  = new ListViewItem();

                ProcessCondition(xmlCore, nodeThis, cond);
            }

            return(nodeThis);
        }
        private void pgConditionElement_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            TreeNode     node = null;
            ListView     lv   = null;
            TreeView     tv   = null;
            VelixianForm tab  = null;

            node = tvIConditionDetail.SelectedNode;
            lv   = lvIConditions;
            tv   = tvIConditionDetail;
            tab  = Global._VelixianForms.FindForm("ITEMCONDITION");

            if (node.Tag.GetType() == typeof(SHConditions))
            {
                SHConditions conds = (SHConditions)node.Tag;
                node.Text = conds.GetString(xmlCore);
            }
            else if (node.Tag.GetType() == typeof(SHCondition))
            {
                SHCondition cond = (SHCondition)node.Tag;
                node.Text = cond.GetString(xmlCore);
            }
            else if (node.Tag.GetType() == typeof(SHAnd))
            {
                SHAnd and = (SHAnd)node.Tag;
                node.Text = and.GetString(xmlCore);
            }
            else if (node.Tag.GetType() == typeof(SHOr))
            {
                SHOr or = (SHOr)node.Tag;
                node.Text = or.GetString(xmlCore);
            }

            if (node.Tag != null)
            {
                if (lv.SelectedItems[0].Tag == tv.TopNode.Tag)
                {
                    SHConditions conds = (SHConditions)tv.Nodes[0].Tag;
                    m_ListViewController.SetListText(lv.SelectedItems[0], conds);
                }
            }

            tab.Touch();
        }
Ejemplo n.º 3
0
        public bool CondORClick(object sender, EventArgs e, SHXmlCore xmlCore, TreeView tvList)
        {
            if (tvList.SelectedNode == null || tvList.SelectedNode.Tag == null)
            {
                return(false);
            }

            Type nodeType = tvList.SelectedNode.Tag.GetType();

            SHOr newOr = new SHOr();

            if (nodeType == typeof(SHConditions))
            {
                SHConditions conds = (SHConditions)tvList.SelectedNode.Tag;
                conds.or = newOr;
            }
            else if (nodeType == typeof(SHAnd))
            {
                SHAnd and = (SHAnd)tvList.SelectedNode.Tag;
                and.or = newOr;
            }
            else if (nodeType == typeof(SHOr))
            {
                SHOr or = (SHOr)tvList.SelectedNode.Tag;
                or.or = newOr;
            }
            else if (nodeType == typeof(SHCondition))
            {
                SHCondition cond = (SHCondition)tvList.SelectedNode.Tag;
                cond.or = newOr;
            }
            else
            {
                return(false);
            }

            TreeNode newNode = ProcessOr(xmlCore, tvList.SelectedNode, newOr);

            tvList.SelectedNode = newNode;

            return(true);
        }
Ejemplo n.º 4
0
        public bool CondAddCondClick(object sender, EventArgs e, SHXmlCore xmlCore, TreeView tvList)
        {
            if (tvList.SelectedNode == null || tvList.SelectedNode.Tag == null)
            {
                return(false);
            }

            Type nodeType = tvList.SelectedNode.Tag.GetType();

            SHCondition newCondition = new SHCondition();

            newCondition.Compile();
            newCondition.Build(xmlCore);

            if (nodeType == typeof(SHConditions))
            {
                SHConditions conds = (SHConditions)tvList.SelectedNode.Tag;
                conds.dataList.Add(newCondition);
            }
            else if (nodeType == typeof(SHAnd))
            {
                SHAnd and = (SHAnd)tvList.SelectedNode.Tag;
                and.dataList.Add(newCondition);
            }
            else if (nodeType == typeof(SHOr))
            {
                SHOr or = (SHOr)tvList.SelectedNode.Tag;
                or.dataList.Add(newCondition);
            }
            else
            {
                return(true);
            }

            TreeNode newNode = ProcessCondition(xmlCore, tvList.SelectedNode, newCondition);

            tvList.SelectedNode = newNode;


            return(true);
        }
Ejemplo n.º 5
0
        public bool CondDelClick(object sender, EventArgs e, SHXmlCore xmlCore, TreeView tvList, ListView lvMainList)
        {
            SHConditions conds = tvList.Tag as SHConditions;


            if (tvList == null || conds == null || lvMainList == null || tvList.SelectedNode == null)
            {
                return(false);
            }

            TreeNode selectedNode = tvList.SelectedNode;

            if (selectedNode == null || selectedNode.Tag == null)
            {
                return(false);
            }

            if (selectedNode.Tag.GetType() == typeof(SHAnd))
            {
                SHAnd and = selectedNode.Tag as SHAnd;

                if (selectedNode.Parent.Tag.GetType() == typeof(SHConditions))
                {
                    SHConditions parentConditions = (SHConditions)selectedNode.Parent.Tag;
                    parentConditions.and = null;
                }
                else if (selectedNode.Parent.Tag.GetType() == typeof(SHAnd))
                {
                    SHAnd parentAnd = (SHAnd)selectedNode.Parent.Tag;
                    parentAnd.and = null;
                }
                else if (selectedNode.Parent.Tag.GetType() == typeof(SHOr))
                {
                    SHOr parentOr = (SHOr)selectedNode.Parent.Tag;
                    parentOr.and = null;
                }
                else if (selectedNode.Parent.Tag.GetType() == typeof(SHCondition))
                {
                    SHCondition parentCondition = (SHCondition)selectedNode.Parent.Tag;
                    parentCondition.and = null;
                }
                else
                {
                    return(false);
                }
            }
            else if (selectedNode.Tag.GetType() == typeof(SHOr))
            {
                SHOr or = selectedNode.Tag as SHOr;

                if (selectedNode.Parent.Tag.GetType() == typeof(SHConditions))
                {
                    SHConditions parentConditions = (SHConditions)selectedNode.Parent.Tag;
                    parentConditions.or = null;
                }
                else if (selectedNode.Parent.Tag.GetType() == typeof(SHAnd))
                {
                    SHAnd parentAnd = (SHAnd)selectedNode.Parent.Tag;
                    parentAnd.or = null;
                }
                else if (selectedNode.Parent.Tag.GetType() == typeof(SHOr))
                {
                    SHOr parentOr = (SHOr)selectedNode.Parent.Tag;
                    parentOr.or = null;
                }
                else if (selectedNode.Parent.Tag.GetType() == typeof(SHCondition))
                {
                    SHCondition parentCondition = (SHCondition)selectedNode.Parent.Tag;
                    parentCondition.or = null;
                }
                else
                {
                    return(false);
                }
            }
            else if (selectedNode.Tag.GetType() == typeof(SHCondition))
            {
                SHCondition cond = selectedNode.Tag as SHCondition;

                if (selectedNode.Parent.Tag.GetType() == typeof(SHConditions))
                {
                    SHConditions parentConditions = (SHConditions)selectedNode.Parent.Tag;
                    parentConditions.dataList.Remove(cond);
                }
                else if (selectedNode.Parent.Tag.GetType() == typeof(SHAnd))
                {
                    SHAnd parentAnd = (SHAnd)selectedNode.Parent.Tag;
                    parentAnd.dataList.Remove(cond);
                }
                else if (selectedNode.Parent.Tag.GetType() == typeof(SHOr))
                {
                    SHOr parentOr = (SHOr)selectedNode.Parent.Tag;
                    parentOr.dataList.Remove(cond);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            tvList.Nodes.Remove(selectedNode);
            selectedNode = selectedNode.Parent;

            return(true);
        }