private void btnGenerateReport_Click(object sender, EventArgs e) { string errorMessage = null; if (!AllFieldsEntered(out errorMessage)) { UIHelper.DisplayError(errorMessage); return; } if (!Directory.Exists(txtLogsDirectory.Text)) { UIHelper.DisplayError(string.Format("Could not find directory {0}.", txtLogsDirectory.Text)); return; } DateTime currentDate = DateTime.Now; string outputFileName = string.Format( "DatasmithSpeechAnalyzerReport_{0}_{1}_{2}-{3}-{4}.pdf", txtCustomerName.Text, txtSiteName.Text, currentDate.Year, currentDate.Month, currentDate.Day); svdReport.FileName = outputFileName; if (svdReport.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } AnalyzerLogFileCache logFileCache = new AnalyzerLogFileCache(txtLogsDirectory.Text, true); List <string> searchVoiceCommandText = new List <string>(); List <string> originatingVoiceCommandTextWords = new List <string>(); List <string> secondOriginatingVoiceCommandTextWords = new List <string>(); foreach (string s in lstSearchVoiceCommandText.Items) { searchVoiceCommandText.Add(s); } foreach (string s in lstOriginatingVoiceCommandTextWords.Items) { originatingVoiceCommandTextWords.Add(s); } foreach (string s in lstSecondOriginatingVoiceCommandTextWords.Items) { lstSecondOriginatingVoiceCommandTextWords.Items.Add(s); } AnalyzerUserReport report = new AnalyzerUserReport(logFileCache, searchVoiceCommandText, originatingVoiceCommandTextWords, secondOriginatingVoiceCommandTextWords); UserReportPdf pdf = new UserReportPdf( report, "Dialog Analyzer Report", _logoFilePath, _waterMarkLogoFilePath, txtCustomerName.Text, txtSiteName.Text, txtProjectOwner.Text, txtReportGeneratedBy.Text, true, true, true, true); pdf.SaveToFile(svdReport.FileName); Process p = new Process(); p.StartInfo = new ProcessStartInfo(svdReport.FileName); }
static void Main(string[] args) { try { UserDictionary.Instance.LoadFromFile(null); User user = UserDictionary.Instance[620]; if (args.Length == 1 && args[0].Trim().ToLower() == "/console") { AnalyzerLogFileCache logFileCache = new AnalyzerLogFileCache(@"C:\Docs\Datasmith\DatasmithDotNet\DigisticsWarehousing\Digistics.Mobile\code\Digistics.Speech\AnalyzerLogs", true); //foreach (AnalyzerLogFile file in logFileCache) //{ // file.SearchVoiceCommandOccurences(new List<string>() { "Incorrect check digits." }, false); //} AnalyzerUserReport report = new AnalyzerUserReport( logFileCache, new List <string>() { "Incorrect check digits." }, new List <string>() { "Go to", "bin" }, null); //AnalyzerUserReport report = new AnalyzerUserReport( // logFileCache, // new List<string>() { "Batch too short to check." }, // new List<string>() { "Batch code?" }); //AnalyzerUserReport report = new AnalyzerUserReport( // logFileCache, // new List<string>() { "Invalid Batch" }, // new List<string>() { "Batch code?" }, // new List<string>() { "Go to", "bin" }); //AnalyzerUserReport report = new AnalyzerUserReport( // logFileCache, // new List<string>() { "Invalid Batch", "Batch too short to check." }, // new List<string>() { "Batch code?" }); string customerName = "Digistics"; string siteName = "KFC Pretoria"; string projectOwner = "Ken Scott"; string reportGeneratedBy = "Paul Kolozsvari"; DateTime currentDate = DateTime.Now; string outputFileName = string.Format( "DatasmithSpeechAnalyzerReport_{0}_{1}_{2}-{3}-{4}.pdf", customerName, siteName, currentDate.Year, currentDate.Month, currentDate.Day); string outputFilePath = Path.Combine(@"C:\Docs\Datasmith\DatasmithDotNet\TekSpeech.DialogAnalyzer\OutputReport", outputFileName); string logoFilePath = Path.Combine(Information.GetExecutingDirectory(), "TekSpeechPro_324x324.jpg"); string waterMarkLogoFilePath = Path.Combine(Information.GetExecutingDirectory(), "DatasmithLogo.png"); UserReportPdf pdf = new UserReportPdf( report, "Speech Analyzer Logs Report", logoFilePath, waterMarkLogoFilePath, customerName, siteName, projectOwner, reportGeneratedBy, true, true, true, true); pdf.SaveToFile(outputFilePath); } else { Application.ThreadException += Application_ThreadException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); _mainForm = new MainForm(); Application.Run(_mainForm); } //Console.ReadLine(); } catch (Exception ex) { ExceptionHandler.HandleException(ex); throw; } }