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); } }
private void SetCurrentItem(LadderTabItem tabItem) { if (!Items.Contains(tabItem)) { AddLadderTabItem(tabItem); } SelectedItem = tabItem; tabItem.ItemGetKeyboardFocus(); }
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); } }
private void RemoveLadderTabItem(LadderTabItem tabItem) { tabItem.MouseDown -= TabItem_MouseDown; tabItem.ClearElements(); Items.Remove(tabItem); }
private void AddLadderTabItem(LadderTabItem tabItem) { tabItem.MouseDown += TabItem_MouseDown; Items.Add(tabItem); }