/// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            if (IsInDesignMode)
            {
                // Code runs in Blend --> create design time data.
            }
            else
            {
                noLabel = new LabelViewModel(new LabelMock() { Text = "No label" }, this);

                openNote = new OpenNoteCommand(this);
                newNote = new NewNoteCommand(this);
                closeNote = new CloseNoteCommand(this);
                deleteNote = new DeleteNoteCommand(this);
                saveNote = new SaveNoteCommand(this);
                delayedSaveNote = new DelayedSaveNoteCommand(this);
                simpleSearch = new SimpleSearchCommand(this);
                search = new ComplexSearchCommand(this);
                toggleSearch = new ToggleAdvancedSearchCommand(this);
                hideSearch = new HideSearchViewCommand(this);
                hideComplexSearch = new HideComplexSearchCommand(this);

                OpenNotes.CollectionChanged += openNotes_CollectionChanged;
                SearchResults.CollectionChanged += searchResults_CollectionChanged;
            }
        }
Example #2
0
        public NotesVM()
        {
            NewNoteCommand         = new NewNoteCommand(this);
            NewNotebookCommand     = new NewNotebookCommand(this);
            ExitCommand            = new ExitCommand(this);
            DeleteNoteCommand      = new DeleteNoteCommand(this);
            DeleteNotebookCommand  = new DeleteNotebookCommand(this);
            RenameNoteCommand      = new RenameNoteCommand(this);
            RenameNotebookCommand  = new RenameNotebookCommand(this);
            SaveNoteContentCommand = new SaveNoteContentCommand(this);

            Notes     = new ObservableCollection <Note>();
            Notebooks = new ObservableCollection <Notebook>();

            //TODO: Implement genuine login functionality.
            CurrentUser = new User()
            {
                Id        = 1,
                FirstName = "Alex",
                LastName  = "Barker",
                Username  = "******",
                Email     = "*****@*****.**",
                Password  = "******"
            };

            ReadNotebooks();
        }
Example #3
0
        public NotesViewModel()
        {
            NewNoteBookCommand = new NewNoteBookCommand(this);
            NewNoteCommand     = new NewNoteCommand(this);
            Notebooks          = new ObservableCollection <Notebook>();
            Notes = new ObservableCollection <Note>();

            ReadNotebooks();
        }
Example #4
0
        public NotesVM()
        {
            NewNoteBookCommand = new NewNoteBookCommand(this);
            NewNoteCommand     = new NewNoteCommand(this);

            NoteBooks = new ObservableCollection <Notebook>();
            Notes     = new ObservableCollection <Note>();

            GetNoteBooks();
        }
Example #5
0
        public NotesVM()
        {
            NewNotebookCommand = new NewNotebookCommand(this);
            NewNoteCommand     = new NewNoteCommand(this);
            ExitCommand        = new ExitCommand();
            BeginEditCommand   = new BeginEditCommand(this);
            HasEditedCommand   = new HasEditedCommand(this);
            Notebooks          = new ObservableCollection <Notebook>();
            Notes = new ObservableCollection <Note>();

            ReadNotebooks();
        }
Example #6
0
        public NotesVM()
        {
            NewNotebookCommand    = new NewNotebookCommand(this);
            NewNoteCommand        = new NewNoteCommand(this);
            DeleteNotebookCommand = new DeleteNotebookCommand(this);

            NoteBooks = new ObservableCollection <Notebook>();
            Notes     = new ObservableCollection <Note>();

            // get all the notebooks into a listview on page load
            GetNotebooks();
        }
Example #7
0
 public NotesVM()
 {
     NewNoteCommand     = new NewNoteCommand(this);
     NewNotebookCommand = new NewNotebookCommand(this);
     Notebooks          = new ObservableCollection <Notebook>();
     Notes                 = new ObservableCollection <Note>();
     EditCommand           = new EditCommand(this);
     EndEditCommand        = new EndEditCommand(this);
     DeleteNotebookCommand = new DeleteNotebookCommand(this);
     DeleteNoteCommand     = new DeleteNoteCommand(this);
     IsVisible             = Visibility.Collapsed;
     GetNotebooks();
 }
Example #8
0
 public NotesVM()
 {
     IsEditing      = false;
     context        = new NoteAppContext();
     NewNotebookCmd = new NewNotebookCommand(this);
     NewNoteCmd     = new NewNoteCommand(this);
     BeginEditCmd   = new BeginEditCommand(this);
     HasEditedCmd   = new HasEditedCommand(this);
     Notebooks      = new ObservableCollection <Notebook>();
     Notes          = new ObservableCollection <Note>();
     ReadNotebooks();
     ReadNotes();
 }
