/// <summary>
 /// Возвращает валидные сущности из выделенных завершенных тегов по порядку.
 /// </summary>
 /// <returns></returns>
 private IEnumerable <ConfWithHio> GetCHIOsOfSelectedCompleted()
 {
     return(SelectedTags
            .Where(t => t.State == State.Completed)
            .Where(t => t.Blank.IsValid())
            .Select(t => new ConfWithHio(t.Blank, t.Confidence)));
 }
        public void Cut()
        {
            Contract.Ensures(Tags.Count <= Contract.OldValue(Tags).Count);

            logger.Debug("cut");
            Copy();

            // do not remove init tags
            var completed = SelectedTags.Where(t => t.State == State.Completed);

            completed.ForAll(t => t.DeleteCommand.Execute(null));
        }
Beispiel #3
0
        private void UpdateSelectedTagsOnAdd(TagItem addedTag)
        {
            var source = (IList <TagItem>)ItemsSource;

            if (source.Count == SelectedTags.Count) //Update SelectedTags list if user edits tags
            {
                SelectedTags.Where(i => source.All(s => !s.Text.Equals(i) || i.Equals(addedTag.Text)))
                .ToList()
                .ForEach(r => SelectedTags.Remove(r));
            }
            SelectedTags.Add(addedTag.Text);
        }
Beispiel #4
0
 private void UpdateSelectedTagsOnRemove(TagItem removedTag)
 {
     if (removedTag == null)
     {
         return;
     }
     if (!string.IsNullOrEmpty(removedTag.Text)) // Remove if delete button was clicked
     {
         SelectedTags.Remove(removedTag.Text);
     }
     else  // Remove if backspace was used to delete tag (TagItem Text was changed to empty and was then removed)
     {
         var source = (IList <TagItem>)ItemsSource;
         SelectedTags.Where(i => source.All(s => !s.Text.Equals(i)))
         .ToList()
         .ForEach(r => SelectedTags.Remove(r));
     }
 }