///-------------------------------------------------------------------------------- /// <summary>This method sets the default values.</summary> ///-------------------------------------------------------------------------------- protected override void OnSetDefaults() { if (ViewProperty.ReverseInstance != null) { EditViewProperty.TransformDataFromObject(ViewProperty.ReverseInstance, null, false); } else if (ViewProperty.IsAutoUpdated == true) { EditViewProperty.TransformDataFromObject(ViewProperty, null, false); } else { ViewProperty newViewProperty = new ViewProperty(); newViewProperty.ViewPropertyID = EditViewProperty.ViewPropertyID; EditViewProperty.TransformDataFromObject(newViewProperty, null, false); } EditViewProperty.ResetModified(true); }
///-------------------------------------------------------------------------------- /// <summary>This method updates the view model data and sends update command back /// to the solution builder.</summary> ///-------------------------------------------------------------------------------- protected override void OnUpdate() { // set up reverse engineering instance if not present if (ViewProperty.ReverseInstance == null && ViewProperty.IsAutoUpdated == true) { ViewProperty.ReverseInstance = new ViewProperty(); ViewProperty.ReverseInstance.TransformDataFromObject(ViewProperty, null, false); // perform the update of EditViewProperty back to ViewProperty ViewProperty.TransformDataFromObject(EditViewProperty, null, false); ViewProperty.IsAutoUpdated = false; } else if (ViewProperty.ReverseInstance != null) { EditViewProperty.ResetModified(ViewProperty.ReverseInstance.IsModified); if (EditViewProperty.Equals(ViewProperty.ReverseInstance)) { // perform the update of EditViewProperty back to ViewProperty ViewProperty.TransformDataFromObject(EditViewProperty, null, false); ViewProperty.IsAutoUpdated = true; } else { // perform the update of EditViewProperty back to ViewProperty ViewProperty.TransformDataFromObject(EditViewProperty, null, false); ViewProperty.IsAutoUpdated = false; } } else { // perform the update of EditViewProperty back to ViewProperty ViewProperty.TransformDataFromObject(EditViewProperty, null, false); ViewProperty.IsAutoUpdated = false; } ViewProperty.ForwardInstance = null; if (PropertyIDCustomized || OrderCustomized || DescriptionCustomized || TagsCustomized) { ViewProperty.ForwardInstance = new ViewProperty(); ViewProperty.ForwardInstance.ViewPropertyID = EditViewProperty.ViewPropertyID; ViewProperty.SpecSourceName = ViewProperty.DefaultSourceName; if (PropertyIDCustomized) { ViewProperty.ForwardInstance.PropertyID = EditViewProperty.PropertyID; } if (OrderCustomized) { ViewProperty.ForwardInstance.Order = EditViewProperty.Order; } if (DescriptionCustomized) { ViewProperty.ForwardInstance.Description = EditViewProperty.Description; } if (TagsCustomized) { ViewProperty.ForwardInstance.Tags = EditViewProperty.Tags; } } EditViewProperty.ResetModified(false); OnUpdated(this, null); // send update back to solution builder SendEditViewPropertyPerformed(); }
///-------------------------------------------------------------------------------- /// <summary>This method resets the data.</summary> ///-------------------------------------------------------------------------------- protected override void OnReset() { EditViewProperty.TransformDataFromObject(ViewProperty, null, false); EditViewProperty.ResetModified(false); }