Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            if (IsInDesignMode)
            {
                // Code runs in Blend --> create design time data.
                _currentNoteBook = new NoteBookViewModel();
                _currentNoteBook.Notes.Add(new NoteViewModel {
                    Note = { Title = "笔记1", Content = "内容1" }
                });
                _currentNoteBook.Notes.Add(new NoteViewModel {
                    Note = { Title = "笔记2", Content = "内容2" }
                });
            }
            else
            {
            }
            Title = "笔记本";

            var noteBook = new NoteBookViewModel {
                Name = "笔记本1"
            };

            noteBook.Notes.Add(new NoteViewModel {
                Note = new Model.Note {
                    Title = "笔记1", Content = "内容1"
                }
            });
            noteBook.Notes.Add(new NoteViewModel {
                Note = new Model.Note {
                    Title = "笔记2", Content = "内容2"
                }
            });
            NoteBooks.Add(noteBook);
        }
Exemplo n.º 2
0
        private void GetNoteBooks()
        {
            var noteBooks = DataBaseHelper.Read <Notebook>();

            NoteBooks.Clear();
            foreach (var n in noteBooks)
            {
                NoteBooks.Add(n);
            }
        }
Exemplo n.º 3
0
        private void GetNotebooks()
        {
            var notebooks = DatabaseHelper.Read <Notebook>();

            NoteBooks.Clear();
            foreach (var notebook in notebooks)
            {
                // add each notebook to the observable collection
                NoteBooks.Add(notebook);
            }
        }