コード例 #1
0
        private void Add(DependencyItemViewModel item)
        {
            item.Number = allDependencies.Count;
            allDependencies.Add(item);

            if (!hiddenCategories.Contains(item.Category))
            {
                displayedDependencies.Add(item);
            }

            switch (item.Category)
            {
            case DependencyItemCategory.Embedded:
                this.EmbeddedCount++;
                break;

            case DependencyItemCategory.Embedding:
                this.EmbeddingCount++;
                break;

            case DependencyItemCategory.Referenced:
                this.ReferencedCount++;
                break;

            case DependencyItemCategory.Referencing:
                this.ReferencingCount++;
                break;
            }

            if (doSubscribeToEvents)
            {
                // subscribe to event notifying of a specific link beeind deleted or altered
                this.ViewModelStore.EventManager.GetEvent <ModelElementDeletedEvent>().Subscribe(item.DependencyItem.ElementLink.Id, OnElementLinkDeleted);
                this.ViewModelStore.EventManager.GetEvent <ModelRolePlayerChangedEvent>().Subscribe(item.DependencyItem.ElementLink.Id, OnElementLinkChanged);
            }
        }
コード例 #2
0
        private void Add(DependencyItemViewModel item)
        {
            item.Number = allDependencies.Count;
            allDependencies.Add(item);

            if (!hiddenCategories.Contains(item.Category))
                displayedDependencies.Add(item);

            switch (item.Category)
            {
                case DependencyItemCategory.Embedded:
                    this.EmbeddedCount++;
                    break;

                case DependencyItemCategory.Embedding:
                    this.EmbeddingCount++;
                    break;

                case DependencyItemCategory.Referenced:
                    this.ReferencedCount++;
                    break;

                case DependencyItemCategory.Referencing:
                    this.ReferencingCount++;
                    break;
            }

            if (doSubscribeToEvents)
            {
                // subscribe to event notifying of a specific link beeind deleted or altered
                this.ViewModelStore.EventManager.GetEvent<ModelElementDeletedEvent>().Subscribe(item.DependencyItem.ElementLink.Id, OnElementLinkDeleted);
                this.ViewModelStore.EventManager.GetEvent<ModelRolePlayerChangedEvent>().Subscribe(item.DependencyItem.ElementLink.Id, OnElementLinkChanged);
            }
        }