Exemple #1
0
        public static TagVersionEnum SelectedVersionItemProvider(object item)
        {
            TagModel model = item as TagModel;

            if (model.IsSelected.Value)
            {
                return((item as TagModel).Version);
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
 private TagModelItem FindTemplateItem(TagModel tagModel, FrameMeaning meaning)
 {
     if (Object.ReferenceEquals(this[meaning], null))
     {
         return(null);
     }
     else
     {
         return
             ((from tagModelItem in this[meaning].Items
               where tagModelItem.TagModel == tagModel && !tagModel.Contains(tagModelItem)
               select tagModelItem).FirstOrDefault());
     }
 }
Exemple #3
0
        public void Add(string fileName, Tag tag, int bitrate)
        {
            if (Contains(fileName))
            {
                throw new Exception("Can't add twice!");
            }

            TagModel model = DocNode.Create <TagModel>();

            model.Init(fileName, tag, bitrate);

            model.IsSelected.TransactionIdModeToUse = DocObj <bool> .TransactionIdMode.UseFixed;
            model.IsSelected.FixedTransactionId     = GetHashCode();
            Items.Add(model);
        }
Exemple #4
0
        private TagModelItem CreateTemplateItem(TagModel tagModel, FrameMeaning meaning)
        {
            TagModelItem item = tagModel.CreateItemByMeaning(meaning);

            item.TagModel             = tagModel;
            item.IsTemplateItem.Value = true;

            if (meaning == FrameMeaning.Title)
            {
                item.Text.Value = tagModel.NameWithoutExtension;
            }

            TagModelItemHook hook = new TagModelItemHook();

            hook.Item = item;

            return(item);
        }
Exemple #5
0
        public static int IndexOf(
            this IEnumerable <TagModel> seq,
            TagModel item)
        {
            int i = 0;

            foreach (var tagModel in seq)
            {
                if (Object.ReferenceEquals(tagModel, item))
                {
                    return(i);
                }

                i++;
            }

            return(i);
        }
Exemple #6
0
        private void OnTagModelChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.OldItems != null)
            {
                foreach (object obj in e.OldItems)
                {
                    TagModelItem item = obj as TagModelItem;

                    if (IsFixed.Value)
                    {
                        TagModel tagModel = tagModelItemToTagModel[item];
                        if (FixedMeanings.Contains(item.Meaning) && !tagModel.Contains(item.Meaning))
                        {
                            AddTagModelItem(CreateTemplateItem(tagModel, item.Meaning));
                        }
                    }

                    RemoveTagModelItem(item);
                }
            }

            if (e.NewItems != null)
            {
                foreach (object obj in e.NewItems)
                {
                    TagModelItem item = obj as TagModelItem;

                    AddTagModelItem(item);

                    if (IsFixed.Value)
                    {
                        TagModel     tagModel     = tagModelItemToTagModel[item];
                        TagModelItem templateItem = FindTemplateItem(tagModel, item.Meaning);

                        if (!Object.ReferenceEquals(templateItem, null))
                        {
                            RemoveTagModelItem(templateItem);
                        }
                    }
                }
            }
        }
Exemple #7
0
 public bool HasTagModel(TagModel tagModel)
 {
     return(TagModels.Contains(tagModel));
 }
Exemple #8
0
 public TagConversionAction(TagModel model, Tag oldTag, Tag newTag)
     : base(model)
 {
     OldTag = oldTag;
     NewTag = newTag;
 }