예제 #1
0
        /// =======================================================================================================
        public static void ShowReport(AutoReport auto_report, double y_scale = 0.1)
        {
            FormAccess(FormDelegates.FormClose, null, "Report");
            int             reportwidth = (int)(0.5 * ScreenXy().X);
            Status          autostatus  = auto_report.CalculatedAutoResult();
            GroupBox        autogroup   = GetGroupBox(auto_report.AutoSummary(), autostatus, min_width: (reportwidth - 25));
            FlowLayoutPanel flpauto     = GetFlowPanel();

            foreach (BatchReport batchreport in auto_report.BatchReports.Values)
            {
                FlowLayoutPanel flpbatch    = GetFlowPanel(auto_scroll: false);
                Status          batchstatus = batchreport.ResultStatus;
                GroupBox        batchgroup  = GetGroupBox(batchreport.Summary(), batchstatus, min_width: (reportwidth - 35));

                // Add batch decription as first label
                foreach (CommandReport commandreport in batchreport.CommandReports.Values)
                {
                    string commanddetail = "[" + IndexLetter(commandreport.CommandMap.C) + "]" + (commandreport.CommandMap.D == 0 ? " " : "#" + commandreport.CommandMap.D + " ") +
                                           commandreport.Description + " " +
                                           commandreport.StartTime + " " +
                                           commandreport.Duration() + " " +
                                           commandreport.ResultStatus;
                    flpbatch.Controls.Add(GetLabel(commanddetail, commandreport.ResultStatus, max_width: (reportwidth - 35)));

                    // Charts - design decision to perform frequency time graph split to keep aligned
                    if (commandreport.Charts.Count > 0)
                    {
                        GroupBox chartgroup = GetGroupBox("chart" + batchreport.Summary(), Status.BUSY);
                        foreach (List <ChartData> charts in commandreport.Charts)
                        {
                            //int tracknumber = 0;
                            foreach (ChartData chart in charts)
                            {
                                flpbatch.Controls.Add(Graph.Milliseconds(chart, chart.Name, 150, y_scale, reportwidth - 65));
                            }
                        }
                    }

                    // Messages
                    foreach (Msg message in commandreport.Messages)
                    {
                        flpbatch.Controls.Add(GetLabel(message.Text, message.ResultStatus));
                    }
                }
                flpbatch.Controls.Add(GetLabel(batchstatus == Status.PASS ? ":)" : ":(", batchstatus));
                batchgroup.Controls.Add(flpbatch);
                flpauto.Controls.Add(batchgroup);
            }
            autogroup.Controls.Add(flpauto);
            CustomForm form = new CustomForm("Report", "Report for " + auto_report.Alias, autogroup, Side.Right);

            new Thread(() => Application.Run(form)).Start();
        }