Пример #1
0
        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);
        }
Пример #2
0
 public void AddPage(Page page)
 {
     Ensure.Argument.NotNull(page, CoreStrings.NullPage);
     Ensure.That(page.ValidateImageContent(), CoreStrings.PageInvalidImageContent);
     _pages.Add(page);
     _events.Add(PageAdded.Create());
 }
Пример #3
0
 /// <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);
 }
Пример #4
0
 public void PerformPageAdded(object sender, PageChangedEventArgs e)
 {
     PageAdded?.Invoke(this, e);
 }