public DockNotebookTab InsertTab(int index) { var tab = new DockNotebookTab(this, tabStrip); if (index == -1) { pages.Add(tab); tab.Index = pages.Count - 1; } else { pages.Insert(index, tab); tab.Index = index; UpdateIndexes(index + 1); } pagesHistory.Add(tab); if (pages.Count == 1) { CurrentTab = tab; } tabStrip.StartOpenAnimation((DockNotebookTab)tab); tabStrip.Update(); tabStrip.DropDownButton.Sensitive = pages.Count > 0; PageAdded?.Invoke(this, new TabEventArgs { Tab = tab, }); NotebookChanged?.Invoke(this, EventArgs.Empty); return(tab); }
public void AddPage(Page page) { Ensure.Argument.NotNull(page, CoreStrings.NullPage); Ensure.That(page.ValidateImageContent(), CoreStrings.PageInvalidImageContent); _pages.Add(page); _events.Add(PageAdded.Create()); }
/// <summary> /// Raises the <see cref="PageAdded"/> event. /// </summary> /// <param name="e">A <see cref="PageEventArgs"/> that contains event data.</param> protected internal virtual void OnPageAdded(PageEventArgs e) { PageAdded?.Invoke(this, e); }
public void PerformPageAdded(object sender, PageChangedEventArgs e) { PageAdded?.Invoke(this, e); }