Esempio n. 1
0
 /// <summary>
 ///    Called after the IsTargetImplementNotifyTracking property changes.
 /// </summary>
 /// <param name="element">The model element that has the property that changed. </param>
 /// <param name="oldValue">The previous value of the property. </param>
 /// <param name="newValue">The new value of the property. </param>
 protected override void OnValueChanged(Association element, bool oldValue, bool newValue)
 {
     base.OnValueChanged(element, oldValue, newValue);
     if (!element.Store.InUndoRedoOrRollback && newValue)
     {
         DomainPropertyInfo propInfo = element.Store.DomainDataDirectory.GetDomainProperty(TargetImplementNotifyDomainPropertyId);
         propInfo.NotifyValueChange(element);
     }
 }
Esempio n. 2
0
 /// <summary>
 ///    Called after the IsAutoPropertyTracking property changes.
 /// </summary>
 /// <param name="element">The model element that has the property that changed. </param>
 /// <param name="oldValue">The previous value of the property. </param>
 /// <param name="newValue">The new value of the property. </param>
 protected override void OnValueChanged(ModelAttribute element, bool oldValue, bool newValue)
 {
    base.OnValueChanged(element, oldValue, newValue);
    if (!element.Store.InUndoRedoOrRollback && newValue)
    {
       DomainPropertyInfo propInfo = element.Store.DomainDataDirectory.GetDomainProperty(AutoPropertyDomainPropertyId);
       propInfo.NotifyValueChange(element);
    }
 }
Esempio n. 3
0
 /// <summary>
 ///    Called after the IsDefaultConstructorVisibilityTracking property changes.
 /// </summary>
 /// <param name="element">The model element that has the property that changed. </param>
 /// <param name="oldValue">The previous value of the property. </param>
 /// <param name="newValue">The new value of the property. </param>
 protected override void OnValueChanged(ModelClass element, bool oldValue, bool newValue)
 {
     base.OnValueChanged(element, oldValue, newValue);
     if (!element.Store.InUndoRedoOrRollback && newValue)
     {
         DomainPropertyInfo propInfo = element.Store.DomainDataDirectory.GetDomainProperty(DefaultConstructorVisibilityDomainPropertyId);
         propInfo.NotifyValueChange(element);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Called after the IsDisplayNameTracking property changes.
 /// </summary>
 protected override void OnValueChanged(NamedElementSchema element, bool oldValue, bool newValue)
 {
     base.OnValueChanged(element, oldValue, newValue);
     if (!element.Store.InUndoRedoOrRollback && newValue)
     {
         DomainPropertyInfo propInfo =
             element.Store.DomainDataDirectory.GetDomainProperty(
                 NamedElementSchema.DisplayNameDomainPropertyId);
         propInfo.NotifyValueChange(element);
     }
 }
Esempio n. 5
0
 public static void NotifyChangesToDesigner(this ModelElement modelElement, PropertyChangedEventArgs args)
 {
     if (!modelElement.IsDeleting && !modelElement.IsDeleted && (!modelElement.Store.InSerializationTransaction))
     {
         using (Transaction transaction = modelElement.Store.TransactionManager.BeginTransaction("Notify changes"))
         {
             DomainClassInfo    domainClassInfo = modelElement.GetDomainClass();
             DomainPropertyInfo domainProperty  = domainClassInfo.FindDomainProperty(args.PropertyName, true);
             domainProperty.NotifyValueChange(modelElement);
             transaction.Commit();
         }
     }
 }
Esempio n. 6
0
        /// <summary>Notify each model element in a collection that a tracked property has changed.</summary>
        /// <param name="store">The store for the model.</param>
        /// <param name="collection">The collection of model elements that contain the tracking property.</param>
        /// <param name="propertyId">The ID of the tracking property.</param>
        /// <param name="trackingPropertyId">The ID of the property that indicates whether the tracking property is tracking.</param>
        internal static void UpdateTrackingCollectionProperty(
            Store store,
            IEnumerable collection,
            Guid propertyId,
            Guid trackingPropertyId)
        {
            DomainPropertyInfo propInfo         = store.DomainDataDirectory.GetDomainProperty(propertyId);
            DomainPropertyInfo trackingPropInfo = store.DomainDataDirectory.GetDomainProperty(trackingPropertyId);

            Debug.Assert(propInfo != null);
            Debug.Assert(trackingPropInfo != null);
            Debug.Assert(trackingPropInfo.PropertyType == typeof(bool), "Tracking property not specified as a boolean");

            // If the tracking property is currently tracking, then notify
            // it that the tracked property has changed.
            foreach (ModelElement element in collection.Cast <ModelElement>()
                     .Where(element => element.GetDomainClass() == trackingPropInfo.DomainClass &&
                            (bool)trackingPropInfo.GetValue(element)))
            {
                propInfo.NotifyValueChange(element);
            }
        }