예제 #1
0
        internal void LoadRuleSets()
        {
            pac.Enable(false);
            var enabled = true;

            pac.WorkAsync(new WorkAsyncInfo()
            {
                Message = "Loading rulesets",
                Work    = (worker, args) =>
                {
                    args.Result = PACHelper.GetRuleSets(serviceUrl);
                },
                PostWorkCallBack = (args) =>
                {
                    if (args.Error != null)
                    {
                        pac.ShowError(args.Error);
                    }
                    else if (args.Result is RuleSet[] rulesetlist)
                    {
                        AddRuleSets(rulesetlist);
                        LoadRules();
                        enabled = false;
                    }
                    pac.Enable(enabled);
                }
            });
예제 #2
0
        private void CheckAnalysisStatus()
        {
            tmStatus.Enabled = false;
            pac.Enable(false);
            var enabled = true;

            pac.WorkAsync(new WorkAsyncInfo
            {
                Message       = "Checking analysis status",
                AsyncArgument = new { clientinfo = pac.PACClientInfo, url = txtStatusUrl.Text },
                Work          = (worker, args) =>
                {
                    var a          = args.Argument as dynamic;
                    var clientinfo = a.clientinfo as PACClientInfo;
                    var url        = a.url as string;
                    args.Result    = PACHelper.GetAnalysisStatus(clientinfo, url);
                },
                PostWorkCallBack = (args) =>
                {
                    if (args.Error != null)
                    {
                        panAnalyzing.Visible = false;
                        pac.ShowError(args.Error);
                    }
                    else if (args.Result is AnalysisStatus status)
                    {
                        txtRunCorrId.Text = status.RunCorrelationId.ToString();
                        SetStatus(status.Status, status.Progress);
                        if (status.Progress >= 100)
                        {
                            panAnalyzing.Visible = false;
                            SetCounts(status);
                            if (status.ResultFileUris != null && status.ResultFileUris.Length > 0)
                            {
                                txtResultFile.Text = status.ResultFileUris[0];
                                GetResultFile(status);
                                enabled = false;
                            }
                        }
                        else
                        {
                            tmStatus.Start();
                        }
                    }
                    pac.Enable(enabled);
                }
            });