Example #1
0
        public void RemoveDependency(XmlDependencyViewModel dependency)
        {
            EnsureDependencyViewModels();

            if (_xmlDependencyViewModels.Contains(dependency))
            {
                _xmlDependencyViewModels.Remove(dependency);

                // also remove from underlying model
                if (_xmlComponent.Dependencies.Contains(dependency.XmlDependency))
                {
                    // this is what it should look like, but the implementation is broken:
                    //_xmlComponent.Dependencies.Remove(dependency.XmlDependency);
                    _xmlComponent.RemoveDependency(dependency.XmlDependency);

                    ReferencedComponentsTrackingService.RemoveReferencedComponent(dependency);
                }

                // set our own "dirty" flag
                SetChanged();
            }

            // call accept changes to let the dependency remove itself
            // from the change tracking service, if necessary
            dependency.AcceptChanges();
        }
Example #2
0
        private void CreateXmlDependencyViewModelList()
        {
            _xmlDependencyViewModels = new List <XmlDependencyViewModel>();

            foreach (var dependency in _xmlComponent.Dependencies)
            {
                var dependencyViewModel = new XmlDependencyViewModel(dependency, false);
                _xmlDependencyViewModels.Add(dependencyViewModel);

                // update tracking service
                ReferencedComponentsTrackingService.AddReferencedComponent(dependencyViewModel);
            }
        }
Example #3
0
        public void AddDependency(XmlDependencyViewModel dependency)
        {
            EnsureDependencyViewModels();

            if (!_xmlDependencyViewModels.Contains(dependency))
            {
                _xmlDependencyViewModels.Add(dependency);

                // also add to the underlying model
                if (!_xmlComponent.Dependencies.Contains(dependency.XmlDependency))
                {
                    // this is what it should look like, but the implementation is broken:
                    //_xmlComponent.Dependencies.Add(dependency.XmlDependency);
                    _xmlComponent.AddDependency(dependency.XmlDependency);

                    ReferencedComponentsTrackingService.AddReferencedComponent(dependency);
                }

                // set our own "dirty" flag
                SetChanged();
            }
        }