Example #9
0
        public NotesVM()
        {
            IsEditing = false;

            NewNotebookCommand = new NewNotebookCommand(this);
            NewNoteCommand     = new NewNoteCommand(this);
            beginEditeCommand  = new BeginEditeCommand(this);
            HasEditedCommand   = new HasEditedCommand(this);
            Notebooks          = new ObservableCollection <Notebook>();
            Notes = new ObservableCollection <Note>();

            ReadNotebooks();
            ReadNotes();
        }
Example #10
0
        public NotesVM()
        {
            IsNotebookEditing = false;

            NewNotebookCommand    = new NewNotebookCommand(this);
            NewNoteCommand        = new NewNoteCommand(this);
            BeginEditCommand      = new BeginEditCommand(this);
            RenameNotebookCommand = new RenameNotebookCommand(this);

            Notebooks = new ObservableCollection <Notebook>();
            Notes     = new ObservableCollection <Note>();

            CreateTables();
            ReadNotebooks();
            ReadNotes();
        }
Example #11
0
        public NotesVM()
        {
            NewNoteCommand     = new NewNoteCommand(this);
            NewNotebookCommand = new NewNotebookCommand(this);
            RenameCommand      = new RenameCommand(this);
            EndRenamingCommand = new EndRenamingCommand(this);
            DeleteCommand      = new DeleteCommand(this);

            Notebooks = new ObservableCollection <Notebook>();
            Notes     = new ObservableCollection <Note>();

            getNotebooks();

            RenameNotebookTextBoxVisibility = Visibility.Collapsed;
            RenameNoteTextBoxVisibility     = Visibility.Collapsed;
        }
Example #12
0
 //đã check
 public NoteVM()
 {
     //TODO:
     IsEditing             = false;
     NewNotebookCommand    = new NewNotebookCommand(this);
     NewNoteCommand        = new NewNoteCommand(this);
     BeginEditCommand      = new BeginEditCommand(this);
     HasEditingCommand     = new HasEditingCommand(this);
     DeleteNotebookCommand = new DeleteNotebookCommand(this);
     RefreshCommmand       = new RefreshCommmand(this);
     Notebooks             = new ObservableCollection <Notebook>();
     Notes = new ObservableCollection <Note>();
     //chú thích lỗi nếu người dùng chưa tạo notebook nào thì dòng này không được thức hiện
     ReadNotebooks();
     ReadNote();
 }
Example #13
0
        public NotesVM()
        {
            IsEditing = false; //ContextMenu boolean controller

            NewNotebookCommand = new NewNotebookCommand(this);
            NewNoteCommand     = new NewNoteCommand(this);
            BeginEditCommand   = new BeginEditCommand(this);
            HasEditedCommand   = new HasEditedCommand(this);

            //Inicializamos listas
            Notebooks = new ObservableCollection <NotebookModel>();
            Notes     = new ObservableCollection <NoteModel>();

            //Y leemos nada más empezar de la bbdd
            ReadNotebooks();
            ReadNotes();
        }
        public NotesViewModel()
        {
            IsEditing = false;

            NewNotebookCommand = new NewNotebookCommand(this);
            NewNoteCommand     = new NewNoteCommand(this);
            BeginEditCommand   = new BeginEditCommand(this);
            HasEditedCommand   = new HasEditedCommand(this);

            // Init the variables
            Notebooks = new ObservableCollection <Notebook>();
            Notes     = new ObservableCollection <Note>();

            // Init the different stuff.
            ReadNotebooks();
            ReadNotes();
        }
Example #15
0
        public NotesViewModel()
        {
            IsEditedNotebook = false;

            NewNotebookCommand    = new NewNotebookCommand(this);
            NewNoteCommand        = new NewNoteCommand(this);
            beginEditCommand      = new BeginEditCommand(this);
            hasEditedCommand      = new HasEditedCommand(this);
            deleteNotebookCommand = new DeleteNotebookCommand(this);
            deleteNoteCommand     = new DeleteNoteCommand(this);

            Notebooks = new ObservableCollection <Notebook>();
            Notes     = new ObservableCollection <Note>();

            ReadNotebooks();
            ReadNote();
        }
Example #16
0
        public NotesVM()
        {
            // create tables in db as first task
            DatabaseHelper.CreateTables <Notebook>();
            DatabaseHelper.CreateTables <Note>();

            NewNotebookCommand        = new NewNotebookCommand(this);
            NewNoteCommand            = new NewNoteCommand(this);
            BeginEditCommand          = new BeginEditCommand(this);
            HasEditedCommand          = new HasEditedCommand(this);
            CancelNotebookEditCommand = new CancelNotebookEditCommand();

            HasEditedNoteCommand  = new HasEditedNoteCommand(this);
            CancelNoteEditCommand = new CancelNoteEditCommand();

            Notebooks = new ObservableCollection <Notebook>();
            Notes     = new ObservableCollection <Note>();
        }
