예제 #1
0
        public void UpdateResults()
        {
            var rules = MetadataRuleSet.Rules.Select(rule => _metadataExtractor.ResolveStep(rule, null)).ToList();
            var rows  = new List <ExtractedMetadataResultRow>();

            foreach (var resultFile in _dataSchema.ResultFileList.Values)
            {
                var row = new ExtractedMetadataResultRow(resultFile);
                foreach (var rule in rules)
                {
                    ExtractedMetadataResultRow.ColumnKey columnKey = null;
                    if (rule.Target != null)
                    {
                        columnKey = new ExtractedMetadataResultRow.ColumnKey(rule.Target.PropertyPath, rule.Target.DisplayName);
                    }
                    row.AddRuleResult(columnKey, _metadataExtractor.ApplyStep(resultFile, rule));
                }
                rows.Add(row);
            }
            bindingListSourceResults.RowSource = new StaticRowSource(rows);
            if (rows.Count == 0)
            {
                splitContainer1.Panel2Collapsed = true;
            }
            else
            {
                splitContainer1.Panel2Collapsed = false;
            }
            UpdateButtons();
        }
예제 #2
0
        public void UpdateRows()
        {
            var errors       = new List <CommonException <MetadataExtractor.StepError> >();
            var resolvedRule = _metadataExtractor.ResolveStep(MetadataRule, errors);
            var regexError   =
                errors.FirstOrDefault(error => error.ExceptionDetail.Property == nameof(MetadataRule.Pattern));

            ShowRegexError(regexError);
            var rows = new List <ExtractedMetadataResultRow>();

            foreach (var resultFile in _dataSchema.ResultFileList.Values)
            {
                var row    = new ExtractedMetadataResultRow(resultFile);
                var result = _metadataExtractor.ApplyStep(resultFile, resolvedRule);
                row.AddRuleResult(null, result);
                rows.Add(row);
            }
            var viewInfo = GetDefaultViewInfo(resolvedRule, rows);

            bindingListSource1.SetView(viewInfo, new StaticRowSource(rows));
        }