Ejemplo n.º 1
0
        /// <summary>
        /// Creates a tab btn in the tab panel for the given user tab
        /// the button is store as an attribute in the usertab class
        /// </summary>
        /// <param name="tab">The user tab to create a button for</param>
        public void AddTabButton(UserTab tab)
        {
            btn = CreateTabButton(tab.ToString());
            tab.SetTabButton(btn);
            grid_addTabs.Children.Add(btn);
            tabButtonsList.Add(btn);
            // tabPanel.Children.Add(btn);
            lbl_tabName.Content     = tab.ToString();
            grid_summary.Background = tab.GetTabButton().Background;

            Storyboard sb = Resources["sbShowTab"] as Storyboard;

            sb.Begin(btn);

            lbl_tabTotal.Content = "Total: $" + tab.amountOwing.ToString("F");

            this.focusedTab = tab;
        }
Ejemplo n.º 2
0
        private void btn_payNow_Click(object sender, RoutedEventArgs e)
        {
            ms.allTabs.RemoveTab(ms.focusedTab);
            ms.grid_addTabs.Children.Remove(ms.focusedTab.GetTabButton());
            ms.tabButtonsList.Remove(ms.focusedTab.GetTabButton());
            ms.newTabThickness -= 75;
            int  marginTop   = 150;
            int  i           = 0;
            bool foundButton = false;

            foreach (Button btn  in ms.tabButtonsList)
            {
                //if (btn == ms.focusedTab.GetTabButton())
                //{
                //    foundButton = true;
                //}
                //if (foundButton)
                //{
                btn.Margin = new Thickness(0, marginTop, 0, 0);
                i++;
                marginTop += 75;
                //}
            }
            if (ms.allTabs.GetTabs().Count > 0)
            {
                UserTab ut = ms.allTabs.GetTabs()[0];
                ms.lbl_tabTotal.Content    = "Total: $" + ut.amountOwing;
                ms.lbl_tabName.Content     = ut.ToString();
                ms.grid_summary.Background = ut.GetTabButton().Background;
                ms.focusedTab = ut;
                this.Close();
            }
            else
            {
                //that was the last tab
                this.Close();
                ClosingScreen cs = new ClosingScreen(3000);
                ms.Close();
                MainScreen mainScreen = new MainScreen();
            }
        }