Ejemplo n.º 1
0
        private void SetReminders()
        {
            List <string> reminders = Reminders.GetTxtReminders();

            foreach (string item in reminders)
            {
                RemindersBox.Items.Add(item);
            }
        }
Ejemplo n.º 2
0
        public string CalendarEntryToFileLine()
        {
            string startDateTxt = StartDate.ToString("dd-MM-yyyy");
            string startTimeTxt = StartDate.ToString("HH:mm");
            string endDateTxt   = EndDate.ToString("dd-MM-yyyy");
            string endTimeTxt   = EndDate.ToString("HH:mm");
            string reminderTxt  = Reminders.GetTxtReminder(Reminder);
            string fileLine     = Title + "%" + startDateTxt + " " + startTimeTxt + "%" + endDateTxt + " " + endTimeTxt + "%" + reminderTxt;

            return(fileLine);
        }
Ejemplo n.º 3
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();
            }
        }
Ejemplo n.º 4
0
        private void EventsForToday_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = EventsForToday.SelectedIndex;

            if (index < 0)
            {
                return;
            }

            CalendarEntry entry = calendar.GetDataAt(index);

            TitleBox.Text     = entry.Title;
            StartDate.Value   = entry.StartDate.Date;
            StartTime.Text    = entry.StartDate.ToString("HH:mm");
            EndDate.Value     = entry.EndDate.Date;
            EndTime.Text      = entry.EndDate.ToString("HH:mm");
            RemindersBox.Text = Reminders.GetTxtReminder(entry.Reminder);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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();
            }
        }
Ejemplo n.º 7
0
        private void DoRemind()
        {
            DateTime      nowTmp = DateTime.Now;
            DateTime      now    = new DateTime(nowTmp.Year, nowTmp.Month, nowTmp.Day, nowTmp.Hour, nowTmp.Minute, 0);
            StringBuilder sb     = new StringBuilder();

            foreach (CalendarEntry item in calendar)
            {
                bool isNotDefault = !(default(TimeSpan) == item.Reminder);
                if (isNotDefault && !item.Reminded && item.StartDate.Subtract(item.Reminder) == now)
                {
                    sb.AppendLine(string.Format("In {0} - {1}", Reminders.GetTxtReminder(item.Reminder), item.Title));
                    item.Reminded = true;
                }
            }
            if (sb.Length != 0)
            {
                MessageBox.Show(sb.ToString(), "Reminder");
            }
        }