public override void Execute(object parameter) { if (parameter == null) throw new ArgumentNullException("parameter"); FileTemplateResult result = (FileTemplateResult)parameter; var openedFile = result.NewOpenedFiles.Single(); var wizardViewModel = new ReportWizardContext(); var reportWizard = new ICSharpCode.Reporting.Addin.ReportWizard.Dialog.ReportWizard(wizardViewModel); reportWizard.ShowDialog(); if (reportWizard.DialogResult.HasValue && reportWizard.DialogResult.Value){ LoggingService.Info("ReportWizard - CreateReport"); var rg = new ReportGenerator(); rg.Generate(wizardViewModel); string xml = CreateFormSheetFromModel.ToXml(rg.ReportModel).ToString(); openedFile.SetData(Encoding.UTF8.GetBytes(xml)); if (!openedFile.IsUntitled) openedFile.SaveToDisk(); } else { LoggingService.Info("ReportWizard canceled"); // HACK: cancel opening the file by clearing the file list openedFile.CloseIfAllViewsClosed(); result.NewOpenedFiles.Clear(); result.NewFiles.Clear(); } }
public override void Run() { var wizardViewModel = new ReportWizardContext(); var reportWizard = new ICSharpCode.Reporting.Addin.ReportWizard.Dialog.ReportWizard(wizardViewModel); reportWizard.ShowDialog(); if (reportWizard.DialogResult.HasValue && reportWizard.DialogResult.Value){ LoggingService.Info("ReportWizard - CreateReport"); var rg = new ReportGenerator(); rg.Generate(wizardViewModel); ReportModel = rg.ReportModel; } else { Canceled = true; } }
public override void Run() { var wizardViewModel = new ReportWizardContext(); var reportWizard = new ICSharpCode.Reporting.Addin.ReportWizard.Dialog.ReportWizard(wizardViewModel); reportWizard.ShowDialog(); if (reportWizard.DialogResult.HasValue && reportWizard.DialogResult.Value) { LoggingService.Info("ReportWizard - CreateReport"); var rg = new ReportGenerator(); rg.Generate(wizardViewModel); ReportModel = rg.ReportModel; } else { Canceled = true; } }