标签:
private void Btn_Click(object sender, EventArgs e) { var u = FindViewById<EditText>(Resource.Id.editText1).Text; var p = FindViewById<EditText>(Resource.Id.editText2).Text; var progressDialog = ProgressDialog.Show(this, "Please wait...", "Checking account info...", true); var t=new Thread(new ThreadStart(delegate { var r = Api.CheckUser(u, p); if (r.HasValue) { RunOnUiThread(() => progressDialog.Hide()); AppConfig.Config.SetNowUserId(r.Value); StartActivity(typeof(MainActivity)); Finish(); } else { RunOnUiThread(() => Toast.MakeText(this, "用户名或密码错误", ToastLength.Long).Show()); RunOnUiThread(() => progressDialog.Hide()); } })); t.Start(); }
把loading框显示出来,然后开新线程做事,之后关闭loading框
标签:
原文地址:http://www.cnblogs.com/czcz1024/p/4569764.html