Example #1
0
 private void AddTabItem(TabItem tabItem, TabTypeEnum tabType)
 {
     tabItem.Tag = tabType;
     if (!(tabItem.Header is TextBlock))
     {
         tabItem.Header = TextBlockEx.Create(tabItem.Header.ToString(), new object[0]);
     }
     tabItem.Style = (Style)FindResource("tabRightPanel");
     tabControl.Items.Add(tabItem);
 }
Example #2
0
        private TabItem GetTabItem(TabTypeEnum tabType)
        {
            TabItem tabItem = null;

            foreach (TabItem item in tabControl.Items)
            {
                TabTypeEnum ty = (TabTypeEnum)item.Tag;
                if (ty == tabType)
                {
                    tabItem = item;
                    break;
                }
            }
            return(tabItem);
        }
Example #3
0
        private TabTypeEnum GetTabType(string typeName)
        {
            TabTypeEnum tabType = TabTypeEnum.Unknown;

            switch (typeName)
            {
            case "话术":
                tabType = TabTypeEnum.ShortCut;
                break;

            case "机器人":
                tabType = TabTypeEnum.Robot;
                break;
            }
            return(tabType);
        }
Example #4
0
        private TabItem CreateTabItem(TabTypeEnum tabType)
        {
            TabItem tabItem = null;

            switch (tabType)
            {
            case TabTypeEnum.ShortCut:
                tabItem = TabShortcut();
                break;

            default:
                tabItem = TabRobot();
                break;
            }
            return(tabItem);
        }
Example #5
0
        public void ReShowAfterChangePanelOption()
        {
            Util.Assert(_wndDontUse != null);
            tabControl.Items.Clear();
            var seller = Wnd.Desk.Seller;
            var tabs   = new string[] { "话术", "机器人" };

            foreach (string tabName in tabs)
            {
                TabTypeEnum tabType = GetTabType(tabName);
                TabItem     tabItem = CreateTabItem(tabType);
                if (tabItem != null)
                {
                    AddTabItem(tabItem, tabType);
                }
            }
        }
Example #6
0
 public void Init(WndAssist wnd)
 {
     if (_wndDontUse == null)
     {
         Wnd = wnd;
         lblSeller.Content = Wnd.Desk.Seller;
         string   seller = Wnd.Desk.Seller;
         string[] tabs   = new string[] { "话术" /*, "机器人"*/ };
         foreach (string tabName in tabs)
         {
             TabTypeEnum tabType = GetTabType(tabName);
             TabItem     tabItem = CreateTabItem(tabType);
             if (tabItem != null)
             {
                 AddTabItem(tabItem, tabType);
             }
         }
         tabControl.SelectionChanged -= tabControl_SelectionChanged;
         tabControl.SelectionChanged += tabControl_SelectionChanged;
     }
 }