Exemplo n.º 1
0
        private void Businessflow_ClickGenerateReport(object sender, RoutedEventArgs e)
        {
            if (CheckCurrentRunnerIsNotRuning())
            {
                return;
            }

            BusinessFlow bf = (BusinessFlow)((RunnerItemPage)sender).ItemObject;
            ExecutionLoggerConfiguration _selectedExecutionLoggerConfiguration = WorkSpace.UserProfile.Solution.ExecutionLoggerConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault();
            HTMLReportsConfiguration     currentConf = WorkSpace.UserProfile.Solution.HTMLReportsConfigurationSetList.Where(x => (x.IsSelected == true)).FirstOrDefault();

            if (App.RunsetExecutor.RunSetConfig.LastRunsetLoggerFolder != null)
            {
                string reportpath          = ((BusinessFlow)((RunnerItemPage)sender).ItemObject).ExecutionFullLogFolder;
                string reportsResultFolder = string.Empty;
                if (!string.IsNullOrEmpty(reportpath))
                {
                    reportsResultFolder = Ginger.Reports.GingerExecutionReport.ExtensionMethods.CreateGingerExecutionReport(new ReportInfo(reportpath), false, null, currentConf.HTMLReportsFolder + Ginger.Run.ExecutionLogger.defaultRunTabBFName + Ginger.Reports.GingerExecutionReport.ExtensionMethods.folderNameNormalazing(bf.Name));
                }

                if (!_selectedExecutionLoggerConfiguration.ExecutionLoggerConfigurationIsEnabled)
                {
                    Reporter.ToUser(eUserMsgKey.ExecutionsResultsProdIsNotOn);
                    return;
                }
                else if (reportsResultFolder == string.Empty)
                {
                    Reporter.ToUser(eUserMsgKey.ExecutionsResultsNotExists);
                    return;
                }
                else
                {
                    foreach (string txt_file in System.IO.Directory.GetFiles(reportsResultFolder))
                    {
                        string fileName = System.IO.Path.GetFileName(txt_file);
                        if (fileName.Contains(".html"))
                        {
                            Process.Start(reportsResultFolder);
                            Process.Start(reportsResultFolder + "\\" + fileName);
                        }
                    }
                }
            }
            else
            {
                ExecutionLogger.GenerateBusinessFlowOfflineReport(mRunner.ProjEnvironment, currentConf.HTMLReportsFolder + bf.Name, bf, App.RunsetExecutor.RunSetConfig.Name);
            }
        }