Exemple #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void lstMatch_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     if (lstMatch.SelectedItem != null)
     {
         if (index != -1 && index != lstMatch.SelectedIndex)
         {
             TargetMatchBaseReadWrite indexMatch = lstMatch.Items[index] as TargetMatchBaseReadWrite;
             lstMatch.Items.RemoveAt(index);
             lstMatch.Items.Insert(index, indexMatch);
         }
         TargetMatchBaseReadWrite match = lstMatch.SelectedItem as TargetMatchBaseReadWrite;
         index = lstMatch.SelectedIndex;
         try
         {
             LoadingData = true;
             Match matchControl = _list[lstMatch.SelectedIndex] as Match;
             if (matchControl == null)
             {
                 matchControl = new Match(_targetItem, match, lstMatch.SelectedIndex);
                 _list[lstMatch.SelectedIndex] = matchControl;
             }
             mainPanel.Controls.Clear();
             mainPanel.Controls.Add(matchControl);
         }
         finally
         {
             LoadingData = false;
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, System.EventArgs e)
        {
            TargetMatchBaseReadWrite targetMatch = null;

            if (_targetItem is ActionElementReadWrite)
                targetMatch = new ActionMatchElementReadWrite(
                    Consts.Schema1.InternalFunctions.StringEqual,
                    new pol.AttributeValueElementReadWrite(Consts.Schema1.InternalDataTypes.XsdString, "Somebody", Xacml.XacmlVersion.Version11),  //TODO: check version
                    new ActionAttributeDesignatorElement(Consts.Schema1.InternalDataTypes.XsdString, false, "", "", Xacml.XacmlVersion.Version11),  //TODO: check version
                    Xacml.XacmlVersion.Version11);
            else if (_targetItem is EnvironmentElementReadWrite)
                targetMatch = new EnvironmentMatchElementReadWrite(
                    Consts.Schema1.InternalFunctions.StringEqual,
                    new pol.AttributeValueElementReadWrite(Consts.Schema1.InternalDataTypes.XsdString, "Somebody", Xacml.XacmlVersion.Version11),  //TODO: check version
                    new EnvironmentAttributeDesignatorElement(Consts.Schema1.InternalDataTypes.XsdString, false, "", "", Xacml.XacmlVersion.Version11),  //TODO: check version
                    Xacml.XacmlVersion.Version11);
            else if (_targetItem is ResourceElementReadWrite)
                targetMatch = new ResourceMatchElementReadWrite(
                    Consts.Schema1.InternalFunctions.StringEqual,
                    new pol.AttributeValueElementReadWrite(Consts.Schema1.InternalDataTypes.XsdString, "Somebody", Xacml.XacmlVersion.Version11),  //TODO: check version
                    new ResourceAttributeDesignatorElement(Consts.Schema1.InternalDataTypes.XsdString, false, "", "", Xacml.XacmlVersion.Version11),  //TODO: check version
                    Xacml.XacmlVersion.Version11);
            else if (_targetItem is SubjectElementReadWrite)
                targetMatch = new SubjectMatchElementReadWrite(
                    Consts.Schema1.InternalFunctions.StringEqual,
                    new pol.AttributeValueElementReadWrite(Consts.Schema1.InternalDataTypes.XsdString, "Somebody", Xacml.XacmlVersion.Version11),  //TODO: check version
                    new SubjectAttributeDesignatorElement(Consts.Schema1.InternalDataTypes.XsdString, false, "", "", "", Xacml.XacmlVersion.Version11),  //TODO: check version
                    Xacml.XacmlVersion.Version11);

            _targetItem.Match.Add(targetMatch); //TODO: check version

            try
            {
                LoadingData = true;
                Match matchControl = new Match(_targetItem, targetMatch, lstMatch.Items.Count);
                _list[lstMatch.Items.Count] = matchControl;
            }
            finally
            {
                LoadingData = false;
            }

            index = -1;
            lstMatch.Items.Clear();
            foreach (TargetMatchBaseReadWrite match in _targetItem.Match)
            {
                lstMatch.Items.Add(match);
            }
        }