using DevExpress.Utils.About; using DevExpress.XtraEditors; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using XdCxRhDW.App.Model; namespace XdCxRhDW.App.EditForms { public partial class TaskEditor : DevExpress.XtraEditors.XtraForm { public TaskInfo info; public TaskEditor() { InitializeComponent(); this.Text = "添加任务"; info = new TaskInfo(); this.StartPosition = FormStartPosition.CenterParent; } public TaskEditor(TaskInfo info) : this() { this.Text = "编辑任务"; this.info = info; } private void TaskEditor_Load(object sender, EventArgs e) { if (this.Text == "编辑任务" && info != null) { this.txtTaskName.Text = info.TaskName; this.txtPosType.SelectedIndex = (int)info.PosType; } } private void btnSave_Click(object sender, EventArgs e) { try { info.TaskState = EnumTaskState.Stopped; info.TaskName = txtTaskName.Text; info.PosType = (EnumPosType)txtPosType.SelectedIndex; this.DialogResult = DialogResult.OK; } catch (Exception ex) { Serilog.Log.Error(ex, "编辑任务信息出错"); DxHelper.MsgBoxHelper.ShowError("编辑任务信息出错"); } } } }