Beispiel #1
0
        internal protected virtual object FromCheckState(CheckState checkState)
        {
            object retValue = this.FalseValue;

            if (checkState.Equals(CheckState.Checked))
            {
                retValue = this.TrueValue;
            }
            else if (checkState.Equals(CheckState.Indeterminate))
            {
                retValue = this.NullValue;
            }

            return(retValue);
        }
Beispiel #2
0
 public static void smethod_15(TreeListNode treeListNode_0, CheckState checkState_0)
 {
     if (treeListNode_0.ParentNode != null)
     {
         bool       flag       = false;
         CheckState @unchecked = CheckState.Unchecked;
         for (int i = 0; i < treeListNode_0.ParentNode.Nodes.Count; i++)
         {
             if (treeListNode_0.ParentNode.Nodes[i].Tag == null)
             {
                 @unchecked = CheckState.Unchecked;
             }
             else
             {
                 @unchecked = (CheckState)treeListNode_0.ParentNode.Nodes[i].Tag;
             }
             if (!checkState_0.Equals(@unchecked))
             {
                 flag = !flag;
                 break;
             }
         }
         if (flag)
         {
             treeListNode_0.ParentNode.Tag = CheckState.Indeterminate;
         }
         else
         {
             treeListNode_0.ParentNode.Tag = checkState_0;
         }
         smethod_15(treeListNode_0.ParentNode, checkState_0);
     }
 }