Example #17
0
        public NotesWindowVM()
        {
            IsEditing = false;

            NewNoteBookCommand    = new NewNoteBookCommand(this);
            NewNoteCommand        = new NewNoteCommand(this);
            CloseProgramCommand   = new CloseProgramCommand(this);
            BeginEditCommand      = new BeginEditCommand(this);
            HasEditedCommand      = new HasEditedCommand(this);
            DeleteNoteBookCommand = new DeleteNoteBookCommand(this);
            DeleteNoteCommand     = new DeleteNoteCommand(this);

            Notebooks = new ObservableCollection <NoteBook>();
            Notes     = new ObservableCollection <Note>();

            SelectedNote = new Note();
            ReadNoteBooks();
            ReadNotes();
        }
Example #18
0
        public NotesVM()
        {
            IsEditing     = false;
            IsNoteEditing = false;

            NewNotebookCommand        = new NewNotebookCommand(this);
            NewNoteCommand            = new NewNoteCommand(this);
            RenameNoteBookCommand     = new RenameNoteBookCommand(this);
            HasNotebookRenamedCommand = new HasNotebookRenamedCommand(this);
            DeleteNotebookCommand     = new DeleteNotebookCommand(this);
            RenameNoteCommand         = new RenameNoteCommand(this);
            HasNoteRenamedCommand     = new HasNoteRenamedCommand(this);
            DeleteNoteCommand         = new DeleteNoteCommand(this);

            Notebooks = new ObservableCollection <NoteBook>();
            Notes     = new ObservableCollection <Note>();

            ReadNoteBooks();
            ReadNotes();
        }
Example #19
0
        public NotesVM()
        {
            IsEditing             = false;
            IsEditingNote         = false;
            NewNotebookCommand    = new NewNotebookCommand(this);
            NewNoteCommand        = new NewNoteCommand(this);
            DeleteNotebookCommand = new DeleteNotebookCommand(this);
            DeleteNoteCommand     = new DeleteNoteCommand(this);
            BeginEditCommand      = new BeginEditCommand(this);
            IsEditedCommand       = new IsEditedCommand(this);
            BeginEditNoteCommand  = new BeginEditNoteCommand(this);
            IsEditedNoteCommand   = new IsEditedNoteCommand(this);

            Notebooks = new ObservableCollection <Notebook>();
            Notes     = new ObservableCollection <Note>();
            FontSizes = new List <double>()
            {
                8, 9, 10, 11, 12, 14, 16, 28, 48, 72
            };

            ReadNotebooks();
            ReadNotes();
        }
        public MainVM()
        {
            if (DesignerProperties.GetIsInDesignMode(new System.Windows.DependencyObject()))
            {
                Notes = new ObservableCollection <Note>();
                Notes.Add(new Note()
                {
                    Name = "note1", DateTime = DateTime.Now.ToShortDateString()
                });
                Notes.Add(new Note()
                {
                    Name = "note2", DateTime = DateTime.Now.ToShortDateString()
                });
                Notes.Add(new Note()
                {
                    Name = "note3", DateTime = DateTime.Now.ToShortDateString()
                });

                Pages = new ObservableCollection <Page>();
                Pages.Add(new Page()
                {
                    Name = "Screenshot", DateTime = DateTime.Now.ToShortDateString()
                });
                Pages.Add(new Page()
                {
                    Name = "Screenshot", DateTime = DateTime.Now.ToShortDateString()
                });
                Pages.Add(new Page()
                {
                    Name = "Screenshot", DateTime = DateTime.Now.ToShortDateString()
                });
                IsEditingNoteName = false;
                IsEditingVocab    = false;

                Vocabs = new ObservableCollection <Vocab>();
                Vocabs.Add(new Vocab()
                {
                    PageId = 1, Word = "123", Explaination = "321", Pronounciation = "aaa"
                });
                Vocabs.Add(new Vocab()
                {
                    PageId = 1, Word = "456", Explaination = "654", Pronounciation = "bbb"
                });
                Vocabs.Add(new Vocab()
                {
                    PageId = 1, Word = "789", Explaination = "987", Pronounciation = "ccc"
                });
            }
            else
            {
                WindowState                      = System.Windows.WindowState.Normal;
                NewNoteCommand                   = new NewNoteCommand(this);
                DeleteNoteCommand                = new DeleteNoteCommand(this);
                NewPageCommand                   = new NewPageCommand(this);
                DeletePageCommand                = new DeletePageCommand(this);
                RenameNoteCommand                = new RenameNoteCommand(this);
                ScreenCapCommand                 = new ScreenCapCommand(this);
                HasEditedNoteNameCommand         = new HasEditedNoteNameCommand(this);
                UsePreviousSelectionCommand      = new UsePreviousSelectionCommand(this);
                DoNotUsePreviousSelectionCommand = new DoNotUsePreviousSelectionCommand(this);
                CheckDictionaryCommand           = new CheckDictionaryCommand(this);
                GoogleTranslateCommand           = new GoogleTranslateCommand(this);
                DeleteVocabCommand               = new DeleteVocabCommand(this);
                NewVocabCommand                  = new NewVocabCommand(this);
                StartUpdateVocabCommand          = new StartUpdateVocabCommand(this);
                EndUpdateVocabCommand            = new EndUpdateVocabCommand(this);
                CropOriginalScreenshotCommand    = new CropOriginalScreenshotCommand(this);
                NewPageViaScreenshotCommand      = new NewPageViaScreenshotCommand(this);
                CaptureMoreTextCommand           = new CaptureMoreTextCommand(this);
                StartRenamePageCommand           = new StartRenamePageCommand(this);
                EndRenamePageCommand             = new EndRenamePageCommand(this);
                ToggleUpdateVocabCommand         = new ToggleUpdateVocabCommand(this);
                CheckDictionaryLittleDCommand    = new CheckDictionaryLittleDCommand(this);
                SyncVocabsCommand                = new SyncVocabsCommand(this);

                Notes  = new ObservableCollection <Note>();
                Pages  = new ObservableCollection <Page>();
                Vocabs = new ObservableCollection <Vocab>();
                ReadNotes();
                ReadPages();
                IsEditingNoteName              = false;
                IsEditingVocab                 = false;
                DisplayIndex                   = 0;
                DoUsePreviousSelection         = false;
                browserAddress                 = "";
                DictionaryBaseUrl_JapanDict    = "https://www.japandict.com/";
                DictionaryBaseUrl_littleD      = "http://dict.hjenglish.com/jp/jc/";
                SelectedPageIndex              = 0;
                NoPreviousCropButtonIsSelected = true;
                IsRenamingPage                 = false;
            }
        }
