Ejemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            InitCustom();

            // Get our button from the layout resource,
            // and attach an event to it
            Button   button       = FindViewById <Button> (Resource.Id.buttonLogin);
            EditText loginText    = FindViewById <EditText>(Resource.Id.editTextLogin);
            EditText passwordText = FindViewById <EditText>(Resource.Id.editTextPassword);

            loginText.Text    = "*****@*****.**";
            passwordText.Text = "StacjaIt.1";

            button.Click += async delegate {
                try
                {
                    GlobalVars.Token = await _accountWebService.GetToken(loginText.Text, passwordText.Text);

                    GlobalVars.Building = await _buildingWebService.FindBuildingFullData(GlobalVars.Token.access_token, new Guid("1888561c-950b-41f3-9963-ddbeceb4da22"));

                    var intent = new Intent(this, typeof(HouseActivity));
                    StartActivity(intent);
                }
                catch
                {
                    Android.Widget.Toast.MakeText(this, "Podane dane są nieprawidłowe.", Android.Widget.ToastLength.Short).Show();
                }
            };
        }
Ejemplo n.º 2
0
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                App.Token = await _accountWebService.GetToken(LoginTextBox.Text, PasswordBox.Password);

                App.Building = await _buildingWebService.FindBuildingFullData(App.Token.access_token, new Guid("1888561c-950b-41f3-9963-ddbeceb4da22"));

                Frame.Navigate(typeof(HousePage));
            }
            catch (HttpRequestException)
            {
                ErrorTextBlock.Text = "Przesłane dane są niepoprawne.";
            }
        }