Call a XAML from a WorkFlowAnalyzerRule

Hello,

I’ve written the skeleton of a WorkflowAnalyzerRule (written in C#), and I need to call an existing XAML from this WorkflowAnalyzerRule. Is this possible, or how is this possible? I don’t want to have to rewrite all the code written in the XAML in pure C#.

Please help. A link to the relevant documentation would also be helpful. Thanks.

Here is the skeleton of my WorkflowAnalyzerRule:

using UiPath.Studio.Activities.Api;
using UiPath.Studio.Activities.Api.Analyzer;
using UiPath.Studio.Activities.Api.Analyzer.Rules;
using UiPath.Studio.Analyzer.Models;

namespace WorkFlowAnalyzerRule
{
    public class RuleCompareConfig : IRegisterAnalyzerConfiguration
    {
        public void Initialize(IAnalyzerConfigurationService workflowAnalyzerConfigService)
        {
            if (!workflowAnalyzerConfigService.HasFeature("WorkflowAnalyzerV4"))
                return;

            var compareConfigRule = new Rule<IProjectModel>("PerformCompareConfig", "IT-USG-001", UsgCompareConfig);
            compareConfigRule.DefaultErrorLevel = System.Diagnostics.TraceLevel.Info;

            workflowAnalyzerConfigService.AddRule<IProjectModel>(compareConfigRule);
        }

    private InspectionResult UsgCompareConfig(IProjectModel pm, Rule configuredRule)
        {
            // Insert call from workflow (xyz.xaml) here
            
            var messageList = new List<InspectionMessage>();
            messageList.Add(new InspectionMessage()
            {
                Message = "Test"
            });

            return new InspectionResult()
            {
                HasErrors = true,
                InspectionMessages = messageList,
                RecommendationMessage = "Aufruf von CompareConfig einbauen!",
                // ErrorLevel = System.Diagnostics.TraceLevel.Warning,
                ErrorLevel = configuredRule.ErrorLevel,
            };
        }
    };
}

@michael.nes

xaml and workflow analyzer rules are two different things

xaml is project scopes and workflow analyzer is global scoped

cheers

Yes, it’s actually clear :slight_smile:

Thnx!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.