Example #1
0
        public MujProfil()
        {
            InitializeComponent();
            var layout = new StackLayout {
                Padding = new Thickness(5, 10)
            };
            var id = new Entry {
                Keyboard = Keyboard.Numeric,
            };
            var heslo = new Entry {
                IsPassword = true, Keyboard = Keyboard.Numeric, MaxLength = 5
            };

            layout.Children.Add(id);
            layout.Children.Add(heslo);
            var prihlasit = new Button {
                Text = "Přihlásit se", BackgroundColor = Color.RoyalBlue, TextColor = Color.DarkGray, FontSize = 15, CornerRadius = 4, BorderColor = Color.DarkGray, BorderWidth = 2
            };

            layout.Children.Add(prihlasit);
            prihlasit.Clicked += async(sender, args) => {
                if (Hrac.Prihlaseni(Convert.ToInt32(id.Text), heslo.Text) == null)
                {
                    mujprofil = new Grid()
                    {
                        RowDefinitions =
                        {
                            new RowDefinition(),
                            new RowDefinition(),
                            new RowDefinition(),
                            new RowDefinition(),
                            new RowDefinition(),
                            new RowDefinition(),
                            new RowDefinition(),
                            new RowDefinition(),
                        },
                        ColumnDefinitions =
                        {
                            new ColumnDefinition(),
                            new ColumnDefinition(),
                            new ColumnDefinition()
                        }
                    };
                    Content = mujprofil;
                    if (Hrac.role == 0)
                    {
                        MujProfilVedouci();
                    }
                    else
                    {
                        MujProfilHrac();
                    }
                }
                else
                {
                    await DisplayAlert("Chyba", "Špatné přihlašovací údaje!", "Zavřít");
                }
            };
            this.Content = layout;
        }