public static TagVersionEnum SelectedVersionItemProvider(object item) { TagModel model = item as TagModel; if (model.IsSelected.Value) { return((item as TagModel).Version); } else { return(null); } }
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()); } }
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); }
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); }
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); }
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); } } } } }
public bool HasTagModel(TagModel tagModel) { return(TagModels.Contains(tagModel)); }
public TagConversionAction(TagModel model, Tag oldTag, Tag newTag) : base(model) { OldTag = oldTag; NewTag = newTag; }