예제 #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 (PropertyInstance.ReverseInstance == null && PropertyInstance.IsAutoUpdated == true)
            {
                PropertyInstance.ReverseInstance = new PropertyInstance();
                PropertyInstance.ReverseInstance.TransformDataFromObject(PropertyInstance, null, false);

                // perform the update of EditPropertyInstance back to PropertyInstance
                PropertyInstance.TransformDataFromObject(EditPropertyInstance, null, false);
                PropertyInstance.IsAutoUpdated = false;
            }
            else if (PropertyInstance.ReverseInstance != null)
            {
                EditPropertyInstance.ResetModified(PropertyInstance.ReverseInstance.IsModified);
                if (EditPropertyInstance.Equals(PropertyInstance.ReverseInstance))
                {
                    // perform the update of EditPropertyInstance back to PropertyInstance
                    PropertyInstance.TransformDataFromObject(EditPropertyInstance, null, false);
                    PropertyInstance.IsAutoUpdated = true;
                }
                else
                {
                    // perform the update of EditPropertyInstance back to PropertyInstance
                    PropertyInstance.TransformDataFromObject(EditPropertyInstance, null, false);
                    PropertyInstance.IsAutoUpdated = false;
                }
            }
            else
            {
                // perform the update of EditPropertyInstance back to PropertyInstance
                PropertyInstance.TransformDataFromObject(EditPropertyInstance, null, false);
                PropertyInstance.IsAutoUpdated = false;
            }
            PropertyInstance.ForwardInstance = null;
            if (ModelPropertyIDCustomized || OrderCustomized || PropertyValueCustomized || DescriptionCustomized || TagsCustomized)
            {
                PropertyInstance.ForwardInstance = new PropertyInstance();
                PropertyInstance.ForwardInstance.PropertyInstanceID = EditPropertyInstance.PropertyInstanceID;
                PropertyInstance.SpecSourceName = PropertyInstance.DefaultSourceName;
                if (ModelPropertyIDCustomized)
                {
                    PropertyInstance.ForwardInstance.ModelPropertyID = EditPropertyInstance.ModelPropertyID;
                }
                if (OrderCustomized)
                {
                    PropertyInstance.ForwardInstance.Order = EditPropertyInstance.Order;
                }
                if (PropertyValueCustomized)
                {
                    PropertyInstance.ForwardInstance.PropertyValue = EditPropertyInstance.PropertyValue;
                }
                if (DescriptionCustomized)
                {
                    PropertyInstance.ForwardInstance.Description = EditPropertyInstance.Description;
                }
                if (TagsCustomized)
                {
                    PropertyInstance.ForwardInstance.Tags = EditPropertyInstance.Tags;
                }
            }
            EditPropertyInstance.ResetModified(false);
            OnUpdated(this, null);

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