示例#1
0
 private void TabItem_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (e.MiddleButton == System.Windows.Input.MouseButtonState.Pressed)
     {
         LadderTabItem tabItem = sender as LadderTabItem;
         RemoveLadderTabItem(tabItem);
     }
 }
示例#2
0
 private void SetCurrentItem(LadderTabItem tabItem)
 {
     if (!Items.Contains(tabItem))
     {
         AddLadderTabItem(tabItem);
     }
     SelectedItem = tabItem;
     tabItem.ItemGetKeyboardFocus();
 }
示例#3
0
        public void ShowItem(string name)
        {
            LadderTabItem tabItem = GetTabByName(name);

            if (tabItem == null)
            {
                var routine = CurrentProject.GetRoutineByName(name);
                if (routine != null)
                {
                    tabItem = new LadderTabItem(routine, Scale);
                    SetCurrentItem(tabItem);
                }
            }
            else
            {
                SetCurrentItem(tabItem);
            }
        }
示例#4
0
 private void RemoveLadderTabItem(LadderTabItem tabItem)
 {
     tabItem.MouseDown -= TabItem_MouseDown;
     tabItem.ClearElements();
     Items.Remove(tabItem);
 }
示例#5
0
 private void AddLadderTabItem(LadderTabItem tabItem)
 {
     tabItem.MouseDown += TabItem_MouseDown;
     Items.Add(tabItem);
 }