コード例 #1
0
        /// <summary>
        /// Gets called when the parent model element of the current model element is about to change
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanging(NMF.Models.IModelElement newParent, NMF.Models.IModelElement oldParent)
        {
            NMF.Models.Meta.IEnumeration oldEnumeration = ModelHelper.CastAs <NMF.Models.Meta.IEnumeration>(oldParent);
            NMF.Models.Meta.IEnumeration newEnumeration = ModelHelper.CastAs <NMF.Models.Meta.IEnumeration>(newParent);
            ValueChangedEventArgs        e = new ValueChangedEventArgs(oldEnumeration, newEnumeration);

            this.OnEnumerationChanging(e);
            this.OnPropertyChanging("Enumeration", e, _enumerationReference);
        }
コード例 #2
0
 /// <summary>
 /// Adds the given element to the collection
 /// </summary>
 /// <param name="item">The item to add</param>
 public override void Add(NMF.Models.IModelElement item)
 {
     if ((this._parent.Enumeration == null))
     {
         NMF.Models.Meta.IEnumeration enumerationCasted = item.As <NMF.Models.Meta.IEnumeration>();
         if ((enumerationCasted != null))
         {
             this._parent.Enumeration = enumerationCasted;
             return;
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Gets called when the parent model element of the current model element changes
        /// </summary>
        /// <param name="oldParent">The old parent model element</param>
        /// <param name="newParent">The new parent model element</param>
        protected override void OnParentChanged(NMF.Models.IModelElement newParent, NMF.Models.IModelElement oldParent)
        {
            NMF.Models.Meta.IEnumeration oldEnumeration = ModelHelper.CastAs <NMF.Models.Meta.IEnumeration>(oldParent);
            NMF.Models.Meta.IEnumeration newEnumeration = ModelHelper.CastAs <NMF.Models.Meta.IEnumeration>(newParent);
            if ((oldEnumeration != null))
            {
                oldEnumeration.Literals.Remove(this);
            }
            if ((newEnumeration != null))
            {
                newEnumeration.Literals.Add(this);
            }
            ValueChangedEventArgs e = new ValueChangedEventArgs(oldEnumeration, newEnumeration);

            this.OnEnumerationChanged(e);
            this.OnPropertyChanged("Enumeration", e, _enumerationReference);
            base.OnParentChanged(newParent, oldParent);
        }