///-------------------------------------------------------------------------------- /// <summary>This method sets the default values.</summary> ///-------------------------------------------------------------------------------- protected override void OnSetDefaults() { if (Value.ReverseInstance != null) { EditValue.TransformDataFromObject(Value.ReverseInstance, null, false); } else if (Value.IsAutoUpdated == true) { EditValue.TransformDataFromObject(Value, null, false); } else { Value newValue = new Value(); newValue.ValueID = EditValue.ValueID; EditValue.TransformDataFromObject(newValue, null, false); } EditValue.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 (Value.ReverseInstance == null && Value.IsAutoUpdated == true) { Value.ReverseInstance = new Value(); Value.ReverseInstance.TransformDataFromObject(Value, null, false); // perform the update of EditValue back to Value Value.TransformDataFromObject(EditValue, null, false); Value.IsAutoUpdated = false; } else if (Value.ReverseInstance != null) { EditValue.ResetModified(Value.ReverseInstance.IsModified); if (EditValue.Equals(Value.ReverseInstance)) { // perform the update of EditValue back to Value Value.TransformDataFromObject(EditValue, null, false); Value.IsAutoUpdated = true; } else { // perform the update of EditValue back to Value Value.TransformDataFromObject(EditValue, null, false); Value.IsAutoUpdated = false; } } else { // perform the update of EditValue back to Value Value.TransformDataFromObject(EditValue, null, false); Value.IsAutoUpdated = false; } Value.ForwardInstance = null; if (ValueNameCustomized || EnumValueCustomized || OrderCustomized || DescriptionCustomized || TagsCustomized) { Value.ForwardInstance = new Value(); Value.ForwardInstance.ValueID = EditValue.ValueID; Value.SpecSourceName = Value.DefaultSourceName; if (ValueNameCustomized) { Value.ForwardInstance.ValueName = EditValue.ValueName; } if (EnumValueCustomized) { Value.ForwardInstance.EnumValue = EditValue.EnumValue; } if (OrderCustomized) { Value.ForwardInstance.Order = EditValue.Order; } if (DescriptionCustomized) { Value.ForwardInstance.Description = EditValue.Description; } if (TagsCustomized) { Value.ForwardInstance.Tags = EditValue.Tags; } } EditValue.ResetModified(false); OnUpdated(this, null); // send update back to solution builder SendEditValuePerformed(); }
///-------------------------------------------------------------------------------- /// <summary>This method resets the data.</summary> ///-------------------------------------------------------------------------------- protected override void OnReset() { EditValue.TransformDataFromObject(Value, null, false); EditValue.ResetModified(false); }