private void save(string path, bool Compile = false) { //report.loadFields ( this.tbxFields.Text ); //report.loadTables ( this.tbxTables.Text ); report = AReport.LoadTemplate(this.textEditor.Text); report.saveTemplate(path); if (Compile) { if (report.Script != null) { if (report.Script is CSharpScripting) { CompilerResults cr; CSharpScripting.CompileCode(report.Script.Code, path + "\\" + report.Name + "\\" + report.Name + ".dll", out cr); if (cr.Errors.Count > 0) { foreach (CompilerError err in cr.Errors) { MessageBox.Show(err.ErrorText); } } } } } }
private void textEditor_LostFocus(object sender, RoutedEventArgs e) { try { byte[] temp = report.GetTemplate(); report = AReport.LoadTemplate(this.textEditor.Text); report.SetTemplate(temp); loadReport( ); } catch (Exception ex) { MessageBox.Show(string.Format("Failed to generate report. \n {0}", ex.Message)); } }
/// <summary> /// (Re-)loads templates from the database /// </summary> public void loadTemplatesFromDatabase( ) { _templates.Clear( ); foreach (Template t in FileIO.FConnFile.GetFileDetails().IO.GetAll <Template>()) { AReport report = AReport.LoadTemplate(t.Instructions, t.TemplateFile); if (report != null) { _templates.Add(report); } } }
private void editTemplate() { ReportEditor re = new ReportEditor(); re.LoadReportFromApplication(AReport.LoadTemplate(this.Template.Instructions, this.Template.TemplateFile)); re.ShowDialog( ); //this.Template.Instructions = re.report.rawXML; //ReportLibrary.addTemplatesToDB ( re.report ); if (re.DialogResult == true) { this.Template.Instructions = re.report.rawXML; this.Template.TemplateFile = re.report.GetTemplate(); Name = re.report.Name; } saveTemplate( ); }