Esempio n. 1
0
 public Reminder(string description, DateTime time, bool delivered, bool done, ReminderPriority priority, DiaryEntry entry, bool abs, bool mus, bool tag, bool not)
 {
     Description   = description;
     Time          = time;
     Delivered     = delivered;
     Done          = done;
     this.priority = priority;
     this.entry    = entry;
     Abs           = abs;
     Not           = not;
     Tag           = tag;
     Mus           = mus;
 }
Esempio n. 2
0
    public Reminder(string description, DateTime time, bool delivered, bool done, ReminderPriority priority, DiaryEntry entry, bool abs, bool mus, bool tag, bool not)
    {
        Description = description;
        Time = time;
        Delivered = delivered;
        Done = done;
        this.priority = priority;
        this.entry = entry;
        Abs = abs;
        Not = not;
        Tag = tag;
        Mus = mus;

        
    }
Esempio 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");
        }