IsGroup() public method

public IsGroup ( ) : bool
return bool
Example #1
0
        private void NodeEdit()
        {
            CameraTreeNode n = this.GetSelectedTreeNode();

            if (n != null)
            {
                if (!n.IsGroup())
                {
                    CameraClass    m      = n.Item as CameraClass;
                    CameraClass    e      = m.Clone() as CameraClass;
                    CameraEditForm fmEdit = new CameraEditForm(e);
                    fmEdit.ShowDialog(this);
                    if (DialogResult.OK == fmEdit.DialogResult)
                    {
                        fmEdit.Camera.Copy(m);
                        RootClass.Instance.SaveConfig();
                        MotionConfiguration.Instance.Save();

                        m.FireItemValueChangedEvent();
                    }
                }
                else
                {
                    n.BeginEdit();
                }
            }
        }
Example #2
0
        private void SetToolStripButtonState()
        {
            CameraTreeNode n = GetSelectedTreeNode();

            this.toolStripButtonEdit.Enabled = (n != null && !n.IsGroup());
            this.toolStripButtonDel.Enabled  = (n != null);
        }
Example #3
0
        private void toolStripMenuItemCemeraAdd_Click(object sender, EventArgs e)
        {
            CameraTreeNode n = this.GetSelectedTreeNode();

            if (n != null && !n.IsGroup())
            {
                this.OnCameraTreeOnBoard(new CameraTreeEventArgs((CameraClass)n.Item));
            }
        }
Example #4
0
        private void treeViewCamera_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            CameraTreeNode n = (CameraTreeNode)e.Node;

            if (n != null && !n.IsGroup())
            {
                this.OnCameraTreeOnBoard(new CameraTreeEventArgs((CameraClass)n.Item));
            }
        }
Example #5
0
        private CameraTreeNode GetSelectedGroupNode()
        {
            CameraTreeNode n = this.GetSelectedTreeNode();

            if (null != n && n.IsGroup() == false)
            {
                return((CameraTreeNode)(n.Parent));
            }
            return(n);
        }
