コード例 #1
0
        private void AddPmTab(string tabName)
        {
            ButtonTabHeader tabHeader = new ButtonTabHeader();

            tabHeader.TabName.Content = tabName;
            tabHeader.CloseButton    += () => ClosePmTab(tabName);
            tabHeader.Tag             = tabName;

            var tab = new TabItem {
                Header = tabHeader, Content = new ChatPanel(), Tag = tabName
            };

            _pmTabs[tabName] = tab;
            TabControl.Items.Add(tab);
        }
コード例 #2
0
        private void AddChannelTab(string tabName, bool closeAble = true)
        {
            ButtonTabHeader tabHeader = new ButtonTabHeader();

            tabHeader.TabName.Content = '#' + tabName;
            if (closeAble)
            {
                tabHeader.CloseButton += () => CloseChannelTab(tabName);
            }
            else
            {
                tabHeader.ButtonClose.Visibility = Visibility.Collapsed;
            }
            tabHeader.Tag = tabName;

            var tab = new TabItem {
                Header = tabHeader, Content = new ChatPanel(), Tag = tabName
            };

            _channelTabs[tabName] = tab;
            TabControl.Items.Add(tab);
        }
コード例 #3
0
        private void AddView(string tabName, UserControl view, ListViewItem button)
        {
            var tab = new ButtonTabHeader();

            tab.TabName.Content    = tabName;
            tab.ButtonClose.Click += (sender, arg) => CloseTab(tabName);
            tab.MouseDown         += (sender, arg) =>
            {
                MainView.TabWindow.Focus();
                if (_viewTabs.ContainsKey(tabName))
                {
                    _viewTabs[tabName].Focus();
                }
            };
            view.MouseDown += (sender, arg) =>
            {
                MainView.TabWindow.Focus();
                if (_viewTabs.ContainsKey(tabName))
                {
                    _viewTabs[tabName].Focus();
                }
            };
            tab.Tag    = tabName;
            button.Tag = tabName;
            var tabItm = new TabItem {
                Header = tab, Content = view
            };

            _viewTabs[tabName] = tabItm;
            _views[tabName]    = view;
            MainView.TabWindow.Items.Add(tabItm);
            button.MouseDoubleClick += Button_DoubleClick;
            if (_viewTabs.Count > 0)
            {
                MainView.VerticalLine.Background = (Brush) new BrushConverter().ConvertFromString("#007ACC");
            }
        }