Interaction logic for TH_TabHeader.xaml
Inheritance: System.Windows.Controls.UserControl
Example #1
0
 void TabHeader_CloseClicked(TabHeader header)
 {
     CloseTab(header.Text, header.Tag);
 }
Example #2
0
 void TabHeader_Clicked(TabHeader header)
 {
     SelectTab(header.Text, header.Tag);
 }
Example #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;
        }
Example #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;
        }
Example #5
0
 public int FindTabIndex(TabHeader header)
 {
     int index = TabHeaders.ToList().FindIndex(x => x.Text == header.Text);
     return index;
 }
Example #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);
        }