private void AddSchedule(string key, DateTime datetime, string name, string command) { int num = 1; string text = name; while (this.schedulesByTime[key].ContainsKey(text) || this.schedulesOther[key].ContainsKey(text)) { text = string.Format("{0} {1}", name, num++); } datetime = datetime.AddSeconds((double)(-(double)datetime.Second)); RCProcessScheduler rcprocessScheduler = new RCProcessScheduler(text, RCProcessScheduler.EScheduleType.Once, datetime, RCProcessScheduler.EExeType.StdInput, command, true); int height = this.panelSchdule.Size.Height; ServerCommandSchedule serverCommandSchedule = new ServerCommandSchedule(key, rcprocessScheduler); serverCommandSchedule.OnDelete += this.OnDelete; serverCommandSchedule.Size = new Size(this.panelSchdule.Width - 2, 40); serverCommandSchedule.Location = new Point(2, this.allScheduleCount * 40); this.panelSchdule.Controls.Add(serverCommandSchedule); serverCommandSchedule.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right); int height2 = this.panelSchdule.Size.Height; AnchorStyles anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; AnchorStyles anchor2 = this.panelMid.Anchor; AnchorStyles anchor3 = this.panelBottom.Anchor; this.panelMid.Anchor = anchor; this.panelBottom.Anchor = anchor; base.Size = new Size(base.Size.Width, base.Size.Height + height2 - height); this.panelMid.Anchor = anchor2; this.panelBottom.Anchor = anchor3; this.schedulesByTime[key].Add(text, rcprocessScheduler); this.allScheduleCount++; }
private void AddProcessSchedule(RCProcessScheduler schedule) { ListViewItem listViewItem = this.listViewSchedule.Items.Add(schedule.Name, "", 0); listViewItem.SubItems.Add(schedule.Name); listViewItem.SubItems.Add(""); listViewItem.SubItems.Add(""); this.ModifyProcessSchedule(schedule); }
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 ServerCommandSchedule(string key, RCProcessScheduler schedule) { this.InitializeComponent(); this.Key = key; this.Schedule = schedule; }