private void buttonScheduleAdd_Click(object sender, EventArgs e) { SchedulerSettingForm schedulerSettingForm = new SchedulerSettingForm(); while (schedulerSettingForm.ShowDialog() == DialogResult.OK) { if (!this.listViewSchedule.Items.ContainsKey(schedulerSettingForm.ScheduleName)) { RCProcessScheduler schedule = new RCProcessScheduler(schedulerSettingForm.ScheduleName, schedulerSettingForm.ScheduleType, schedulerSettingForm.ScheduleTime, schedulerSettingForm.ExeType, schedulerSettingForm.Command, true); this.AddProcessSchedule(schedule); return; } Utility.ShowErrorMessage(LocalizeText.Get(451)); } }
private void listViewSchedule_DoubleClick(object sender, EventArgs e) { if (!this._editable) { return; } if (this.listViewSchedule.SelectedItems.Count > 0) { ListViewItem listViewItem = this.listViewSchedule.SelectedItems[0]; RCProcessScheduler rcprocessScheduler = listViewItem.Tag as RCProcessScheduler; SchedulerSettingForm schedulerSettingForm = new SchedulerSettingForm(rcprocessScheduler.Name, rcprocessScheduler.ScheduleType, rcprocessScheduler.ScheduleTime, rcprocessScheduler.ExeType, rcprocessScheduler.Command, rcprocessScheduler.Enabled); if (schedulerSettingForm.ShowDialog() == DialogResult.OK) { RCProcessScheduler schedule = new RCProcessScheduler(rcprocessScheduler.Name, schedulerSettingForm.ScheduleType, schedulerSettingForm.ScheduleTime, schedulerSettingForm.ExeType, schedulerSettingForm.Command, schedulerSettingForm.ScheduleEnabled); this.ModifyProcessSchedule(schedule); } } }
private void ModifyProcessSchedule(RCProcessScheduler schedule) { ListViewItem listViewItem = this.listViewSchedule.Items[schedule.Name]; listViewItem.Tag = schedule; string text; if (schedule.ScheduleType == RCProcessScheduler.EScheduleType.Once) { text = string.Format("{0}({1} {2})", SchedulerSettingForm.GetScheduleTypeStr(schedule.ScheduleType), schedule.ScheduleTime.ToShortDateString(), schedule.ScheduleTime.ToShortTimeString()); } else { text = SchedulerSettingForm.GetScheduleTypeStr(schedule.ScheduleType); } listViewItem.SubItems[2].Text = text; listViewItem.SubItems[3].Text = schedule.Command; listViewItem.StateImageIndex = (schedule.Enabled ? 0 : 1); }
public SchedulerSettingForm() { this.InitializeComponent(); this.Text = LocalizeText.Get(435); this.groupBoxBasic.Text = LocalizeText.Get(436); this.labelName.Text = LocalizeText.Get(437); this.checkBoxDisabled.Text = LocalizeText.Get(452); this.groupBoxSchedule.Text = LocalizeText.Get(438); this.labelScheduleType.Text = LocalizeText.Get(439); this.labelScheduleTime.Text = LocalizeText.Get(440); this.groupBoxExe.Text = LocalizeText.Get(441); this.labelExeType.Text = LocalizeText.Get(442); this.buttonOK.Text = LocalizeText.Get(443); this.buttonCancel.Text = LocalizeText.Get(444); this.DateTimeScheduleTime.Value = DateTime.Now; for (int i = 0; i < 3; i++) { this.comboBoxScheduleType.Items.Add(""); } RCProcessScheduler.EScheduleType[] array = (RCProcessScheduler.EScheduleType[])Enum.GetValues(typeof(RCProcessScheduler.EScheduleType)); foreach (RCProcessScheduler.EScheduleType escheduleType in array) { if ((int)escheduleType < this.comboBoxScheduleType.Items.Count) { this.comboBoxScheduleType.Items[(int)escheduleType] = SchedulerSettingForm.GetScheduleTypeStr(escheduleType); } } this.comboBoxScheduleType.SelectedIndex = 0; for (int k = 0; k < 2; k++) { this.comboBoxExeType.Items.Add(""); } RCProcessScheduler.EExeType[] array3 = (RCProcessScheduler.EExeType[])Enum.GetValues(typeof(RCProcessScheduler.EExeType)); foreach (RCProcessScheduler.EExeType eexeType in array3) { if ((int)eexeType < this.comboBoxExeType.Items.Count) { this.comboBoxExeType.Items[(int)eexeType] = this.GetExeTypeStr(eexeType); } } this.comboBoxExeType.SelectedIndex = 0; }