Interaction logic for TH_TabHeader.xaml
Inheritance: System.Windows.Controls.UserControl
コード例 #1
0
 void TabHeader_CloseClicked(TabHeader header)
 {
     CloseTab(header.Text, header.Tag);
 }
コード例 #2
0
 void TabHeader_Clicked(TabHeader header)
 {
     SelectTab(header.Text, header.Tag);
 }
コード例 #3
0
        private bool CheckCancel(TabHeader header)
        {
            bool result = false;

            if (header.Page != null && header.Page.PageContent != null)
            {
                result = !header.Page.PageContent.Closing();
            }

            return result;
        }
コード例 #4
0
        public void SelectTab(TabHeader header)
        {
            // Unselect other tabs
            foreach (var oheader in TabHeaders) if (oheader != header) oheader.IsSelected = false;

            header.IsSelected = true;

            // Fade in if not previously set
            if (CurrentPage == null) AnimateTabPageOpen();

            CurrentPage = header.Page;
            SelectedTab = header;
        }
コード例 #5
0
 public int FindTabIndex(TabHeader header)
 {
     int index = TabHeaders.ToList().FindIndex(x => x.Text == header.Text);
     return index;
 }
コード例 #6
0
        public void AddTab(IPage page, string name = null, ImageSource image = null, string tag = null)
        {
            string txt = page.Title;

            ImageSource img = null;
            if (page.Image != null) img = new BitmapImage(page.Image);

            if (name != null) txt = name;
            if (image != null) img = image;

            TabHeader header = FindTab(page, txt, tag);
            if (header == null)
            {
                header = new TabHeader();
                header.Text = txt;
                header.Image = img;
                header.Tag = tag;
                header.Page = new TabPage(page);

                header.Clicked += TabHeader_Clicked;
                header.CloseClicked += TabHeader_CloseClicked;
                header.Opened += TabHeader_Opened;
                header.Closed += TabHeader_Closed;
                page.SendData += SendEventData;

                // Send Current User Data
                SendCurrentUser(page);

                // Send Current Device List
                SendCurrentDevices(page);

                TabHeaders.Add(header);

                header.Open(TabHeaders.Count == 1);
            }

            SelectTab(header);
        }