コード例 #1
0
ファイル: FormMain.cs プロジェクト: DmitryShaburov/EzDSC
        // Create new roles group
        private void miRolesNewGroup_Click(object sender, EventArgs e)
        {
            DscRoleGroup parent = (treeLibrary.SelectedNode.Tag as DscRoleGroup);

            DialogText nameDialog = new DialogText();

            if (nameDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (_repositoryWorker.Contains(nameDialog.InputResult, parent))
            {
                MessageBoxWorker.SameItemExists(this, Strings.UI_Text_RoleOrGroupC);
                return;
            }

            DscRoleGroup roleGroup = _repositoryWorker.NewRoleGroup(nameDialog.InputResult, parent);

            if (roleGroup == null)
            {
                return;
            }

            treeLibrary.SelectedNode = TreeViewWorker.TreeNodeAdd(roleGroup.Name, roleGroup, 0, menuRoleGroup,
                                                                  treeLibrary.SelectedNode);
        }
コード例 #2
0
ファイル: FormMain.cs プロジェクト: DmitryShaburov/EzDSC
        // Create new configuration item
        private void miResourceTypeNewConfigurationItem_Click(object sender, EventArgs e)
        {
            DscResource parent = (treeLibrary.SelectedNode.Tag as DscResource);

            DialogText nameDialog = new DialogText();

            if (nameDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (_repositoryWorker.Contains(nameDialog.InputResult, parent))
            {
                MessageBoxWorker.SameItemExists(this, Strings.UI_Text_ConfigurationItemC);
                return;
            }

            DscConfigurationItemNode configurationItemNode =
                _repositoryWorker.NewConfigurationItemNode(nameDialog.InputResult, parent);

            if (configurationItemNode == null)
            {
                return;
            }

            treeLibrary.SelectedNode = TreeViewWorker.TreeNodeAdd(configurationItemNode.Name, configurationItemNode, 1,
                                                                  menuConfigurationItem, treeLibrary.SelectedNode);
        }
コード例 #3
0
ファイル: FormMain.cs プロジェクト: DmitryShaburov/EzDSC
        // Create new server
        private void miServersNewServer_Click(object sender, EventArgs e)
        {
            DscServerNode parent = (treeLibrary.SelectedNode.Tag as DscServerNode);

            if (parent == null)
            {
                return;
            }

            DialogText nameDialog = new DialogText();

            if (nameDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (_repositoryWorker.Contains(nameDialog.InputResult, parent))
            {
                MessageBoxWorker.SameItemExists(this, Strings.UI_Text_ServerOrGroupC);
                return;
            }

            DscServerNode serverNode = _repositoryWorker.NewServerNode(nameDialog.InputResult,
                                                                       DscServerNode.ServerType.Server, parent);

            treeLibrary.SelectedNode = TreeViewWorker.TreeNodeAdd(serverNode.Name, serverNode, 2, menuServer,
                                                                  treeLibrary.SelectedNode);
        }
コード例 #4
0
ファイル: FormMain.cs プロジェクト: DmitryShaburov/EzDSC
 // Fill TreeView recursively with roles from current repository
 private void FillRoleTree(DscRoleGroup group, TreeNode treeNode)
 {
     treeNode.Tag = group;
     foreach (DscRoleNode childRole in group.Nodes)
     {
         TreeViewWorker.TreeNodeAdd(childRole.Name, childRole, 1, menuRole, treeNode);
     }
     foreach (DscRoleGroup childGroup in group.Groups)
     {
         TreeNode groupNode = TreeViewWorker.TreeNodeAdd(childGroup.Name, childGroup, 0, menuRoleGroup, treeNode);
         FillRoleTree(childGroup, groupNode);
     }
 }
コード例 #5
0
ファイル: FormMain.cs プロジェクト: DmitryShaburov/EzDSC
 // Fill TreeView recursively with servers from current repository
 private void FillServerTree(DscServerNode serverNode, TreeNode treeNode)
 {
     treeNode.Tag = serverNode;
     foreach (DscServerNode child in serverNode.Nodes)
     {
         if (child.Type != DscServerNode.ServerType.Group)
         {
             TreeViewWorker.TreeNodeAdd(child.Name, child, 2, menuServer, treeNode);
         }
         else
         {
             TreeNode childNode = TreeViewWorker.TreeNodeAdd(child.Name, child, 0, menuServerGroup, treeNode);
             FillServerTree(child, childNode);
         }
     }
 }
コード例 #6
0
ファイル: FormMain.cs プロジェクト: DmitryShaburov/EzDSC
        // Fills TreeView with modules, resources and configuration items from current repository
        private void FillResourceTree()
        {
            foreach (DscModule module in _repository.Modules)
            {
                TreeNode moduleNode = TreeViewWorker.TreeNodeAdd(module.Name, module, 0, null,
                                                                 treeLibrary.Nodes["tviResources"]);

                foreach (DscResource resource in module.Resources)
                {
                    TreeNode resourceNode = TreeViewWorker.TreeNodeAdd(resource.FriendlyName, resource, 0,
                                                                       menuResource, moduleNode);

                    foreach (DscConfigurationItemNode configurationItem in resource.Nodes)
                    {
                        TreeViewWorker.TreeNodeAdd(configurationItem.Name, configurationItem, 1, menuConfigurationItem,
                                                   resourceNode);
                    }
                }
            }
        }