private void btnModify_Click(object sender, EventArgs e) { if (bndPlan.Current == null) { return; } PPlan plan = bndPlan.Current as PPlan; if (plan == null) { return; } PPlan originPlan = _planManager.Plans.Find(x => x.ReserveTime == plan.ReserveTime && x.PosX == plan.PosX && x.PosY == plan.PosY); if (originPlan == null) { return; } int index = _planManager.Plans.IndexOf(originPlan); PlanDialog Dlg = new PlanDialog(plan); if (Dlg.ShowDialog() == DialogResult.OK) { _planManager.Plans[index] = Dlg.Plan; RefreshBinding(); } }
private void btnDelete_Click(object sender, EventArgs e) { if (bndPlan.Current == null) { return; } PPlan plan = bndPlan.Current as PPlan; if (plan == null) { return; } _planManager.Plans.Remove(plan); RefreshBinding(); }
private void btnOK_Click(object sender, EventArgs e) { if (!CheckIntegrity()) { MessageBox.Show("잘못된 데이터가 입력되었습니다."); return; } PPlan newPlan = new PPlan() { ReserveTime = new DateTime(dtpDay.Value.Year, dtpDay.Value.Month, dtpDay.Value.Day, dtpTime.Value.Hour, dtpTime.Value.Minute, dtpTime.Value.Second), PosX = _posX, PosY = _posY, Interval = int.Parse(txtInterval.Text), Count = int.Parse(txtCount.Text), IgnoreDay = chkRepeat.Checked, Message = txtMessage.Text }; this.Plan = newPlan; this.DialogResult = DialogResult.OK; }
private void InitInstance(PPlan plan = null) { dtpDay.Value = dtpTime.Value = DateTime.Now; txtXPos.Text = txtYPos.Text = "0"; txtInterval.Text = "1000"; if (plan == null) { return; } dtpDay.Value = new DateTime(plan.ReserveTime.Year, plan.ReserveTime.Month, plan.ReserveTime.Day, plan.ReserveTime.Hour, plan.ReserveTime.Minute, plan.ReserveTime.Second); dtpTime.Value = new DateTime(plan.ReserveTime.Year, plan.ReserveTime.Month, plan.ReserveTime.Day, plan.ReserveTime.Hour, plan.ReserveTime.Minute, plan.ReserveTime.Second); _posX = plan.PosX; _posY = plan.PosY; txtXPos.Text = _posX.ToString(); txtYPos.Text = _posY.ToString(); txtInterval.Text = plan.Interval.ToString(); txtCount.Text = plan.Count.ToString(); chkRepeat.Checked = plan.IgnoreDay; txtMessage.Text = plan.Message; btnOK.Text = "수정"; }
public PlanDialog(PPlan plan = null) { InitializeComponent(); InitInstance(plan); }