Exemplo n.º 1
0
        /// <summary>
        /// Handler for a page button.  Changes the page of controls being shown.
        /// </summary>
        void pageButton_Tapped(object sender, EventArgs e)
        {
            Button button = sender as Button;

            EDynamicControlPage page = (EDynamicControlPage)button.Tag;

            ShowPage(page);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a button to change to a page of controls.
        /// </summary>
        /// <param name="container">The container to add the button to.</param>
        /// <param name="left">The left position of the button.</param>
        /// <param name="text">The text to set the button text to.</param>
        /// <param name="page">The enumeration for the page that will be shown when this button is tapped.</param>
        private void AddPageButton(Container container, int left, string text, EDynamicControlPage page)
        {
            Button button = new Button();

            button.Left               = left;
            button.Top                = 10;
            button.Width              = 130;
            button.Text               = text;
            button.Height             = 80;
            button.FontName           = @"Fonts\ControlFont";
            button.BackTextureName    = @"Textures\button";
            button.PressedTextureName = @"Textures\buttonpressed";
            button.Tag                = page;
            button.Tapped            += new EventHandler(pageButton_Tapped);

            container.AddControl(button);
            pageButtons.Add(button);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Shows the specified page of controls.
        /// </summary>
        /// <param name="page">The page to show.</param>
        private void ShowPage(EDynamicControlPage page)
        {
            // Change the color of the buttons to represent the current choice
            foreach (Button pageButton in pageButtons)
            {
                EDynamicControlPage buttonPage = (EDynamicControlPage)pageButton.Tag;

                if (buttonPage == page)
                {
                    pageButton.TextColor = Color.Black;
                    pageButton.Hue       = Color.Yellow;
                }
                else
                {
                    pageButton.TextColor = Color.LightGray;
                    pageButton.Hue       = Color.DarkGray;
                }
            }

            // Hide both containers
            dynamicControlsContainer.Visible = false;
            loadedControlsContainer.Visible  = false;

            switch (page)
            {
            case EDynamicControlPage.Page1:
                dynamicControlsContainer.Visible = true;
                break;

            case EDynamicControlPage.Page2:
                loadedControlsContainer.Visible = true;
                LoadControls(@"Menus\MenuPage2");
                break;

            case EDynamicControlPage.Page3:
                loadedControlsContainer.Visible = true;
                Container container = LoadControls(@"Menus\MenuPage3");

                SetupPage3(container);
                break;
            }
        }