/// <summary> /// Sets the value of the tracking property based on stored value of the DisplayName property. /// </summary> internal void ResetValue(NamedElementSchema element) { string calculatedValue = null; try { calculatedValue = element.CalculateDisplayNameTrackingValue(); } catch (NullReferenceException) { } catch (System.Exception e) { if (ErrorHandler.IsCriticalException(e)) { throw; } } if (calculatedValue != null) { if (string.Equals(element.DisplayName, calculatedValue, StringComparison.Ordinal) || string.IsNullOrEmpty(element.DisplayName)) { element.isDisplayNameTrackingPropertyStorage = true; } } }
/// <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); } }
/// <summary> /// Preset the value of the tracking property as it is not serialized. /// </summary> internal void PreResetValue(NamedElementSchema element) { // Force the tracking property to false so that the value // of the DisplayName property is retrieved from storage. element.isDisplayNameTrackingPropertyStorage = false; }