示例#1
0
        private void Create_Click(object sender, EventArgs e)
        {
            DateTime startDateTime = Calendar.GetSelectedDateTime(StartDate.Value, StartTime.Value);
            DateTime endDateTime   = Calendar.GetSelectedDateTime(EndDate.Value, EndTime.Value);
            TimeSpan reminder      = Reminders.GetReminder(RemindersBox.Text);

            if (Validate(-1, startDateTime, endDateTime))
            {
                calendar.CreateNewRecord(TitleBox.Text, startDateTime, endDateTime, reminder);
                ShowValidEvents();
            }
        }
示例#2
0
        private CalendarEntry DecodeLine(string txt)
        {
            CalendarEntry entry = null;

            string[] splitted = txt.Split('%');
            string   pattern  = "dd-MM-yyyy HH:mm";
            DateTime startDateTime;
            DateTime endDateTime;
            TimeSpan reminder;

            if ((DateTime.TryParseExact(splitted[1], pattern, null, DateTimeStyles.None, out startDateTime)) && (DateTime.TryParseExact(splitted[2], pattern, null, DateTimeStyles.None, out endDateTime)))
            {
                string title = splitted[0];
                reminder = Reminders.GetReminder(splitted[3]);
                entry    = new CalendarEntry(title, startDateTime, endDateTime, reminder);
            }
            return(entry);
        }
示例#3
0
        private void Modify_Click(object sender, EventArgs e)
        {
            int index = EventsForToday.SelectedIndex;

            if (index < 0)
            {
                return;
            }

            DateTime startDateTime = Calendar.GetSelectedDateTime(StartDate.Value, StartTime.Value);
            DateTime endDateTime   = Calendar.GetSelectedDateTime(EndDate.Value, EndTime.Value);
            TimeSpan reminder      = Reminders.GetReminder(RemindersBox.Text);

            if (Validate(index, startDateTime, endDateTime))
            {
                calendar.ModifyRecordAt(index, TitleBox.Text, startDateTime, endDateTime, reminder);
                ShowValidEvents();
            }
        }