Example #1
0
        ///--------------------------------------------------------------------------------
        /// <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 (StateTransition.ReverseInstance == null && StateTransition.IsAutoUpdated == true)
            {
                StateTransition.ReverseInstance = new StateTransition();
                StateTransition.ReverseInstance.TransformDataFromObject(StateTransition, null, false);

                // perform the update of EditStateTransition back to StateTransition
                StateTransition.TransformDataFromObject(EditStateTransition, null, false);
                StateTransition.IsAutoUpdated = false;
            }
            else if (StateTransition.ReverseInstance != null)
            {
                EditStateTransition.ResetModified(StateTransition.ReverseInstance.IsModified);
                if (EditStateTransition.Equals(StateTransition.ReverseInstance))
                {
                    // perform the update of EditStateTransition back to StateTransition
                    StateTransition.TransformDataFromObject(EditStateTransition, null, false);
                    StateTransition.IsAutoUpdated = true;
                }
                else
                {
                    // perform the update of EditStateTransition back to StateTransition
                    StateTransition.TransformDataFromObject(EditStateTransition, null, false);
                    StateTransition.IsAutoUpdated = false;
                }
            }
            else
            {
                // perform the update of EditStateTransition back to StateTransition
                StateTransition.TransformDataFromObject(EditStateTransition, null, false);
                StateTransition.IsAutoUpdated = false;
            }
            StateTransition.ForwardInstance = null;
            if (StateTransitionNameCustomized || FromStateIDCustomized || DescriptionCustomized || TagsCustomized)
            {
                StateTransition.ForwardInstance = new StateTransition();
                StateTransition.ForwardInstance.StateTransitionID = EditStateTransition.StateTransitionID;
                StateTransition.SpecSourceName = StateTransition.DefaultSourceName;
                if (StateTransitionNameCustomized)
                {
                    StateTransition.ForwardInstance.StateTransitionName = EditStateTransition.StateTransitionName;
                }
                if (FromStateIDCustomized)
                {
                    StateTransition.ForwardInstance.FromStateID = EditStateTransition.FromStateID;
                }
                if (DescriptionCustomized)
                {
                    StateTransition.ForwardInstance.Description = EditStateTransition.Description;
                }
                if (TagsCustomized)
                {
                    StateTransition.ForwardInstance.Tags = EditStateTransition.Tags;
                }
            }
            EditStateTransition.ResetModified(false);
            OnUpdated(this, null);

            // send update back to solution builder
            SendEditStateTransitionPerformed();
        }