Пример #1
0
 protected virtual void OnCameraTreeBeforeDelete(CameraTreeNodeDeleteEventArgs e)
 {
     if (this.CameraBeforeDelete != null)
     {
         CameraBeforeDelete(this, e);
     }
 }
Пример #2
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);
 }
Пример #3
0
 private void treeCamera_CameraBeforeDelete(object sender, CameraTreeNodeDeleteEventArgs e)
 {
     this.boardCamera.Remove(e.Camera);
 }
Пример #4
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;
 }
Пример #5
0
 protected virtual void OnCameraTreeBeforeDelete(CameraTreeNodeDeleteEventArgs e)
 {
     if (this.CameraBeforeDelete != null)
     {
         CameraBeforeDelete(this, e);
     }
 }