Beispiel #3
0
 private void SetCheckedParentNodes(TreeListNode node, CheckState check)
 {
     try
     {
         if (node.ParentNode != null)
         {
             bool       b = false;
             CheckState state;
             for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
             {
                 state = (CheckState)node.ParentNode.Nodes[i].CheckState;
                 if (!check.Equals(state))
                 {
                     b = !b;
                     break;
                 }
             }
             node.ParentNode.CheckState = b ? CheckState.Indeterminate : check;
             SetCheckedParentNodes(node.ParentNode, check);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 //region 设置父节点状态,如果它的孩子都被选中,则状态是check(由上下文件环境传递),否则是CheckState.Indeterminate
 private void SetCheckedParentNodes(DevExpress.XtraTreeList.Nodes.TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         bool b = false;
         CheckState state;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             state = (CheckState)node.ParentNode.Nodes[i].CheckState;
             if (!check.Equals(state))
             {
                 b = !b;
                 break;
             }
         }
         if (b)
         {
             node.ParentNode.CheckState = CheckState.Indeterminate;
         }
         else
         {
             node.ParentNode.CheckState = check;
         }
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
Beispiel #5
0
 private void SetCheckedParentNodes(IDictionary <string, List <Layer> > mapLayers, TreeListNode node, CheckState checkState)
 {
     if (node.ParentNode != null)
     {
         var        b = false;
         CheckState state;
         foreach (TreeListNode parentNode in node.ParentNode.Nodes)
         {
             if (parentNode.Tag == null)
             {
                 state = CheckState.Unchecked;
             }
             else
             {
                 state = (CheckState)parentNode.Tag;
             }
             if (!checkState.Equals(state))
             {
                 b = !b;
                 break;
             }
         }
         node.ParentNode.Tag = b ? CheckState.Indeterminate : checkState;
         SetCheckedParentNodes(mapLayers, node.ParentNode, checkState);
     }
 }
Beispiel #6
0
        /// <summary>
        /// 设置父节点的选中状态
        /// </summary>
        /// <param name="node">当前节点</param>
        /// <param name="check">选中状态</param>
        private void SetCheckedParentNodes(TreeListNode node, CheckState check)
        {
            try
            {
                if (node.ParentNode != null)
                {
                    bool       b = false;
                    CheckState state;

                    for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
                    {
                        state = (CheckState)node.ParentNode.Nodes[i].CheckState;
                        if (!check.Equals(state))
                        {
                            b = !b;
                            break;
                        }
                    }

                    node.ParentNode.CheckState = b ? CheckState.Indeterminate : check;
                    SetCheckedParentNodes(node.ParentNode, check);
                }
            }
            catch (System.Exception ex)
            {
                Log4Allen.WriteLog(typeof(LayersControl), ex);
            }
        }
Beispiel #7
0
        /// <summary>
        /// 某节点的子节点全部选择时,该节点选择   某节点的子节点未全部选择时,该节点不选择
        /// </summary>
        /// <param name="node"></param>
        /// <param name="checkState"></param>
        /// <param name="special">特殊模式(只要子节点有任何一个选中 父节点便选中)</param>
        public static void SetTreeListCheckedParentNodes(TreeListNode node, CheckState checkState, bool special = false)
        {
            if (node.ParentNode != null)
            {
                CheckState parentCheckState = node.ParentNode.CheckState;

                foreach (TreeListNode item in node.ParentNode.Nodes)
                {
                    if (special)
                    {
                        if (checkState == CheckState.Checked || item.CheckState == CheckState.Checked) //当前节点选中或者父节点子节点中有任何一个选中 则父节点选中
                        {
                            parentCheckState = CheckState.Checked;
                            break;
                        }
                    }
                    else if (!checkState.Equals(item.CheckState)) //只要任意一个与其选中状态不一样即父节点状态不全选
                    {
                        parentCheckState = CheckState.Unchecked;
                        break;
                    }

                    parentCheckState = checkState; //否则(该节点的兄弟节点选中状态都相同),则父节点选中状态为该节点的选中状态
                }

                node.ParentNode.CheckState = parentCheckState;
                SetTreeListCheckedParentNodes(node.ParentNode, checkState, special); //遍历上级节点
            }
        }
Beispiel #8
0
        private void SetCheckedParentNodes(TreeListNode node, CheckState check)
        {
            try
            {
                if (node.ParentNode != null)
                {
                    CheckState parentCheckState = node.ParentNode.CheckState;
                    CheckState nodeCheckState;
                    for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
                    {
                        nodeCheckState = (CheckState)node.ParentNode.Nodes[i].CheckState;
                        if (!check.Equals(nodeCheckState))
                        {
                            parentCheckState = CheckState.Unchecked;
                            break;
                        }
                        parentCheckState = check;
                    }

                    node.ParentNode.CheckState = parentCheckState;
                    SetCheckedParentNodes(node.ParentNode, check);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void SetCheckedParentNodes(TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         bool b = false;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             if (!check.Equals(node.ParentNode.Nodes[i]["Check"]))
             {
                 b = !b;
                 break;
             }
         }
         node.ParentNode["Check"] = b ? CheckState.Indeterminate : check;
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
Beispiel #10
0
 private void SetCheckedParentNodes(DevExpress.XtraTreeList.Nodes.TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         bool b = false;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             if (!check.Equals(node.ParentNode.Nodes[i].Tag))
             {
                 b = !b;
                 break;
             }
         }
         node.ParentNode.Tag = b ? CheckState.Indeterminate : check;
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
 private void SetCheckedParentNodes(TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         bool flag = false;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             CheckState checkState = node.ParentNode.Nodes[i].CheckState;
             if (!check.Equals(checkState))
             {
                 flag = !flag;
                 break;
             }
         }
         node.ParentNode.CheckState = (flag ? CheckState.Indeterminate : check);
         this.SetCheckedParentNodes(node.ParentNode, check);
     }
 }
Beispiel #12
0
 private static void SetCheckedParentNodes(TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         bool b = false;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             CheckState state = node.ParentNode.Nodes[i].CheckState;
             if (!check.Equals(state))
             {
                 b = true;
                 break;
             }
         }
         node.ParentNode.CheckState = b ? CheckState.Indeterminate : check;
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
Beispiel #13
0
 private static void SetCheckedParentNodes(TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         bool b = false;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             CheckState state = node.ParentNode.Nodes[i].CheckState;
             if (!check.Equals(state))
             {
                 b = true;
                 break;
             }
         }
         node.ParentNode.CheckState = b ? CheckState.Indeterminate : check;
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
        /// <summary>
        ///   Sets the item 'checked' stated
        /// </summary>
        /// <param name="itemIndex"></param>
        /// <param name="checkState"></param>
        public void SetItemCheckState(int itemIndex, CheckState checkState)
        {
            var currentCheckState = GetItemCheckState(itemIndex);

            if (checkState.Equals(CheckState.Checked))
            {
                ListBoxItems[itemIndex].Checked = true;
            }
            else
            {
                ListBoxItems[itemIndex].Checked = false;
            }
            var newValue = GetItemCheckState(itemIndex);

            if (ViewManager != null && ViewManager.Events != null && !ViewManager.Events.IsSuspended())
            {
                ViewManager.Events.Publish(ItemCheckEvent, this, this, new ItemCheckEventArgs(itemIndex, newValue, currentCheckState));
            }
        }
Beispiel #15
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="treeListNode"></param>
 /// <param name="checkState"></param>
 public static void SetCheckedParentNodes(TreeListNode treeListNode, CheckState checkState)
 {
     if (treeListNode.ParentNode != null)
     {
         var b = false;
         for (var i = 0; i < treeListNode.ParentNode.Nodes.Count; i++)
         {
             var state = treeListNode.ParentNode.Nodes[i].CheckState;
             if (checkState.Equals(state))
             {
                 continue;
             }
             b = true;
             break;
         }
         treeListNode.ParentNode.CheckState = b ? CheckState.Indeterminate : checkState;
         SetCheckedParentNodes(treeListNode.ParentNode, checkState);
     }
 }
Beispiel #16
0
 private void SetCheckedParentNodes(TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         bool       b = false;
         CheckState state;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             state = (CheckState)node.ParentNode.Nodes[i].CheckState;
             if (!check.Equals(state))
             {
                 b = !b;
                 break;
             }
         }
         SetNodeCheckState(node.ParentNode, b ? CheckState.Checked : check);
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
Beispiel #17
0
 /// <summary>
 /// 父节点勾选
 /// </summary>
 /// <param name="node"></param>
 /// <param name="check"></param>
 private void SetCheckedParentNodes(TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         CheckState parentCheckState = node.ParentNode.CheckState;
         CheckState nodeCheckState;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             nodeCheckState = (CheckState)node.ParentNode.Nodes[i].CheckState;
             if (!check.Equals(nodeCheckState))//只要任意一个与其选中状态不一样即父节点状态不全选
             {
                 parentCheckState = CheckState.Indeterminate;
                 break;
             }
             parentCheckState = check;//否则(该节点的兄弟节点选中状态都相同),则父节点选中状态为该节点的选中状态
         }
         node.ParentNode.CheckState = parentCheckState;
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
Beispiel #18
0
 private void SetCheckedParentNodes(DevExpress.XtraTreeList.Nodes.TreeListNode node, CheckState check)
 {
     check1 = 1;
     if (node.ParentNode != null)
     {
         bool       b = false;
         CheckState state;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             state = (CheckState)node.ParentNode.Nodes[i].CheckState;
             if (!check.Equals(state))
             {
                 b = true;
                 break;
             }
         }
         node.ParentNode.CheckState = b ? CheckState.Indeterminate : check;
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
 /// <summary>
 /// 设置父节点CheckState
 /// </summary>
 /// <param name="node"></param>
 /// <param name="check"></param>
 private static void SetCheckedParentNodes(TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         bool       _checkStatus = false;
         CheckState _nodeState;
         node.LoopTreeNodes_Break((TreeListNode _node) =>
         {
             _nodeState = _node.CheckState;
             if (!check.Equals(_nodeState))
             {
                 _checkStatus = !_checkStatus;
                 return(false); //跳出循环
             }
             return(true);      //继续循环
         });
         node.ParentNode.CheckState = _checkStatus ? CheckState.Indeterminate : check;
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
 private void SetCheckedParentNodes(TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         CheckState parentCheckState = node.ParentNode.CheckState;
         CheckState nodeCheckState;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             nodeCheckState = (CheckState)node.ParentNode.Nodes[i].CheckState;
             if (!check.Equals(nodeCheckState))
             {
                 parentCheckState = CheckState.Unchecked;
                 break;
             }
             parentCheckState = check;
         }
         node.ParentNode.CheckState = parentCheckState;
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
Beispiel #21
0
        private void SetCheckedParentNodes(TreeListNode node, CheckState checkState)
        {
            if (node.ParentNode != null)
            {
                bool       b = false;
                CheckState state;
                for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
                {
                    state = (CheckState)node.ParentNode.Nodes[i].CheckState;
                    if (!checkState.Equals(state))
                    {
                        b = !b;
                        break;
                    }
                }
                node.ParentNode.CheckState = b ? CheckState.Indeterminate : checkState;
                //SetRulesHistoryState(node.ParentNode["RuleName"].ToString(), node.ParentNode.Checked);

                SetCheckedParentNodes(node.ParentNode, checkState);
            }
        }
Beispiel #22
0
        //选择父节点时触发
        void setCheckParentNodes(TreeListNode node, CheckState check)
        {
            if (node.ParentNode != null)
            {
                bool       b = false;
                CheckState state;

                for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
                {
                    state = ( CheckState )node.ParentNode.Nodes [i].CheckState;
                    if (!check.Equals(state))
                    {
                        b = !b;
                        break;
                    }
                }

                node.ParentNode.CheckState = b ? CheckState.Indeterminate : check;
                setCheckParentNodes(node.ParentNode, check);
            }
        }
Beispiel #23
0
 private void SetCheckedParentNodes(DevExpress.XtraTreeList.Nodes.TreeListNode node, CheckState check)
 {
     if (node.ParentNode != null)
     {
         bool b = false;
         CheckState state;
         for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
         {
             if (node.ParentNode.Nodes[i].Tag == null) state = CheckState.Unchecked;
             else state = (CheckState)node.ParentNode.Nodes[i].Tag;
             if (!check.Equals(state))
             {
                 b = !b;
                 break;
             }
         }
         node.ParentNode.Tag = b ? CheckState.Indeterminate : check;
         SetCheckedParentNodes(node.ParentNode, check);
     }
 }
Beispiel #24
0
        private void SetCheckedParentNodes(TreeListNode node, CheckState checkState)
        {
            if (node.ParentNode != null)
            {
                bool b = false;
                CheckState state;
                for (int i = 0; i < node.ParentNode.Nodes.Count; i++)
                {
                    state = (CheckState)node.ParentNode.Nodes[i].CheckState;
                    if (!checkState.Equals(state))
                    {
                        b = !b;
                        break;
                    }
                }
                node.ParentNode.CheckState = b ? CheckState.Indeterminate : checkState;
                //SetRulesHistoryState(node.ParentNode["RuleName"].ToString(), node.ParentNode.Checked);

                SetCheckedParentNodes(node.ParentNode, checkState);

            }
        }
Beispiel #25
0
 private void SetCheckedParentNodes(IDictionary<string, List<Layer>> mapLayers, TreeListNode node, CheckState checkState)
 {
     if(node.ParentNode!=null)
     {
         var b = false;
         CheckState state;
         foreach (TreeListNode parentNode in node.ParentNode.Nodes)
         {
             if(parentNode.Tag==null)
             {
                 state=CheckState.Unchecked;
             }
             else
             {
                 state = (CheckState) parentNode.Tag;
             }
             if(!checkState.Equals(state))
             {
                 b = !b;
                 break;
             }
         }
         node.ParentNode.Tag = b ? CheckState.Indeterminate : checkState;
         SetCheckedParentNodes(mapLayers, node.ParentNode, checkState);
     }
 }
Beispiel #26
0
        private void SetCheckedParentNodes(TreeListNode node, CheckState check) {
            if (node.ParentNode != null) {
                bool b = false;
                CheckState state;

                for (int i = 0; i < node.ParentNode.Nodes.Count; i++) {
                    state = (CheckState)node.ParentNode.Nodes[i].CheckState;
                    if (!check.Equals(state)) {
                        b = !b;
                        break;
                    }
                }
                
                node.ParentNode.CheckState = b ? CheckState.Checked : check;
                SetCheckedParentNodes(node.ParentNode, check);
            }
        }