public ViewerForm(Form1 MainForm, Backend.Event UserEvent) { InitializeComponent(); this.MainForm = MainForm; this.UserEvent = UserEvent; }
public void CreateEvent(Backend.Event tempEvent) { // give the current user the built event from the event form tempEvent.StartTime = tempEvent.StartDate; CurrentUser.Events.Add(tempEvent); CurrentUser.Events = CurrentUser.Events.OrderBy(d => d.StartDate).ToList(); // update the UI with this event item UpdateInterface(); }
// pass in an event, and try to remove it from the currently selected user public void DeleteEvent(Backend.Event UserEvent) { int index = CurrentUser.Events.IndexOf(UserEvent); // exit if it was not found if (index == -1) { return; } // remove the event and update interface CurrentUser.Events.RemoveAt(index); UpdateInterface(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveButton_Click(object sender, EventArgs e) { Backend.Event temp = new Backend.Event( SubjectTextBox.Text, AllDayCheckBox.Checked, StartDateTimePicker.Value.Date, DateTime.Parse(StartTimeComboBox.SelectedItem.ToString()), FinishDateTimePicker.Value.Date, DateTime.Parse(FinishTimeComboBox.SelectedItem.ToString()), RepeatCheckBox.Checked, RepeatOccurrencesComboBox.Text, LocationTextBox.Text, PriorityComboBox.Text, DescriptionTextBox.Text); MainForm.CreateEvent(temp); Close(); }