Exemplo n.º 1
0
        private TabItem AddTabItem(TAB_TYPE tabType)
        {
            int count = tabList.Count;

            // create new tab item
            TabItem tab = new TabItem();

            tab.Header          = getTabTitleFromTabType(tabType);
            tab.Name            = getTabNameFromTabType(tabType);
            tab.HeaderTemplate  = tabDynamic.FindResource("TabHeader") as DataTemplate;
            tab.ContentTemplate = getTabContentFromTabType(tabType);

            if (CheckTabExists(tab.Name))
            {
                return(null);
            }

            // insert tab item right before the last (+) tab item
            if (count == 0)
            {
                count += 1;
            }


            tabList.Insert(count - 1, tab);
            return(tab);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method return the template according to
        /// the tab requested by the user!
        /// </summary>
        /// <param name="tabType"> Type of tab (ENUM : Main.TAB_TYPE) </param>
        /// <returns> The requested template </returns>
        private DataTemplate getTabContentFromTabType(TAB_TYPE tabType)
        {
            switch (tabType)
            {
            case TAB_TYPE.TAB_BOOKING_CHECK_IN:
                return(tabDynamic.FindResource("TabBookingCheckIn") as DataTemplate);

            case TAB_TYPE.TAB_BOOKING_CHECK_OUT:
                return(tabDynamic.FindResource("TabBookingCheckOut") as DataTemplate);

            case TAB_TYPE.TAB_SERVICE_FOOD:
                return(tabDynamic.FindResource("TabServiceFood") as DataTemplate);
            }
            return(null);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get the name of the tab from tab type
        /// </summary>
        /// <param name="tabType"></param>
        /// <returns></returns>
        public String getTabNameFromTabType(TAB_TYPE tabType)
        {
            switch (tabType)
            {
            case TAB_TYPE.TAB_BOOKING_CHECK_IN:
                return("bookingCheckIn");

            case TAB_TYPE.TAB_BOOKING_CHECK_OUT:
                return("bookingCheckOut");

            case TAB_TYPE.TAB_SERVICE_FOOD:
                return("serviceFood");
            }
            return("");
        }
Exemplo n.º 4
0
        /// <summary>
        /// This method returns the title for
        /// requested tab.
        /// </summary>
        /// <param name="tabType"> the type of tab (ENUM : Main.TAB_TYPE) </param>
        /// <returns>requested title</returns>
        private string getTabTitleFromTabType(TAB_TYPE tabType)
        {
            switch (tabType)
            {
            case TAB_TYPE.TAB_BOOKING_CHECK_OUT:
                return("Check out");

            case TAB_TYPE.TAB_BOOKING_CHECK_IN:
                return("Check in");

            case TAB_TYPE.TAB_SERVICE_FOOD:
                return("Food Service");
            }

            return("");
        }