// Add Role to Server Node private void tsbServerRoleAdd_Click(object sender, EventArgs e) { DscServerNode serverNode = (treeLibrary.SelectedNode.Tag as DscServerNode); if (serverNode == null) { return; } DialogTree treeDialog = new DialogTree(treeLibrary.Nodes["tviRoles"], imagesMain); if ((treeDialog.ShowDialog() != DialogResult.OK) || (treeDialog.SelectedTag == null)) { return; } if (treeDialog.SelectedTag.GetType() != typeof(DscRoleNode)) { return; } DscRoleNode roleNode = (treeDialog.SelectedTag as DscRoleNode); if (roleNode == null) { return; } serverNode.Node.Roles.Add(roleNode.BuildName()); serverNode.Node.Save(serverNode.FilePath); listServerRoles.DataSource = null; listServerRoles.DataSource = serverNode.Node.Roles; }
// Add dependency to configuration item private void tsbCIAddDepends_Click(object sender, EventArgs e) { DscConfigurationItemNode currentConfigurationItemNode = (treeLibrary.SelectedNode.Tag as DscConfigurationItemNode); if (currentConfigurationItemNode == null) { return; } DialogTree treeDialog = new DialogTree(treeLibrary.Nodes["tviResources"], imagesMain); if ((treeDialog.ShowDialog() != DialogResult.OK) || (treeDialog.SelectedTag == null)) { return; } if (treeDialog.SelectedTag.GetType() != typeof(DscConfigurationItemNode)) { return; } DscConfigurationItemNode selectedConfigurationItemNode = (treeDialog.SelectedTag as DscConfigurationItemNode); if (selectedConfigurationItemNode == null) { return; } currentConfigurationItemNode.ConfigurationItem.DependsOn.Add(selectedConfigurationItemNode.GetFullName()); currentConfigurationItemNode.ConfigurationItem.Save(currentConfigurationItemNode.FilePath); listDependsOn.DataSource = null; listDependsOn.DataSource = currentConfigurationItemNode.ConfigurationItem.DependsOn; }
// Add Configuration Item to Role private void tsbRoleAdd_Click(object sender, EventArgs e) { DscRoleNode roleNode = (treeLibrary.SelectedNode.Tag as DscRoleNode); if (roleNode == null) { return; } DialogTree treeDialog = new DialogTree(treeLibrary.Nodes["tviResources"], imagesMain); if ((treeDialog.ShowDialog() != DialogResult.OK) || (treeDialog.SelectedTag == null)) { return; } if (treeDialog.SelectedTag.GetType() != typeof(DscConfigurationItemNode)) { return; } DscConfigurationItemNode configurationItemNode = (treeDialog.SelectedTag as DscConfigurationItemNode); if (configurationItemNode == null) { return; } roleNode.Role.Resources.Add(configurationItemNode.GetFullName()); roleNode.Role.Save(roleNode.FilePath); listRoleItems.DataSource = null; listRoleItems.DataSource = roleNode.Role.Resources; }