Example #21
0
        private void createButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(titleTextBox.Text) && contentTextBox.Document.Blocks.Count == 0)
            {
                TaskDialog td = new TaskDialog(
                    Application.Current.MainWindow,
                    "Empty Note",
                    "You are about to create a note with no title and no body.",
                    MessageType.Information,
                    true
                    );

                if (td.ShowDialog() != true)
                {
                    return;
                }
            }

            NotebookPage page = new NotebookPage();

            page.Title           = titleTextBox.Text;
            page.DetailsDocument = contentTextBox.Document;
            page.Created         = page.LastModified = DateTime.UtcNow;

            if (NotesView.LastUsedNotesView == null)
            {
                string nbID = Settings.LastOpenedNotebook;

                Notebook nb = null;

                if (nbID != null)
                {
                    nb = NoteDatabase.GetNotebook(nbID);
                }

                if (nb == null)
                {
                    nb = NoteDatabase.FirstNotebook();
                }

                if (nb == null)
                {
                    nb       = new Notebook();
                    nb.Title = "My Notebook";
                    nb.Color = NotesFunctions.GenerateNotebookColor();
                    NoteDatabase.Add(nb);
                }

                NotebookSection ns = NoteDatabase.GetSection(nb.LastSelectedSectionID);

                if (ns == null)
                {
                    ns            = new NotebookSection();
                    ns.Title      = "Quick Notes";
                    ns.NotebookID = nb.ID;
                    ns.Color      = NotesFunctions.GenerateSectionColor();
                    NoteDatabase.Add(ns);
                }

                page.SectionID = ns.ID;
            }
            else
            {
                Notebook nb = NotesView.LastUsedNotesView.SelectedNotebook;

                if (nb == null)
                {
                    nb       = new Notebook();
                    nb.Title = "My Notebook";
                    nb.Color = NotesFunctions.GenerateNotebookColor();
                    NoteDatabase.Add(nb);
                }

                NotebookSection ns = NotesView.LastUsedNotesView.SelectedSection;

                if (ns == null)
                {
                    ns            = new NotebookSection();
                    ns.Title      = "Quick Notes";
                    ns.NotebookID = nb.ID;
                    ns.Color      = NotesFunctions.GenerateSectionColor();
                    NoteDatabase.Add(ns);
                }

                page.SectionID = ns.ID;
            }

            NoteDatabase.Add(page);

            titleTextBox.Clear();
            contentTextBox.Document.Blocks.Clear();

            if (NotesView.LastUsedNotesView != null)
            {
                NewNoteCommand.Execute(page, NotesView.LastUsedNotesView);
            }
        }
Example #22
0
 public NotesVM()
 {
     NewNotebookCommand = new NewNotebookCommand(this);
     NewNoteCommand     = new NewNoteCommand(this);
 }