/// <summary> /// /// </summary> /// <param name="attribute"></param> public Attribute(con.AttributeElementReadWrite attribute) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); LoadingData = true; _attribute = attribute; foreach (FieldInfo field in typeof(Consts.Schema1.InternalDataTypes).GetFields()) { cmbDataType.Items.Add(field.GetValue(null)); } this.lstAttributeValue.DisplayMember = "Value"; foreach (con.AttributeValueElementReadWrite attr in _attribute.AttributeValues) { lstAttributeValue.Items.Add(attr); } if (_attribute.AttributeValues.Count != 0) { lstAttributeValue.SelectedIndex = 0; } txtId.Text = _attribute.AttributeId; txtId.DataBindings.Add("Text", _attribute, "AttributeId"); txtIssuer.Text = _attribute.Issuer; //txtIssuer.DataBindings.Add( "Text", _attribute, "Issuer" ); cmbDataType.SelectedIndex = cmbDataType.FindStringExact(_attribute.DataType); cmbDataType.DataBindings.Add("SelectedItem", _attribute, "DataType"); LoadingData = false; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lstObligations_SelectedIndexChanged(object sender, System.EventArgs e) { if (index != -1) { pol.AttributeAssignmentElementReadWrite attrAux = lstAttributeAssignments.Items[index] as pol.AttributeAssignmentElementReadWrite; attrAux.AttributeId = txtAttributeId.Text; attrAux.Value = txtAttributeAssignemnt.Text; } if (obligationIndex != -1 && obligationIndex != lstObligations.SelectedIndex) { pol.ObligationElementReadWrite obliAux = lstObligations.Items[obligationIndex] as pol.ObligationElementReadWrite; obliAux.ObligationId = txtId.Text; if (cmbEffect.Text.Equals(pol.Effect.Deny.ToString())) { obliAux.FulfillOn = pol.Effect.Deny; } else if (cmbEffect.Text.Equals(pol.Effect.Permit.ToString())) { obliAux.FulfillOn = pol.Effect.Permit; } lstObligations.Items.RemoveAt(obligationIndex); lstObligations.Items.Insert(obligationIndex, obliAux); } obligationIndex = lstObligations.SelectedIndex; pol.ObligationElementReadWrite obligation = lstObligations.SelectedItem as pol.ObligationElementReadWrite; if (!LoadingData) { try { LoadingData = true; if (obligation != null) { txtId.Text = obligation.ObligationId; cmbEffect.SelectedIndex = cmbEffect.FindStringExact(obligation.FulfillOn.ToString()); lstAttributeAssignments.Items.Clear(); foreach (pol.AttributeAssignmentElementReadWrite attr in obligation.AttributeAssignment) { lstAttributeAssignments.Items.Add(attr); } txtAttributeId.Text = string.Empty; txtAttributeAssignemnt.Text = string.Empty; } index = -1; } finally { LoadingData = false; } } else { obligationIndex = -1; } }
/// <summary> /// Adds/selects the specified server in the combo box. /// </summary> public void OnConnect(OpcServer server) { // check if the server url already exists. int index = ServerUrlCB.FindStringExact(server.Url.ToString()); // add url if it does not exist. if (index == -1) { index = 1; ServerUrlCB.Items.Insert(index, server.Url); } // select the new url. ServerUrlCB.SelectedIndex = index; }
/// <summary> /// /// </summary> public Rule(pol.RuleElementReadWrite rule) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); _rule = rule; LoadingData = true; cmbEffect.Items.Add(pol.Effect.Deny); cmbEffect.Items.Add(pol.Effect.Permit); txtDescription.Text = _rule.Description; txtPolicyId.Text = _rule.Id; cmbEffect.SelectedIndex = cmbEffect.FindStringExact(_rule.Effect.ToString()); txtDescription.DataBindings.Add("Text", _rule, "Description"); txtPolicyId.DataBindings.Add("Text", _rule, "Id"); cmbEffect.DataBindings.Add("SelectedValue", _rule, "Effect"); LoadingData = false; }
/// <summary> /// /// </summary> /// <param name="targetItem"></param> /// <param name="match"></param> /// <param name="index"></param> public Match(TargetItemBaseReadWrite targetItem, TargetMatchBaseReadWrite match, int index) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); LoadingData = true; foreach (FieldInfo field in typeof(Consts.Schema1.InternalDataTypes).GetFields()) { cmbASDataType.Items.Add(field.GetValue(null)); cmbADDataType.Items.Add(field.GetValue(null)); cmbAVDataType.Items.Add(field.GetValue(null)); } foreach (FieldInfo field in typeof(Consts.Schema1.InternalFunctions).GetFields()) { cmbFunctions.Items.Add(field.GetValue(null)); } txtSubjectCategory.Visible = false; lblSubjectCategory.Visible = false; _match = match; _index = index; if (targetItem is ActionElementReadWrite) { _targetItemName = "Action"; } else if (targetItem is SubjectElementReadWrite) { _targetItemName = "Subject"; txtSubjectCategory.Visible = true; lblSubjectCategory.Visible = true; } else if (targetItem is ResourceElementReadWrite) { _targetItemName = "Resource"; } grpMatch.Text = _targetItemName + "Match"; cmbFunctions.SelectedIndex = cmbFunctions.FindStringExact(_match.MatchId); cmbFunctions.DataBindings.Add("SelectedItem", _match, "MatchId"); cmbAVDataType.SelectedIndex = cmbAVDataType.FindStringExact(match.AttributeValue.DataType); cmbAVDataType.DataBindings.Add("SelectedItem", _match.AttributeValue, "DataType"); txtAttributeValue.Text = match.AttributeValue.Contents; txtAttributeValue.DataBindings.Add("Text", _match.AttributeValue, "Contents"); if (match.AttributeReference is pol.AttributeDesignatorBase) { rdbAttributeDesignator.Checked = true; rdbAttributeSelector.Checked = false; cmbADDataType.SelectedIndex = cmbADDataType.FindStringExact(match.AttributeReference.DataType); cmbADDataType.DataBindings.Add("SelectedItem", _match.AttributeReference, "DataType"); chkADMustBePresent.Checked = match.AttributeReference.MustBePresent; chkADMustBePresent.DataBindings.Add("Checked", _match.AttributeReference, "MustBePresent"); pol.AttributeDesignatorBase attributeDesignator = (pol.AttributeDesignatorBase)match.AttributeReference; txtAttributeId.Text = attributeDesignator.AttributeId; txtAttributeId.DataBindings.Add("Text", _match.AttributeReference, "AttributeId"); txtIssuer.Text = attributeDesignator.Issuer; txtIssuer.DataBindings.Add("Text", _match.AttributeReference, "Issuer"); } else if (match.AttributeReference is pol.AttributeSelectorElement) { rdbAttributeDesignator.Checked = false; rdbAttributeSelector.Checked = true; cmbASDataType.SelectedIndex = cmbASDataType.FindStringExact(match.AttributeReference.DataType); cmbASDataType.DataBindings.Add("SelectedItem", _match.AttributeReference, "DataType"); chkASMustBePresent.Checked = match.AttributeReference.MustBePresent; chkASMustBePresent.DataBindings.Add("Checked", _match.AttributeReference, "MustBePresent"); txtRequestContextPath.Text = ((pol.AttributeSelectorElement)match.AttributeReference).RequestContextPath; txtRequestContextPath.DataBindings.Add("Text", _match.AttributeReference, "RequestContextPath"); } LoadingData = false; }