private void BtnPublish_Click(object sender, EventArgs e) { FileGenerator file = SaveFileSetting(); if (file == null) { return; } CustomerSetting setting = new CustomerSetting(); setting.CustomerSysNo = SessionContext.CustomerInfo.SysNo; setting.Setting = XmlSerializerHelper.Serializer<FileGenerator>(file); Task task = new Task(); task.Setting = setting; task.CustomerSysNo = SessionContext.CustomerInfo.SysNo; task.RunTimes = 10; task.BeginDate = DateTime.Now; task.Costs = 100; TaskService taskService = ServiceManager.CreateTaskService(); string result = taskService.CreateTask(task); if (string.IsNullOrEmpty(result)) { MessageHelper.ShowMeesageBox("发布成功!"); } else { MessageHelper.ShowMeesageBox(result); } }
private bool Run(Task task) { try { manager.LoadConfig(task.Setting.Setting); manager.Run(); return true; } catch(Exception ex) { MessageBox.Show(ex.Message); return false; } }
public string CreateTask(Task task) { object[] results = this.Invoke("CreateTask", new object[] { task}); return ((string)(results[0])); }