internal void RefreshChildLists() { if (NotebookPages.IsSorted == false) { NotebookPages.Sort(); } NavigatorInterface.RefreshAllPages(); }
private void InsertPageInternal(int index, NotebookPage page) { if (page == null) { throw new NullReferenceException(); } if (NotebookPages.Contains(page)) { throw new ArgumentException(); } NotebookPages.InsertInternal(index, page); NoteControls.AddInternal(page); NavigatorInterface.RefreshAllPages(); }
private void AddPageInternal(NotebookPage page) { if (page == null) { throw new ArgumentException("Page cannot be null."); } if (NotebookPages.Contains(page)) { throw new ArgumentException("Page is already in the notebook."); } NotebookPages.AddInternal(page); NoteControls.AddInternal(page); NavigatorInterface.RefreshAllPages(); }
private void CreateNavigator(NavigatorType type) { INavigator navigator = NavigatorFactory.CreateNavigator(this, type); int currentNavSize = 0; int selectedIndex = -1; if (navigator is Control == false) { throw new ArgumentException("Notebook navigators must inherit from Control."); } if (mNavigator != null) { selectedIndex = SelectedIndex; switch (Navigator.Location) { case NavigatorLocation.Left: case NavigatorLocation.Top: currentNavSize = mSplitterLocation; break; case NavigatorLocation.Bottom: currentNavSize = ClientSize.Height - mSplitterLocation; break; case NavigatorLocation.Right: currentNavSize = ClientSize.Width - mSplitterLocation; break; } } mNavType = type; mNavProperties = navigator.CreateProperties(); mNavigator = (Control)navigator; // remove any existing navigator before adding the new one NoteControls.RemoveNavigator(); NoteControls.Add(mNavigator); NavigatorInterface.RefreshAllPages(); SelectedIndex = selectedIndex; RedoLayout(); DisplayCorrectPage(); }
private void RemovePageInternal(NotebookPage page) { if (page == null) { throw new NullReferenceException(); } int newIndex = SelectedIndex; if (newIndex >= NotebookPages.IndexOf(page) && newIndex > -1) { newIndex--; if (newIndex < 0 && NotebookPages.Count > 1) { newIndex = 0; } } if (newIndex >= NotebookPages.Count) { newIndex = NotebookPages.Count - 1; } SelectedIndex = newIndex; NotebookPages.RemoveInternal(page); NoteControls.RemoveInternal(page); if (NotebookPages.Count > 0 && SelectedIndex == -1) { SelectedIndex = 0; } NavigatorInterface.RefreshAllPages(); DisplayCorrectPage(); }