예제 #1
0
        private void UpdateIsFixed(object sender, PropertyChangedEventArgs e)
        {
            Clear();
            MultiTagItems.Clear();

            if (IsFixed.Value)
            {
                foreach (var fm in FixedMeanings)
                {
                    TagDescription desc = TagDescriptionMap.Instance[ID3.Version.v2_3];

                    Frame frame = new Frame(desc, fm);
                    FrameDescription.FrameType type = desc[fm].Type;

                    TagModelItem item = TagModelItemFactory.Create(type);
                    item.Frame = frame;

                    MultiTagModelItem mtmi = MultiTagModelItemFactory.Create(type);
                    mtmi.InitFixed(item);
                    MultiTagModelItems.Add(mtmi);
                }
            }

            adapter.UpdateItems();
        }
예제 #2
0
        private void AddTagModelItem(TagModelItem tagModelItem)
        {
            MultiTagModelItem multiTagModelItem = FindBy(tagModelItem);

            if (Object.ReferenceEquals(multiTagModelItem, null) && !IsFixed.Value)
            {
                multiTagModelItem = MultiTagModelItemFactory.Create(tagModelItem.Frame.Description.Type);
                multiTagModelItem.BlockUpdates = BlockUpdates;
                MultiTagModelItems.Add(multiTagModelItem);
            }

            if (!Object.ReferenceEquals(multiTagModelItem, null))
            {
                int index = IsFixed.Value
                    ? TagModelList.SelectedModels.IndexOf(tagModelItem.TagModel)
                    : TagModelList.SelectedModels.IndexOfTagModelItemByFrameId(tagModelItem);

                int clippedIndex = Math.Min(index, multiTagModelItem.Items.Count);
                if (!multiTagModelItem.Items.Contains(tagModelItem))
                {
                    multiTagModelItem.Items.Insert(clippedIndex, tagModelItem);
                }
            }

            tagModelItemToTagModel[tagModelItem] = tagModelItem.TagModel;
        }