///--------------------------------------------------------------------------------
        /// <summary>This method updates the view model data and sends update command back
        /// to the solution builder.</summary>
        ///--------------------------------------------------------------------------------
        protected override void OnUpdate()
        {
            // send update for any updated children
            foreach (EntityReferenceViewModel item in EntityReferences)
            {
                if (item.IsEdited == true)
                {
                    item.Update();
                }
            }
            // send update for any new children
            foreach (EntityReferenceViewModel item in ItemsToAdd.OfType <EntityReferenceViewModel>())
            {
                item.Update();
                EntityReferences.Add(item);
            }
            ItemsToAdd.Clear();

            // send delete for any deleted children
            foreach (EntityReferenceViewModel item in ItemsToDelete.OfType <EntityReferenceViewModel>())
            {
                item.Delete();
                EntityReferences.Remove(item);
            }
            ItemsToDelete.Clear();

            // reset modified for children
            foreach (EntityReferenceViewModel item in EntityReferences)
            {
                item.ResetModified(false);
            }
        }
Пример #2
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method updates the view model data and sends update command back
        /// to the solution builder.</summary>
        ///--------------------------------------------------------------------------------
        protected override void OnUpdate()
        {
            // send update for any updated children
            foreach (StageTransitionViewModel item in StageTransitions)
            {
                if (item.IsEdited == true)
                {
                    item.Update();
                }
            }
            // send update for any new children
            foreach (StageTransitionViewModel item in ItemsToAdd.OfType <StageTransitionViewModel>())
            {
                item.Update();
                StageTransitions.Add(item);
            }
            ItemsToAdd.Clear();

            // send delete for any deleted children
            foreach (StageTransitionViewModel item in ItemsToDelete.OfType <StageTransitionViewModel>())
            {
                item.Delete();
                StageTransitions.Remove(item);
            }
            ItemsToDelete.Clear();

            // reset modified for children
            foreach (StageTransitionViewModel item in StageTransitions)
            {
                item.ResetModified(false);
            }
        }
Пример #3
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 (Feature.ReverseInstance == null && Feature.IsAutoUpdated == true)
            {
                Feature.ReverseInstance = new Feature();
                Feature.ReverseInstance.TransformDataFromObject(Feature, null, false);

                // perform the update of EditFeature back to Feature
                Feature.TransformDataFromObject(EditFeature, null, false);
                Feature.IsAutoUpdated = false;
            }
            else if (Feature.ReverseInstance != null)
            {
                EditFeature.ResetModified(Feature.ReverseInstance.IsModified);
                if (EditFeature.Equals(Feature.ReverseInstance))
                {
                    // perform the update of EditFeature back to Feature
                    Feature.TransformDataFromObject(EditFeature, null, false);
                    Feature.IsAutoUpdated = true;
                }
                else
                {
                    // perform the update of EditFeature back to Feature
                    Feature.TransformDataFromObject(EditFeature, null, false);
                    Feature.IsAutoUpdated = false;
                }
            }
            else
            {
                // perform the update of EditFeature back to Feature
                Feature.TransformDataFromObject(EditFeature, null, false);
                Feature.IsAutoUpdated = false;
            }
            Feature.ForwardInstance = null;
            if (FeatureNameCustomized || DescriptionCustomized || TagsCustomized)
            {
                Feature.ForwardInstance           = new Feature();
                Feature.ForwardInstance.FeatureID = EditFeature.FeatureID;
                Feature.SpecSourceName            = Feature.DefaultSourceName;
                if (FeatureNameCustomized)
                {
                    Feature.ForwardInstance.FeatureName = EditFeature.FeatureName;
                }
                if (DescriptionCustomized)
                {
                    Feature.ForwardInstance.Description = EditFeature.Description;
                }
                if (TagsCustomized)
                {
                    Feature.ForwardInstance.Tags = EditFeature.Tags;
                }
            }
            EditFeature.ResetModified(false);
            OnUpdated(this, null);

            // send update back to solution builder
            SendEditFeaturePerformed();

            // send update for any updated Entities
            foreach (EntityViewModel item in Entities)
            {
                if (item.IsEdited == true)
                {
                    item.Update();
                }
            }
            // send update for any new Entities
            foreach (EntityViewModel item in ItemsToAdd.OfType <EntityViewModel>())
            {
                item.Update();
                Entities.Add(item);
            }

            // send delete for any deleted Entities
            foreach (EntityViewModel item in ItemsToDelete.OfType <EntityViewModel>())
            {
                item.Delete();
                Entities.Remove(item);
            }

            // reset modified for Entities
            foreach (EntityViewModel item in Entities)
            {
                item.ResetModified(false);
            }
            ItemsToAdd.Clear();
            ItemsToDelete.Clear();
        }