Example #6
0
 private bool NodeDelete(CameraTreeNode node)
 {
     if (node.IsGroup())
     {
         if (node.Nodes.Count > 0)
         {
             ArrayList list = new ArrayList();
             foreach (TreeNode n in node.Nodes)
             {
                 list.Add(n);
             }
             foreach (TreeNode n in list)
             {
                 if (false == this.NodeDelete(n as CameraTreeNode))
                 {
                     return(false);
                 }
             }
         }
         if (node.Nodes.Count == 0)
         {
             node.Item.Remove();
             node.Item.Clean();
             node.Remove();
             return(true);
         }
     }
     else
     {
         CameraClass c = node.Item as CameraClass;
         if (c.Capturing == true)
         {
             MessageBox.Show(string.Format(Translator.Instance.T("删除摄像头[{0}]失败! 该摄像头正在录像中, 您必须首先停止录像, 然后再删除该摄像头."), c.Name), MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
         CameraTreeNodeDeleteEventArgs e = new CameraTreeNodeDeleteEventArgs(c);
         this.OnCameraTreeBeforeDelete(e);
         if (e.Cancel == false)
         {
             node.Item.Remove();
             node.Item.Clean();
             node.Remove();
             this.OnCameraTreeAfterDelete(e);
             return(true);
         }
     }
     return(false);
 }
Example #7
0
        private int NodeCount(CameraTreeNode p)
        {
            int r = 0;

            if (p.IsGroup())
            {
                foreach (CameraTreeNode n in p.Nodes)
                {
                    r += this.NodeCount(n);
                }
            }
            else
            {
                r++;
            }
            return(r);
        }
Example #8
0
 public void NodeReloadGlobalSettings(CameraTreeNode p)
 {
     if (p.IsGroup())
     {
         foreach (CameraTreeNode n in p.Nodes)
         {
             this.NodeReloadGlobalSettings(n);
         }
     }
     else
     {
         CameraClass c = p.Item as CameraClass;
         if (c != null)
         {
             c.ReloadGlobalSettings();
         }
     }
 }
Example #9
0
 private void NodeOnBoard(CameraTreeNode node)
 {
     if (node == null)
     {
         return;
     }
     if (node.IsGroup())
     {
         foreach (TreeNode n in node.Nodes)
         {
             this.NodeOnBoard((CameraTreeNode)n);
         }
     }
     else
     {
         this.OnCameraTreeOnBoard(new CameraTreeEventArgs((CameraClass)node.Item));
     }
 }
Example #10
0
        private bool NodeDelete()
        {
            CameraTreeNode n = this.GetSelectedTreeNode();

            if (n != null)
            {
                string msg = "";
                if (n.IsGroup())
                {
                    msg = Translator.Instance.T("您确实要删除这个视频监控组吗? 如果该组被删除, 则该组内的所有摄像头及其监控信息都将被删除.");
                }
                else
                {
                    msg = Translator.Instance.T("您确实要删除这个摄像头吗? 如果该摄像头被删除, 则该摄像头的所有监控信息也将被删除.");
                }
                if (DialogResult.Yes == MessageBox.Show(msg, MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                {
                    return(this.NodeDelete(n));
                }
            }
            return(false);
        }
Example #11
0
        private void treeViewCamera_DragOver(object sender, DragEventArgs e)
        {
            // Compute drag position and move image
            Point formP = this.PointToClient(new Point(e.X, e.Y));

            ImageListDragHelper.ImageList_DragMove(formP.X - this.treeViewCamera.Left, formP.Y - this.treeViewCamera.Top + this.treeViewCamera.Location.Y);

            // Get actual drop node
            CameraTreeNode dropNode = (CameraTreeNode)this.treeViewCamera.GetNodeAt(this.treeViewCamera.PointToClient(new Point(e.X, e.Y)));

            if (dropNode != null)
            {
                if (!dropNode.IsGroup() || dropNode == this.mDragNode)
                {
                    e.Effect = DragDropEffects.None;
                    return;
                }
            }
            // Avoid that drop node is child of drag node
            TreeNode tmpNode = dropNode;

            while (tmpNode != null && tmpNode.Parent != null)
            {
                if (tmpNode.Parent == this.mDragNode)
                {
                    e.Effect = DragDropEffects.None;
                    return;
                }
                tmpNode = tmpNode.Parent;
            }

            e.Effect = DragDropEffects.Move;
            // if mouse is on a new node select it
            ImageListDragHelper.ImageList_DragShowNolock(false);
            this.treeViewCamera.SelectedNode = dropNode;
            ImageListDragHelper.ImageList_DragShowNolock(true);
        }
Example #12
0
        private void treeViewCamera_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                // Point where the mouse is clicked.
                Point p = new Point(e.X, e.Y);

                // Get the node that the user has clicked.
                CameraTreeNode node = (CameraTreeNode)this.treeViewCamera.GetNodeAt(p);
                if (node == null)
                {
                    return;
                }
                this.treeViewCamera.SelectedNode = node;
                if (node.IsGroup())
                {
                    this.contextMenuStripGroup.Show(this.treeViewCamera, p);
                }
                else
                {
                    this.contextMenuStripCamera.Show(this.treeViewCamera, p);
                }
            }
        }
Example #13
0
 public void NodeReloadGlobalSettings(CameraTreeNode p)
 {
     if (p.IsGroup())
     {
         foreach (CameraTreeNode n in p.Nodes)
         {
             this.NodeReloadGlobalSettings(n);
         }
     }
     else
     {
         CameraClass c = p.Item as CameraClass;
         if (c != null)
         {
             c.ReloadGlobalSettings();
         }
     }
 }
Example #14
0
 private void NodeOnBoard(CameraTreeNode node)
 {
     if (node == null)
     {
         return;
     }
     if (node.IsGroup())
     {
         foreach (TreeNode n in node.Nodes)
         {
             this.NodeOnBoard((CameraTreeNode)n);
         }
     }
     else
     {
         this.OnCameraTreeOnBoard(new CameraTreeEventArgs((CameraClass)node.Item));
     }
 }
Example #15
0
 private bool NodeDelete(CameraTreeNode node)
 {
     if (node.IsGroup())
     {
         if (node.Nodes.Count > 0)
         {
             ArrayList list = new ArrayList();
             foreach (TreeNode n in node.Nodes)
             {
                 list.Add(n);
             }
             foreach (TreeNode n in list)
             {
                 if (false == this.NodeDelete(n as CameraTreeNode))
                 {
                     return false;
                 }
             }
         }
         if (node.Nodes.Count == 0)
         {
             node.Item.Remove();
             node.Item.Clean();
             node.Remove();
             return true;
         }
     }
     else
     {
         CameraClass c = node.Item as CameraClass;
         if (c.Capturing == true)
         {
             MessageBox.Show(string.Format(Translator.Instance.T("删除摄像头[{0}]失败! 该摄像头正在录像中, 您必须首先停止录像, 然后再删除该摄像头."), c.Name), MotionPreference.Instance.MessageBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
             return false;
         }
         CameraTreeNodeDeleteEventArgs e = new CameraTreeNodeDeleteEventArgs(c);
         this.OnCameraTreeBeforeDelete(e);
         if (e.Cancel == false)
         {
             node.Item.Remove();
             node.Item.Clean();
             node.Remove();
             this.OnCameraTreeAfterDelete(e);
             return true;
         }
     }
     return false;
 }
Example #16
0
 private int NodeCount(CameraTreeNode p)
 {
     int r = 0;
     if (p.IsGroup()) {
         foreach (CameraTreeNode n in p.Nodes) {
             r += this.NodeCount(n);
         }
     }
     else {
         r ++;
     }
     return r;
 }