Ejemplo n.º 1
0
        private void TreeViewerOnImagedataRequred(object sender, ImageDataEventArgs args)
        {
            var metadata = _core.LoadMetadata(args.Path) ?? new ImageMetadata();
            //var metadata = await _core.LoadMetadataAsync(args.Path, CancellationToken.None) ?? new ImageMetadata();
            var criterion = new FilterCriterion()
            {
                Pattern       = _txtTreeFilter.Text,
                OnlyImportant = _chkImportant.Checked,
            };

            if (criterion.IsAllow(metadata))
            {
                args.Metadata = metadata;
            }
            var resultFilename = Path.ChangeExtension(args.Path, "result.xml");

            if (File.Exists(resultFilename))
            {
                try
                {
                    args.AlgorithmsMetadata = XmlStorage.LoadResult(resultFilename);
                }
                catch (Exception exc) when(!exc.IsCritical())
                {
                    Log.Warn($"Load result file fail: '{resultFilename}'.");
                }
            }
        }