Exemple #1
0
        // Edit views group
        private void EditViewsGroup(TreeNode node)
        {
            GroupForm	form = new GroupForm();

            // set dialog title
            form.Text = "Edit views group";
            // set callback for group name checking
            form.CheckGroupFunction = new CheckGroupHandler(CheckViewsGroup);

            // get group
            form.Group = config.GetViewsGroupByName(camerasTree.GetGroupFullName(node));

            // show dialog
            if (form.ShowDialog() == DialogResult.OK)
            {
                // save cameras
                config.SaveCameras();

                // update tree
                node.Text = form.Group.Name;
            }
        }
Exemple #2
0
        // Add new views group
        private void AddViewsGroup(TreeNode parentNode)
        {
            GroupForm	form = new GroupForm();
            NodeType	parentType = camerasTree.GetNodeType(parentNode);

            // check parent node type
            if ((parentType != NodeType.ViewsGroup) && (parentType != NodeType.ViewsRootGroup))
                parentNode = camerasTree.ViewsRootNode;

            // set dialog title
            form.Text = "Add views group";
            // set callback for group name checking
            form.CheckGroupFunction = new CheckGroupHandler(CheckViewsGroup);

            // get full name of selected cameras group
            string parentName = camerasTree.GetGroupFullName(parentNode);

            if (parentName != null)
            {
                // get parent group
                form.Group.Parent = config.GetViewsGroupByName(parentName);
            }

            // show dialog
            if (form.ShowDialog() == DialogResult.OK)
            {
                Group	group = form.Group;

                // add to groups collection
                config.AddViewsGroup(group);

                // add to tree
                camerasTree.SelectedNode = camerasTree.AddViewsGroup(group, parentNode);
            }
        }