示例#1
0
    private void CheckMenuInput()
    {
        vAxis = Input.GetAxis("Vertical_1") + Input.GetAxis("Vertical_2")
                + Input.GetAxis("Vertical_4") + Input.GetAxis("Vertical_3");

        submit = Input.GetButton("Submit");

        if (vAxis <= 0)
        {
            if (!restartButton.GetIsFocused())
            {
                restartButton.Focus();
            }
            if (submit)
            {
                Restart();
                submit = false;
            }
        }
        else
        {
            if (!quitButton.GetIsFocused())
            {
                quitButton.Focus();
            }
            if (submit)
            {
                submit = false;
                Application.Quit();
            }
        }
    }
示例#2
0
        private void CriarPagina()
        {
            var alturaTela            = Height;
            var paddingTela           = alturaTela * .05f;
            var alturaLogo            = alturaTela * .65f;
            var alturaMarginTopTextos = alturaTela * .1f;
            var alguraTextos          = alturaTela * .3f;

            Padding         = new Thickness(0, 0, 0, paddingTela);
            BackgroundColor = COR_BACKGROUND_TELA;

            // instancia de objetos da pagina
            logo = new Image
            {
                //Source = ImageSource.FromResource("VotacaoEstampas.Images.logo_white_512.png"),
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                HeightRequest     = alturaLogo,
                WidthRequest      = alturaLogo
            };

            txtNome = new CustomEntry
            {
                Placeholder      = "Nome:",
                FontSize         = FONTE_TEXTO_LABELS,
                FontFamily       = FAMILIA_TEXTO_LABELS,
                FontAttributes   = ATRIBUTOS_TEXTO_LABELS,
                PlaceholderColor = COR_TEXTO_LABELS,
                TextColor        = COR_TEXTO_LABELS,
                HeightRequest    = FONTE_TEXTO_LABELS + 30,
                Keyboard         = Keyboard.Text
            };
            txtNome.Completed += (object sender, EventArgs e) => { txtEmail.Focus(); };

            txtEmail = new CustomEntry
            {
                Placeholder      = "Email:",
                FontSize         = FONTE_TEXTO_LABELS,
                FontFamily       = FAMILIA_TEXTO_LABELS,
                FontAttributes   = ATRIBUTOS_TEXTO_LABELS,
                PlaceholderColor = COR_TEXTO_LABELS,
                TextColor        = COR_TEXTO_LABELS,
                Keyboard         = Keyboard.Email
            };
            txtEmail.Completed += (object sender, EventArgs e) => { txtFone.Focus(); };

            txtFone = new CustomEntry
            {
                Placeholder      = "Fone:",
                FontSize         = FONTE_TEXTO_LABELS,
                FontFamily       = FAMILIA_TEXTO_LABELS,
                FontAttributes   = ATRIBUTOS_TEXTO_LABELS,
                PlaceholderColor = COR_TEXTO_LABELS,
                TextColor        = COR_TEXTO_LABELS,
                Keyboard         = Keyboard.Numeric,
            };
            txtFone.TextChanged += TxtFone_TextChanged;

            var btnIniciarPesquisa = new CustomButton
            {
                Text              = "Iniciar Pesquisa",
                FontSize          = FONTE_TEXTO_LABELS,
                FontFamily        = FAMILIA_TEXTO_LABELS,
                FontAttributes    = ATRIBUTOS_TEXTO_LABELS,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                TextColor         = COR_TEXTO_LABELS,
                BorderRadius      = 20,
                HeightRequest     = FONTE_TEXTO_LABELS + 30,

                CorBackgroundCustomRed   = 30,
                CorBackgroundCustomGreen = 30,
                CorBackgroundCustomBlue  = 30
            };

            txtFone.Completed          += (object sender, EventArgs e) => { btnIniciarPesquisa.Focus(); };
            btnIniciarPesquisa.Clicked += VerificarUser;

            var containerBtn = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Padding           = new Thickness(40, 0),
                Children          =
                {
                    btnIniciarPesquisa
                }
            };

            // set conteudo da página
            Content = new StackLayout
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Spacing           = 20,
                Children          =
                {
                    logo, txtNome, txtEmail, txtFone, containerBtn
                }
            };
        }