/// <summary> /// Executes output actions specified in Analysis output. /// </summary> /// <param name="results"></param> private void PostProcess(Epi.CommandProcessorResults results) { if (results != null) { foreach (Action actionId in results.Actions) { switch (actionId) { case Action.Beep: Helpers.MessageBeep(0x0); break; case Action.Quit: OnExit(); break; case Action.GridTable: case Action.Update: DataGridForm gridForm = new DataGridForm(this); dockManager1.DockWindow(gridForm, DockStyle.Fill); gridForm.SendToOutput(results, actionId); gridForm.TopMost = true; gridForm.ReadOnly = (actionId == Action.GridTable); break; case Action.SimpleDialog: { UserDialog dlg = new UserDialog(this, results.XmlOutput); /*void*/ dlg.ShowDialog(this); } break; case Action.UserDialog: { using (UserDialog dlg = new UserDialog(this, results.XmlOutput)) { if (dlg.ShowDialog(this) != DialogResult.Cancel) { ExecAssign(results.XmlOutput.DocumentElement); } } } break; case Action.FileOpenDialog: case Action.DatabasesDialog: { FileDialog dlg = new OpenFileDialog(); dlg.Title = results.XmlOutput.DocumentElement.GetAttribute("Title"); dlg.Filter = "All files (*.*)|*.*"; if (actionId == Action.DatabasesDialog) { dlg.Filter = "Access Databases (*.mdb)|*.mdb|" + dlg.Filter; } if (dlg.ShowDialog(this) == DialogResult.OK) { results.XmlOutput.DocumentElement.SetAttribute("VarValue", dlg.FileName); ExecAssign(results.XmlOutput.DocumentElement); } dlg.Dispose(); } break; case Action.FileSaveDialog: { FileDialog dlg = new SaveFileDialog(); dlg.Title = results.XmlOutput.DocumentElement.GetAttribute("Title"); dlg.ShowDialog(this); if (dlg.ShowDialog(this) == DialogResult.OK) { results.XmlOutput.DocumentElement.SetAttribute("VarValue", dlg.FileName); ExecAssign(results.XmlOutput.DocumentElement); } dlg.Dispose(); } break; case Action.OutTable: { try { if (results.XmlOutput == null) { IProjectHost host = Module.GetService(typeof(IProjectHost)) as IProjectHost; Project currentProject = host.CurrentProject; DataTable outTable = results.DsOutput.Tables["OutTable"]; if (outTable != null) { if (currentProject.CollectedData.TableExists(results.OutTableName)) { currentProject.CollectedData.DeleteTable(results.OutTableName); } currentProject.CollectedData.CreateTable(results.OutTableName, outTable); } } } catch (NotImplementedException ex) { Epi.Windows.MsgBox.ShowError(ex.Message); } } break; case Action.Print: outputWindow.Printout(); break; default: break; } } } }