Esempio n. 1
0
        protected virtual WorkshopValidatedItem TestTags()
        {
            var originalTags = new TagsCollection(Target.Tags);
            var newTags      = new TagsCollection(originalTags.Where(x => x != null && IsTagAllowed(x.ToLowerInvariant()))
                                                  .Concat(GetForcedTags()).NonNull()).CleanUp().Sort();

            for (var i = newTags.Count - 1; i >= MaxTagsCount; --i)
            {
                newTags.RemoveAt(i);
            }

            if (newTags.SequenceEqual(originalTags))
            {
                return(new WorkshopValidatedItem("Tags are correct"));
            }

            return(new WorkshopValidatedItem($"Tags will be changed to {newTags.Select(x => $"“{x}”").JoinToString(", ")}",
                                             () => Target.Tags = newTags, () => Target.Tags = originalTags));
        }
 private void OnToggleButtonClick(object selectedTag)
 {
     SelectedTags = TagsCollection.Where(t => t.IsChecked).ToAsyncObservableCollection();
 }
Esempio n. 3
0
 /// <summary>
 /// Return the Tag with the specified id
 /// </summary>
 /// <param name="identity"></param>
 /// <returns></returns>
 public static Tag GetTagById(int identity) => TagsCollection.Where(tag => tag.Id == identity).FirstOrDefault();