示例#1
0
		private void CreateObligationsFromPolicySet(object sender, EventArgs args )
		{
			PolicySet policySetNode = (PolicySet)mainTree.SelectedNode;
			pol.PolicySetElementReadWrite policySet = policySetNode.PolicySetDefinition;

			pol.ObligationReadWriteCollection obligations = new pol.ObligationReadWriteCollection();  //TODO: check version

			policySet.Obligations = obligations;

			Obligations obligationsNode = new Obligations( obligations );

			policySetNode.Nodes.Add( obligationsNode );

			obligationsNode.NodeFont = new Font( mainTree.Font, FontStyle.Bold );
		}
示例#2
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void mainTree_BeforeSelect(object sender, TreeViewCancelEventArgs e)
		{
			// Check if the control have been modified
			if( mainPanel.Controls.Count != 0 )
			{
				if( !(mainPanel.Controls[0] is XmlViewer) )
				{
					BaseControl baseControl = mainPanel.Controls[0] as BaseControl;

					mainTree.SelectedNode.NodeFont = new Font( mainTree.Font, FontStyle.Regular );
					NoBoldNode oNode = null;
					if( baseControl is CustomControls.PolicySet )
					{
						oNode = new PolicySet(((CustomControls.PolicySet)baseControl).PolicySetElement);
					}
					else if( baseControl is CustomControls.PolicySet )
					{
						oNode = new Policy(((CustomControls.Policy)baseControl).PolicyElement);
					}
					else if( baseControl is CustomControls.Rule )
					{
						oNode = new Rule(((CustomControls.Rule)baseControl).RuleElement);
					}
					else if( baseControl is CustomControls.TargetItem )
					{
						pol.TargetItemBaseReadWrite element = ((CustomControls.TargetItem)baseControl).TargetItemBaseElement;
						oNode = new TargetItem(element);
					}
					else if( baseControl is CustomControls.Obligations )
					{
						oNode = new Obligations(((CustomControls.Obligations)baseControl).ObligationsElement);
					}
					else if( baseControl is ContextCustomControls.Attribute )
					{
						oNode = new Attribute( ((ContextCustomControls.Attribute)baseControl).AttributeElement );
					}
					else if( baseControl is ContextCustomControls.Resource )
					{
						oNode = new Resource( ((ContextCustomControls.Resource)baseControl).ResourceElement );
					}
				
					if( oNode != null )
					{
						mainTree.SelectedNode = oNode;
						mainTree.SelectedNode.Text = oNode.Text;
					}
				}
			}
		}