private bool TagFilter(ImageDocument document) { if (Tags.All(x => x.IsEnable.Value is false)) { return(true); } return(Tags.Where(x => x.IsEnable.Value) .Any(x => document.GetTags() .Contains(x.Name))); }
public TagEditorVm(ImageDocument imageDocument, ConfigService configService) { var documentTags = imageDocument.GetTags(); Tags = configService.Tags.ToReadOnlyReactiveCollection(x => new TagItemVm(x, documentTags.Contains(x))) .AddTo(Disposables); ApplyCommand = new DelegateCommand(() => { imageDocument.SetTags( Tags.Where(x => x.IsEnable.Value) .Select(x => x.Name) .ToArray()); }); }