WndReport(RESULT_VEHICLE_INFO vehicleInfo) { InitializeComponent(); this.WindowState = FormWindowState.Maximized; this.FormClosing += WndReport_FormClosing; if (vehicleInfo.JYXM.Contains("X")) { if (vehicleInfo.RLLBDH == "A" || vehicleInfo.RLLBDH == "E") { m_Report = new GasolineReport(vehicleInfo.JCLSH); m_Report.ResetReportData(); crystalReportViewer1.ReportSource = m_Report.ReportInstance(); } else if (vehicleInfo.RLLBDH == "B") { m_Report = new DieselReport(vehicleInfo.JCLSH); m_Report.ResetReportData(); crystalReportViewer1.ReportSource = m_Report.ReportInstance(); } } else { m_Report = new ObdReport(vehicleInfo.JCLSH); m_Report.ResetReportData(); crystalReportViewer1.ReportSource = m_Report.ReportInstance(); } }
WndReport_FormClosing(object sender, FormClosingEventArgs e) { if (m_Report != null) { m_Report.DocumentDestructor(); m_Report = null; } }