示例#1
0
文件: Login.cs 项目: SimoneVbt/ZAPP
        public async void PostData(object sender, object e)
        {
            string gebruikersnaam = FindViewById <EditText>(Resource.Id.Username).Text;
            string wachtwoord     = FindViewById <EditText>(Resource.Id.Password).Text;

            HttpClient  client  = new HttpClient();
            HttpContent content = new FormUrlEncodedContent(new[] {
                new KeyValuePair <string, string>("gebruikersnaam", gebruikersnaam),
                new KeyValuePair <string, string>("wachtwoord", wachtwoord),
            });
            HttpResponseMessage response = await client.PostAsync(url, content);

            string result = await response.Content.ReadAsStringAsync();

            if (result != "-1" && result != null)
            {
                DatabaseLogin dbl = new DatabaseLogin(this);
                dbl.Login(result);
                DatabaseZorgmoment dbz = new DatabaseZorgmoment(this);
                dbz.UpdateZorgmomenten();
                Database db = new Database(this);
                db.DownloadData(result);
                StartActivity(typeof(Home));
            }
            else
            {
                FindViewById <TextView>(Resource.Id.FlashText).Text = "Foutieve gebruikersnaam en/of wachtwoord";
                FindViewById <EditText>(Resource.Id.Username).Text  = "";
                FindViewById <EditText>(Resource.Id.Password).Text  = "";
            }
        }
示例#2
0
        public void Logout(object sender, EventArgs e)
        {
            DatabaseLogin dbl = new DatabaseLogin(this);

            dbl.Logout();
            StartActivity(typeof(Login));
        }
示例#3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Database db = new Database(this);

            db.CreateDatabase();

            DatabaseLogin      dbl = new DatabaseLogin(this);
            DatabaseZorgmoment dbz = new DatabaseZorgmoment(this);

            if (dbl.CheckLogin())
            {
                gebruiker = dbl.GetGebruiker();
                dbz.UpdateZorgmomenten();
                db.DownloadData(gebruiker.id.ToString());
                StartActivity(typeof(Home));
            }
            else
            {
                StartActivity(typeof(Login));
            }
        }