예제 #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);
 }