示例#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;
        }
示例#3
0
        public static IEnumerable <ID3.FrameDescription> PossibleFrameConversions(MultiTagModelItem item)
        {
            var frameDescription = item.FirstItem.Frame.Description;
            var version          = item.FirstItem.Frame.DescriptionMap.Version;
            var tagDescription   = ID3.TagDescriptionMap.Instance[version];

            foreach (var frameId in tagDescription.FrameIds)
            {
                var otherFrameDescription = tagDescription[frameId];

                if (otherFrameDescription.FrameId != frameDescription.FrameId &&
                    otherFrameDescription.Type == frameDescription.Type)
                {
                    yield return(otherFrameDescription);
                }
            }
        }
示例#4
0
        private void RemoveTagModelItem(TagModelItem tagModelItem)
        {
            MultiTagModelItem multiItem = FindBy(tagModelItem);

            if (!Object.ReferenceEquals(multiItem, null))
            {
                multiItem.BlockUpdates = BlockUpdates;

                if (multiItem.Items.Contains(tagModelItem))
                {
                    multiItem.Items.Remove(tagModelItem);
                    tagModelItemToTagModel.Remove(tagModelItem);
                }

                if (multiItem.Items.Count == 0 && !IsFixed.Value)
                {
                    MultiTagModelItems.Remove(multiItem);
                }
            }
        }
示例#5
0
 public DropTargetProvider(MultiTagModelItem item)
 {
     Item = item;
 }
示例#6
0
 public static bool CanConvertFrame(MultiTagModelItem item)
 {
     return(item.IsClassIdUnique &&
            !Object.ReferenceEquals(item.FirstItem, null) &&
            item.FirstItem.Frame.Description.Type == ID3.FrameDescription.FrameType.Text);
 }
示例#7
0
 public ConvertMultiTagModelItemCommand(MultiTagModelItem item, ID3.FrameDescription frameDesc)
     : base(new Text(item.FirstItem.FrameId + " -> " + frameDesc.FrameId + ": " + frameDesc.Description))
 {
     Item        = item;
     Description = frameDesc;
 }