Exemplo n.º 1
0
        private void InitReminders()
        {
            remindersToShow = false;

            // Create a new reminder collection and start the clock
            reminders = new ReminderCollection();
            reminders.RegisterObserver(this);
            reminders.Start();

            // Copy reminders from diary collection to reminder manager
            foreach (DiaryEntry entry in diaryEntryCollection)
            {
                reminders.AddReminder(entry.Reminder);
                entry.Reminder.Entry = entry;
            }
        }
Exemplo n.º 2
0
        private void InitReminders()
        {
            remindersToShow = false;

            // Create a new reminder collection and start the clock
            reminders = new ReminderCollection();
            reminders.RegisterObserver(this);
            reminders.Start();

            // Copy reminders from diary collection to reminder manager
            foreach (DiaryEntry entry in diaryEntryCollection)
            {
                reminders.AddReminder(entry.Reminder);
                entry.Reminder.Entry = entry;
            }
        }
Exemplo n.º 3
0
        private void button_acceptEntry_Click(object sender, RoutedEventArgs e)
        {
            newEntry.Text = diaryEntryCanvas.Text;

            if (c_abs.IsChecked == true)
            {
                newEntry.Abs = true;
            }
            if (c_mus.IsChecked == true)
            {
                newEntry.Mus = true;
            }
            if (c_not.IsChecked == true)
            {
                newEntry.Not = true;
            }
            if (c_tag.IsChecked == true)
            {
                newEntry.Tag = true;
            }

            log.Write("Abs is checked: " + newEntry.Abs);
            log.Write("Mus is checked: " + newEntry.Mus);
            log.Write("not is checked: " + newEntry.Not);
            log.Write("tag is checked: " + newEntry.Tag);

            if (newEntry == null || newEntry.Text.Length == 0)
            {
                //Console.WriteLine("New entry was null or 0");
                //Console.WriteLine("I think its because text length is too small:" + newEntry.Text.Length.ToString());
                return;
            }

            #region Create reminder for entry
            // Create a new reminder for the chosen time and date
            //TimeSpan time = GetTimeForTimeOfDay(newEntry.Time);

            TimeSpan time = getTimeForSelection(newEntry.Time);

            // Take the day, month and year from the existing reminder. Calculate time based on the TimeOfDay.
            DateTime date = new DateTime(newEntry.Date.Year, newEntry.Date.Month, newEntry.Date.Day, time.Hours, time.Minutes, time.Seconds);

            Console.WriteLine("Date and time of reminder: {0} at {1}", date.ToLongDateString(), date.ToShortTimeString());

            // See if the reminder has already occurred, i.e. someone added something to the past
            bool reminderInPast = date.Ticks < DateTime.Now.Ticks;

            // Unregister any old reminders for this entry first

            reminders.RemoveReminder(newEntry.Reminder);

            // Assign a high priority if annotations are used

            ReminderPriority priority = (newEntry.Underline || newEntry.Circle || newEntry.Asterisk || priorityCheck.IsChecked == true) ? ReminderPriority.High : ReminderPriority.Low;

            // Then register a new one
            Boolean music = newEntry.Mus;
            log.Write("Abs is checked: " + newEntry.Abs);
            log.Write("Mus is checked: " + newEntry.Mus);
            log.Write("not is checked: " + newEntry.Not);
            log.Write("tag is checked: " + newEntry.Tag);
            log.Write("MuSIC: " + music.ToString());

            Reminder reminder = new Reminder(newEntry.Text, date, reminderInPast, reminderInPast, priority, newEntry, newEntry.Abs, music, newEntry.Tag, newEntry.Not);
            newEntry.Reminder = reminder;
            log.Write("New Entry is : " + newEntry.Reminder.ToString());
            log.Write("New Entry Mus is : " + newEntry.Reminder.Mus.ToString());
            reminders.AddReminder(reminder);

            #endregion

            // Save newEntry

            log.Write("Have just added a new entry?? " + DateTime.Now.ToString());
            log.Write("Priority was " + priority.ToString());
            diaryEntryCollection.AddEntry(newEntry);

            // Update diary UI

            UpdateDiaryUI();

            // Clear canvas and switch tab
            //ResetAnnotationButtons();
            diaryEntryCanvas.Clear();
            TabDiary.IsSelected = true;

            log.Write("Accepted new diary entry");
        }