示例#1
0
 public static void DeletePage(HelpDocFrame page)
 {
     foreach (var item in new List <HelpDocFrame>(TabItemCollection))
     {
         if (item.PageIndex == page.PageIndex)
         {
             TabItemCollection.Remove(item);
         }
     }
 }
示例#2
0
 public static void CollectPage(HelpDocFrame page)
 {
     foreach (var item in TabItemCollection)
     {
         if (item.PageIndex == page.PageIndex)
         {
             return;
         }
     }
     TabItemCollection.Add(page);
 }
示例#3
0
 public void CloseItem(HelpDocFrame item)
 {
     if (TabItemCollection.Contains(item))
     {
         oldStatus = GetCurrentStatus();
         if (item == SelectedItem)
         {
             SelectedIndex = 0;
         }
         TabItemCollection.Remove(item);
         item.IsUsed = false;
         PageTabControlStatusChanged.Invoke(new PageTabControlStatusChangedEventArgs(oldStatus));
     }
 }
示例#4
0
 public void ShowItem(HelpDocFrame item)
 {
     oldStatus = GetCurrentStatus();
     if (!TabItemCollection.Contains(item))
     {
         TabItemCollection.Add(item);
         item.IsUsed = true;
     }
     if (SelectedItem != item)
     {
         SelectedItem = item;
         PageTabControlStatusChanged.Invoke(new PageTabControlStatusChangedEventArgs(oldStatus));
     }
 }
示例#5
0
        private void OnTabItemHeaderCancelButtonClick(object sender, RoutedEventArgs e)
        {
            Button button = sender as Button;

            if (button != null)
            {
                TabItem tabitem = button.TemplatedParent as TabItem;
                if (tabitem != null)
                {
                    HelpDocFrame tab = tabitem.Content as HelpDocFrame;
                    if (tab != null)
                    {
                        MainTab.CloseItem(tab);
                    }
                }
            }
        }
示例#6
0
 private void OnTabItemHeaderMouseDown(object sender, MouseButtonEventArgs e)
 {
     if (e.MiddleButton == MouseButtonState.Pressed)
     {
         Grid grid = sender as Grid;
         if (grid != null)
         {
             TabItem tabitem = grid.TemplatedParent as TabItem;
             if (tabitem != null)
             {
                 HelpDocFrame tab = tabitem.Content as HelpDocFrame;
                 if (tab != null)
                 {
                     MainTab.CloseItem(tab);
                 }
             }
         }
     }
 }
示例#7
0
 public void InitializeTabItemCollection(HelpDocFrame item)
 {
     TabItemCollection.Add(item);
     item.IsUsed  = true;
     SelectedItem = item;
 }