/// <summary>
        /// Constuctor.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        /// <param name="serializedDomainRole">SerializedDomainRole.</param>
        /// <param name="referencedElement">Element that is referenced by the serialization element. Can be null.</param>
        public SerializedDomainRoleViewModel(ViewModelStore viewModelStore, DomainRole domainRole, DomainRelationship referencedElement, SerializedRelationshipViewModel parentVM)
            : base(viewModelStore, null, referencedElement)
        {
            this.parentVM = parentVM;
            this.domainRole = domainRole;

            if (domainRole != null)
            {
                this.EventManager.GetEvent<ModelElementPropertyChangedEvent>().Subscribe(this.domainRole.Id, new Action<ElementPropertyChangedEventArgs>(OnSerializedRolePropertyChanged));

                if (this.domainRole.RolePlayer != null)
                    this.EventManager.GetEvent<ModelElementPropertyChangedEvent>().Subscribe(this.domainRole.RolePlayer.Id, new Action<ElementPropertyChangedEventArgs>(OnSerializedRolePropertyChanged));
            }
        }
Пример #2
0
        /// <summary>
        /// Constuctor.
        /// </summary>
        /// <param name="viewModelStore">The store this view model belongs to.</param>
        /// <param name="serializedDomainRole">SerializedDomainRole.</param>
        /// <param name="referencedElement">Element that is referenced by the serialization element. Can be null.</param>
        public SerializedDomainRoleViewModel(ViewModelStore viewModelStore, DomainRole domainRole, DomainRelationship referencedElement, SerializedRelationshipViewModel parentVM)
            : base(viewModelStore, null, referencedElement)
        {
            this.parentVM   = parentVM;
            this.domainRole = domainRole;

            if (domainRole != null)
            {
                this.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Subscribe(this.domainRole.Id, new Action <ElementPropertyChangedEventArgs>(OnSerializedRolePropertyChanged));

                if (this.domainRole.RolePlayer != null)
                {
                    this.EventManager.GetEvent <ModelElementPropertyChangedEvent>().Subscribe(this.domainRole.RolePlayer.Id, new Action <ElementPropertyChangedEventArgs>(OnSerializedRolePropertyChanged));
                }
            }
        }