Exemplo n.º 1
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtTaskName.Text == string.Empty)
                {
                    txtTaskName.Select();
                    MessageBox.Show("任务名称不能为空!", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                this.Cursor = Cursors.WaitCursor;

                _task.TaskName = txtTaskName.Text;

                string ret = ConfigCtrl.EditTask(_task);
                if (ret != Constants.STATUS_SUCCESS)
                {
                    MessageBox.Show(ret, Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                ErrorHandler.ShowMessageBox(TaskConstants.EXCEPTION_MODULE, ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 2
0
        private void TaskTree_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            try
            {
                if (e.Label != null && e.Label.Trim() != string.Empty)
                {
                    _task.TaskName = e.Label;

                    ConfigCtrl.EditTask(_task);

                    TaskEventArgs ta = new TaskEventArgs();
                    ta.Task = _task;
                    OnTaskNameChanged(ta);
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.ShowMessageBox(TaskConstants.EXCEPTION_MODULE, ex);
            }
        }