Пример #1
0
        /*
         * public static string FixTag( string tagText, TagCasing casingFormat, out List<char> rejectedChars)
         * {
         *  var result = FilterChars(tagText, out rejectedChars);
         *  result = ChangeToSnakeCasing(result);
         *  return result;
         * }
         */
        public static void FixAllTagsInFiles(ImageFiles imageFiles)//, TagCasing casingFormat = TagCasing.SnakeCase)
        {
            var cancel        = false;
            var cancelContext = new CancelDialogDataContext();
            var cancelDialog  = new CancelDialog();

            cancelContext.CurrentValue  = 0;
            cancelContext.MaxValue      = imageFiles.Count;
            cancelContext.PerformAction = () =>
            {
                foreach (var filePath in imageFiles)
                {
                    if (cancel)
                    {
                        break;
                    }
                    var cleaned = ImageFileUtil.GetImageTags(filePath);
                    ImageFileUtil.ApplyTagsToImage(filePath, cleaned);
                    cancelContext.CurrentValue++;
                }
            };
            cancelContext.OnCancel = (s, e) => { cancel = true; cancelDialog.Close(); };
            cancelContext.OnClosed = (s, e) => { cancel = true; cancelDialog.Close(); };
            cancelDialog.SetContext(cancelContext);
            cancelDialog.ShowDialog();
        }
Пример #2
0
        private void SlideShow_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            var startIndex = ImageFiles.IndexOf(ImageDisplay.mainImageInfo.ImgPath);
            var newIndex   = SlideShow.PlaySlideshow(ImageFiles, startIndex);

            ImageGridDisplay.SetImage(newIndex);
            this.Show();
        }
Пример #3
0
        private void BatchTag_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            var files = ImageFiles.GetAll();

            if (files.Count > ImageAnalysisAPI.ImageAnalysis.maxItemsPerBatchRequest)
            {
                if (MessageBoxResult.No == MessageBox.Show(files.Count + " files are queued for process, do you want to continue?", "Warning:", MessageBoxButton.YesNo))
                {
                    return;
                }
            }
            Task.Run(async() =>
            {
                var asyncEnumerable = ImageAnalysisAPI.ImageAnalysis.RequestBatchAnalysis(files);
                await asyncEnumerable.ForEachAsync(toCombine =>
                {
                    ImageFileUtil.BatchApplyTagsToImages(toCombine.ToDictionary(v => v.Key, v => v.Value.Cast <ImageTag>()));
                });
            });
        }
Пример #4
0
 public void SetSearch(TagQueryCriteria tagQueryCriteria = null, bool newAdditionsOnly = false)
 {
     ImageFiles.Load(tagQueryCriteria, newAdditionsOnly);
 }