Example #1
0
        private static void ExecutedNewNoteCommand(object sender, ExecutedRoutedEventArgs e)
        {
            NotesView notesView = (NotesView)sender;

            NotebookPage    page     = (NotebookPage)e.Parameter;
            NotebookSection section  = NoteDatabase.GetSection(page.SectionID);
            Notebook        notebook = NoteDatabase.GetNotebook(section.NotebookID);

            if (notesView.SelectedNotebook == null)
            {
                notesView.AddNotebook(notebook, true);
                return;
            }

            if (notesView.SelectedSection == null)
            {
                notesView.AddSection(section, true);
                return;
            }

            if (notesView.SelectedPage == null)
            {
                notesView.AddPage(page, true);
            }
            else
            {
                notesView.AddPage(page);
            }
        }
Example #2
0
        private static void SelectedPageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NotesView notesView = (NotesView)d;

            notesView.document.Visibility    = e.NewValue != null ? Visibility.Visible : Visibility.Hidden;
            notesView.background.Background  = e.NewValue != null ? Brushes.White : PanelBrushes.LightGrayBrushOpaque;
            notesView.messageGrid.Visibility = e.NewValue != null ? Visibility.Hidden : Visibility.Visible;

            if (e.NewValue != null)
            {
                notesView.document.Visibility    = Visibility.Visible;
                notesView.background.Background  = Brushes.White;
                notesView.messageGrid.Visibility = Visibility.Hidden;
                notesView.background.IsEnabled   = false;

                if (e.OldValue == null)
                {
                    notesView.RaiseBeginEditEvent();
                }
            }
            else
            {
                notesView.document.Visibility    = Visibility.Hidden;
                notesView.background.Background  = PanelBrushes.LightGrayBrushOpaque;
                notesView.messageGrid.Visibility = Visibility.Visible;
                //notesView.background.IsEnabled = true;

                notesView.RaiseEndEditEvent();
            }
        }
Example #3
0
        public void Load()
        {
            IEnumerable <Notebook> notebooks = NoteDatabase.GetNotebooks();

            if (notebooks.GetEnumerator().MoveNext())
            {
                foreach (Notebook each in notebooks)
                {
                    AddNotebook(each);
                }

                string lastOpened = Settings.LastOpenedNotebook;

                bool found = false;

                if (lastOpened != "")
                {
                    foreach (ToggleButton each in notebookTabs.Items)
                    {
                        if (((DatabaseObject)each.Tag).ID == lastOpened)
                        {
                            each.IsChecked = true;
                            found          = true;
                            break;
                        }
                    }
                }

                if (!found)
                {
                    ((ToggleButton)notebookTabs.Items[0]).IsChecked = true;
                }
            }
            else
            {
                SelectedNotebook = null;
                SelectedSection  = null;
                SelectedPage     = null;
                ShowEmptyWorkspaceMessage();
            }

            HasLoaded         = true;
            LastUsedNotesView = this;

            if (_createOnLoad)
            {
                AddPage();
                _createOnLoad = false;
            }

            if (_scrollToNoteId != null)
            {
                ScrollToNote(_scrollToNoteId);
            }
        }
Example #4
0
        private static void SelectedSectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NotesView notesView = (NotesView)d;

            notesView.addPageButton.IsEnabled = e.NewValue != null;

            if (e.NewValue == null)
            {
                notesView.pageTabs.Items.Clear();
            }
        }
Example #5
0
        private static void SelectedNotebookChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            NotesView notesView = (NotesView)d;

            notesView.addSectionButton.IsEnabled = e.NewValue != null;

            if (e.NewValue == null)
            {
                notesView.sectionTabs.Items.Clear();
                notesView.sectionTabs.Items.Add(notesView.addSectionButton);
                notesView.sectionTabs.Items.Add(notesView.sectionOverflowButton);
            }
        }