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 btnAdd_Click(object sender, EventArgs e) { PlanDialog Dlg = new PlanDialog(); if (Dlg.ShowDialog() == DialogResult.OK) { _planManager.Plans.Add(Dlg.Plan); RefreshBinding(); } }