private void btnEdit_Click(object sender, EventArgs e) { string selectedName = clbEventShow.SelectedItem.ToString().Split('\t')[0]; for (int i = 0; i < EvList.Count; i++) { if (EvList[i].EventName == selectedName) { EventPlanner.EDay = new EventOfDay(); EventPlanner.EDay.Date = dtpDate.Value; UtilityFunctions.listToForm(EvList[i]); EventEditor = new EventPlanner(dtpDate, true); EventEditor.ShowDialog(); if (EventEditor.IsSaved) { updateList(EvList[i]); } } } if (EventEditor.IsSaved) { flpStatus.Controls.RemoveAt(clbEventShow.SelectedIndex); clbEventShow.Items.Remove(clbEventShow.SelectedItem.ToString()); clbEventShow.Items.Add(UtilityFunctions.clbFormat(EventPlanner.EDay), CheckState.Unchecked); drawStatus(UtilityFunctions.loadStatus(EventPlanner.EDay)); disableButtons(); } }
private void btnAdd_Click(object sender, EventArgs e) { EventEditor = new EventPlanner(dtpDate, false); EventEditor.ShowDialog(); if (eventEditor.IsSaved) { EvList.Add(EventPlanner.EDay); clbEventShow.Items.Add(UtilityFunctions.clbFormat(EventPlanner.EDay), CheckState.Unchecked); drawStatus(UtilityFunctions.loadStatus(EventPlanner.EDay)); delAllbtn.Enabled = true; } }