Esempio n. 1
0
        public void ConfirmNewNotebookName(string newNotebookName)
        {
            NewNotebookClicked = false;

            NotebookModel notebook = Notebooks.ToList <NotebookModel>().Find(n => n.Name == newNotebookName);

            if (notebook == null)
            {
                try
                {
                    DBDataAccessInsert.InsertNotebook(new NotebookModel()
                    {
                        UserId = User.Id,
                        Name   = newNotebookName
                    });

                    Notebooks.Clear();
                    Notebooks = new BindableCollection <NotebookModel>(DBDataAccessLoad.LoadNotebooks(User.Id));
                }
                catch (SQLiteException)
                {
                    MessageBox.Show("Invalid Name");
                }
            }
            else
            {
                MessageBox.Show("Notebook with this name already exists");
            }
        }
Esempio n. 2
0
        public void Handle(UserModel user)
        {
            User       = user;
            IsLoggedIn = true;

            Notebooks = new BindableCollection <NotebookModel>(DBDataAccessLoad.LoadNotebooks(user.Id));
            Notes     = new BindableCollection <NoteModel>();
        }
Esempio n. 3
0
        public void DeleteNotebook()
        {
            int notebookId = SelectedNotebook.Id;

            SelectedNotebook = null;
            SelectedNote     = null;
            DBDataAccessDelete.DeleteNotebook(notebookId);
            Notes     = null;
            Notebooks = new BindableCollection <NotebookModel>(DBDataAccessLoad.LoadNotebooks(User.Id));
        }
Esempio n. 4
0
        public void ConfirmNotebookNameRename(string newName)
        {
            RenameNotebookClicked = false;
            SelectedNotebook.Name = newName;

            try
            {
                DBDataAccessUpdate.UpdateNotebook(SelectedNotebook);
                Notebooks        = new BindableCollection <NotebookModel>(DBDataAccessLoad.LoadNotebooks(User.Id));
                SelectedNotebook = null;
            }
            catch (SQLiteException)
            {
                MessageBox.Show("Notebook name already in use");
            }
        }
Esempio n. 5
0
 protected override void OnActivate()
 {
     NotebooksCount = DBDataAccessLoad.LoadNotebooks(User.Id).Count;
     NotesCount     = DBDataAccessLoad.LoadUserNotes(User.Id).Count;
 }