public JobCommandEditorFrame(JobConnection jobconn, JobCommand command) { InitializeComponent(); m_jobconn = jobconn; m_command = command; propertyFrame1.SelectedObject = m_command; }
public JobReportProcessorBase(JobReportConfigurationBase config, JobCommand command) { Config = config; Command = command; FilePlace = FilePlaceAddonType.PlaceFromVirtualFile(config.FilePlace.GetVirtualFile()); FilePlace.SetFileHolderInfo(Config); }
public void LoadCommand(string file, JobCommand cmd) { m_jobconn = new JobConnection(file); m_cmd = m_jobconn.GetCommand(cmd.GroupId); RefreshFactories(); RefreshConfigs(); }
private void EditCommand(Dictionary <string, string> args) { Job job = Job.LoadFromFile(args["job"]); JobConnection jobconn = new JobConnection(args["job"]); JobCommand cmd = job.Root.FindCommand(args["cmd"]); cmd.Edit(jobconn); }
public RunOrSaveJobForm(JobCommand command, Func <JobCommand, bool> checkConfig, string label) { InitializeComponent(); m_command = command; label1.Text = Texts.Get(label); m_checkConfig = checkConfig; propertyFrame1.SelectedObject = m_command; }
public JobCommandTreeNode(PolyCommandTreeNode parent, JobConnection jobconn, JobCommand command) : base(parent, command.GroupId) { m_command = command; m_jobconn = jobconn; SetAppObject(new JobCommandAppObject { JobFile = jobconn.FileName, CommandGroupId = command.GroupId }); }
public void AddCommand(JobCommand command) { m_rootCommand.m_commands.Add(command); command.m_job = this; if (m_title == null) { m_title = command.ToString(); } }
private void RunCommand(Dictionary <string, string> args) { Job fulljob = Job.LoadFromFile(args["job"]); JobCommand cmd = fulljob.Root.FindCommand(args["cmd"]); Job job = Job.FromCommand(cmd, new JobProperties()); if (MessageBox.Show(Texts.Get("s_really_run$job", "job", job), VersionInfo.ProgramTitle, MessageBoxButtons.YesNo) == DialogResult.Yes) { job.StartProcess(); } }
public static ITreeNode GetCommandTreeNode(PolyCommandTreeNode parent, JobCommand command, JobConnection jobconn) { if (command is JobPolyCommand) { return(new PolyCommandTreeNode(parent, jobconn, (JobPolyCommand)command)); } else { return(new JobCommandTreeNode(parent, jobconn, command)); } }
public static bool Run(string file, JobCommand cmd) { var win = new JobReportForm(); win.jobReportFrame1.LoadCommand(file, cmd); if (win.ShowDialogEx() == DialogResult.OK) { win.jobReportFrame1.Save(); return(true); } return(false); }
public static Job FromCommand(JobCommand command, JobProperties jobProps) { Job res = new Job(); res.m_jobProps = jobProps; res.AddCommand(command); using (var ub = new UsageBuilder("create_job:" + command.GetType().FullName)) { command.GetUsageParams(ub); } return(res); }
public virtual JobCommand Clone(bool newGroupId) { JobCommand res = (JobCommand)this.GetType().GetConstructor(new Type[] { }).Invoke(new object[] { }); XmlDocument doc = XmlTool.CreateDocument("Command"); SaveToXml(doc.DocumentElement); res.LoadFromXml(doc.DocumentElement); if (newGroupId) { res.GroupId = Guid.NewGuid().ToString(); } return(res); }
public void SaveReports(JobCommand cmd) { m_job = null; Reload(); var cmd2 = m_job.Root.FindCommand(cmd.GroupId); cmd2.ReportConfigs.Clear(); foreach (var rep in cmd.ReportConfigs) { cmd2.ReportConfigs.Add(rep.Clone()); } SaveToFile(); }
private void RenderCommand(HtmlGenerator hg, string jobfn, JobCommand cmd) { if (cmd is JobPolyCommand) { RenderPolyCommandItems(hg, jobfn, (JobPolyCommand)cmd); } else { hg.Write(cmd.ToString()); hg.Write(" - "); hg.Write("<a href=\"callback://runcmd?job:{1}&cmd:{2}\">{0}</a>", Texts.Get("s_run"), HttpUtility.UrlEncode(jobfn), HttpUtility.UrlEncode(cmd.GroupId)); hg.Write(" | <a href=\"callback://editcmd?job:{1}&cmd:{2}\">{0}</a>", Texts.Get("s_edit"), HttpUtility.UrlEncode(jobfn), HttpUtility.UrlEncode(cmd.GroupId)); } }
public void ReplaceCommand(JobCommand command) { for (int i = 0; i < m_commands.Count; i++) { if (m_commands[i].GroupId == command.GroupId) { m_commands[i] = command; return; } var p = m_commands[i] as JobPolyCommand; if (p != null) { p.ReplaceCommand(command); } } }
public override bool Save() { if (m_cmd != null) { m_jobconn.SaveReports(m_cmd); m_cmd = m_jobconn.GetCommand(m_cmd.GroupId); } else { m_jobconn.SaveReports(m_job); m_job = m_jobconn.GetJob(); } RefreshFactories(); RefreshConfigs(); return(true); }
public override void LoadFromXml(XmlElement xml) { base.LoadFromXml(xml); foreach (XmlElement child in xml.SelectNodes("Command")) { try { JobCommand cmd = (JobCommand)JobCommandAddonType.Instance.LoadAddon(child); cmd.m_job = m_job; m_commands.Add(cmd); } catch (Exception err) { var cmd = new JobErrorCommand { Message = err.Message }; cmd.m_job = m_job; m_commands.Add(cmd); Errors.LogError(err); } } }
public void Edit() { m_jobconn.Reload(); m_command = m_jobconn.GetCommand(m_command.GroupId); m_command.Edit(m_jobconn); }
public abstract IJobReportProcessor CreateProcessor(JobCommand cmd);
public override IJobReportProcessor CreateProcessor(JobCommand cmd) { return(new JobLogProcessor(this, cmd)); }
public JobLogProcessor(JobLogConfiguration config, JobCommand cmd) : base(config, cmd) { }
public static void Run(JobCommand command, Func <JobCommand, bool> checkConfig, string label) { var win = new RunOrSaveJobForm(command, checkConfig, label); win.ShowDialogEx(); }
protected JobReportEnvBase(JobCommand cmd) { m_cmd = cmd; }
public FormattedJobReportProcessorBase(FormattedJobReportConfigurationBase config, JobCommand command) : base(config, command) { }
public void SaveCommand(JobCommand command) { Reload(); m_job.Root.ReplaceCommand(command); SaveToFile(); }
public virtual void Run(IJobRunEnv env) { JobReportEnvBase repenv = null; if (m_job.Root != this) { repenv = CreateReportEnv(); } if (repenv != null) { try { env.SetReportEnv(GroupId, repenv); repenv.OnStart(); } catch (Exception err) { ProgressInfo.Warning("Error initializing reports:" + err.Message); } } try { using (var ub = new UsageBuilder(UsageEventName)) { GetUsageParams(ub); try { if (m_job.m_process != null) { JobCommand oldcmd = m_job.m_process.CurrentCommand; try { m_job.m_process.CurrentCommand = this; DoRun(env); } finally { m_job.m_process.CurrentCommand = oldcmd; // close connections ConnPack = null; } } else { try { DoRun(env); } finally { // close connections ConnPack = null; } } ub["result"] = "ok"; } catch (Exception err) { ub["result"] = "error"; ub["error"] = err.Message; throw; } } } finally { if (repenv != null) { try { repenv.OnFinish(); } catch (Exception err) { ProgressInfo.Warning("Error finishing reports:" + err.Message); } try { repenv.Dispose(); } catch (Exception err) { ProgressInfo.Warning("Error disposing reports:" + err.Message); } } } }