示例#1
0
        private void btn_save_note_Click(object sender, RoutedEventArgs e)
        {
            ownNote.ChangeNote(txt_note.Text);
            DateTime selected_date = date_deadline.SelectedDate.Value;
            DateTime date_to_set;

            if (stack_date.IsEnabled == true)
            {
                int h = 0;
                int m = 0;
                if (combo_hours.SelectedIndex != -1)
                {
                    h = Convert.ToInt32(combo_hours.SelectedItem);
                }
                if (combo_minutes.SelectedIndex != -1)
                {
                    m = Convert.ToInt32(combo_minutes.SelectedItem);
                }
                date_to_set = new DateTime(selected_date.Year, selected_date.Month, selected_date.Day, h, m, 0);
                ownNote.ChangeDeadLine(date_to_set);
            }
            else
            {
                ownNote.SetNoDeadLine();
            }
            ownNote.SetDoNotify(check_do_notify.IsChecked.Value);
            ownNote.SetPinned(check_pinned_to_top.IsChecked.Value);

            this.Close();
        }
示例#2
0
        /// <summary>
        /// Parse note backup (XML) back to object
        /// </summary>
        private NoteStruct XmlToNote(XmlElement NoteElement)
        {
            string[]   deadline     = NoteElement.GetAttribute(atb_deadline).Split('-');
            string[]   lastmod      = NoteElement.GetAttribute(atb_lastmod).Split('-');
            string     has_deadline = NoteElement.GetAttribute(atb_hasdl);
            string     notify       = NoteElement.GetAttribute(atb_notify);
            string     pinned       = NoteElement.GetAttribute(atb_pinned);
            string     done         = NoteElement.GetAttribute(atb_done);
            bool       isPinned     = pinned != String.Empty ? bool.Parse(pinned) : false;
            bool       isDone       = done != String.Empty ? bool.Parse(done) : false;
            NoteStruct note         = new NoteStruct(NoteElement.GetAttribute(atb_note), new DateTime(int.Parse(deadline[0]), int.Parse(deadline[1]), int.Parse(deadline[2]), int.Parse(deadline[3]), int.Parse(deadline[4]), 0), int.Parse(NoteElement.GetAttribute(atb_noteid)), has_deadline == "1" ? true : false, isPinned, isDone);

            if (notify != String.Empty)
            {
                note.SetDoNotify(bool.Parse(notify));
            }
            note.SetLastModifiedDate(new DateTime(int.Parse(lastmod[0]), int.Parse(lastmod[1]), int.Parse(lastmod[2]), int.Parse(lastmod[3]), int.Parse(lastmod[4]), int.Parse(lastmod[5])));
            return(note);
        }