/// <summary> /// Adds a new element view model for the given element. /// </summary> /// <param name="element">Element.</param> public void AddAttribute(SerializationElement element) { if (element == null) { return; } /* * if (!HasLoadedAttributes) * { * if (!HasDummyAttribute) * this.attributesVMs.Add(DummyAttribute); * * return; * }*/ // verify that node hasnt been added yet foreach (SerializationAttributeElementViewModel viewModel in this.attributesVMs) { if (viewModel.SerializationElement.Id == element.Id) { return; } } if (element is SerializedIdProperty) { SerializedIdPropertyViewModel vm = new SerializedIdPropertyViewModel(this.ViewModelStore, element as SerializedIdProperty, this); this.attributesVMs.Add(vm); } else if (element is SerializedDomainProperty) { SerializedDomainPropertyViewModel vm = new SerializedDomainPropertyViewModel(this.ViewModelStore, element as SerializedDomainProperty, this); this.attributesVMs.Add(vm); } OnPropertyChanged("HasAttributes"); }
/// <summary> /// Adds a new element view model for the given element. /// </summary> /// <param name="element">Element.</param> public void AddAttribute(SerializationElement element) { if (element == null) return; /* if (!HasLoadedAttributes) { if (!HasDummyAttribute) this.attributesVMs.Add(DummyAttribute); return; }*/ // verify that node hasnt been added yet foreach (SerializationAttributeElementViewModel viewModel in this.attributesVMs) if (viewModel.SerializationElement.Id == element.Id) return; if (element is SerializedIdProperty) { SerializedIdPropertyViewModel vm = new SerializedIdPropertyViewModel(this.ViewModelStore, element as SerializedIdProperty, this); this.attributesVMs.Add(vm); } else if( element is SerializedDomainProperty ) { SerializedDomainPropertyViewModel vm = new SerializedDomainPropertyViewModel(this.ViewModelStore, element as SerializedDomainProperty, this); this.attributesVMs.Add(vm); } OnPropertyChanged("HasAttributes"); }