Example #1
0
        public void RemoveTagModel(TagModel tagModel)
        {
            tagModel.Items.CollectionChanged -= OnTagModelChanged;
            foreach (TagModelItem tagModelItem in tagModel.Items)
            {
                RemoveTagModelItem(tagModelItem);
            }
            TagModels.Remove(tagModel);

            if (TagModels.Count == 0)
            {
                MultiTagModelItems.ForEach(n => n.IsEnabled = false);
            }

            if (IsFixed.Value)
            {
                foreach (FrameMeaning meaning in FixedMeanings)
                {
                    if (tagModel.Supports(meaning) && !tagModel.Contains(meaning))
                    {
                        RemoveTagModelItem(FindTemplateItem(tagModel, meaning));
                    }
                }
            }
        }
Example #2
0
        public void AddTagModel(TagModel tagModel)
        {
            int count = TagModels.Count;

            TagModels.Add(tagModel);

            tagModel.Items.ForEach(n => AddTagModelItem(n));
            tagModel.Items.CollectionChanged += OnTagModelChanged;

            if (count == 0)
            {
                MultiTagModelItems.ForEach(n => n.IsEnabled = true);
            }

            if (IsFixed.Value)
            {
                foreach (FrameMeaning meaning in FixedMeanings)
                {
                    if (tagModel.Supports(meaning) && !tagModel.Contains(meaning))
                    {
                        AddTagModelItem(CreateTemplateItem(tagModel, meaning));
                    }
                }
            }
        }