public async Task CreateThumbnail(ImageDocument imageDocument)
        {
            var originalPath = imageDocument.Pages[0];

            var thumbnailDirectory = Path.Combine(_config.ThumbnailDirectory, imageDocument.MetaData.Id.ToString());
            var smallThumbnailPath = Path.Combine(thumbnailDirectory, "small.png");
            var largeThumbnailPath = Path.Combine(thumbnailDirectory, "large.png");

            Directory.CreateDirectory(thumbnailDirectory);

            await Task.Run(async() =>
            {
                using var magick = new MagickImage(originalPath);
                magick.Strip();

                // 大きいサムネイルを作成
                {
                    magick.Thumbnail(256, 256);
                    await using var stream = File.Create(largeThumbnailPath);
                    await magick.WriteAsync(stream);
                }

                // 小さいサムネイルを作成
                {
                    magick.Thumbnail(64, 64);
                    await using var stream = File.Create(smallThumbnailPath);
                    await magick.WriteAsync(stream);
                }
            });
        }
 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());
            });
        }
        public RecentVm(ImageDocument value)
        {
            Document = value;

            if (value is null)
            {
                // データが物理的に存在していない場合
                DisplayName = "不明";
                Thumbnail   = "Resources/loading.png";
            }
            else
            {
                DisplayName = value.DisplayName;
                Thumbnail   = value.SmallThumbnailAbsolutePath;
            }
        }
 public void OpenWithExplorer(ImageDocument document)
 {
     Process.Start("explorer", document.DirectoryPath);
 }
 public TagEditorVm BuildTagVm(ImageDocument document)
 {
     return(new TagEditorVm(document, _configService));
 }