/// <summary> /// Sets initial edited or selected index. /// </summary> private void SetSelectedValue() { if (EditValue.Equals(NullValue) && RememberSessionValues) { GetSessionValue(); } SelectedIndex = Items.IndexOf(Items.FindByValue(EditValue.ToString())); EditValue = NullValue; }
///-------------------------------------------------------------------------------- /// <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(); }