码迷,mamicode.com
首页 > 移动开发 > 详细

vs xamarin android 读取

时间:2015-06-11 18:42:02      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:

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框

vs xamarin android 读取

标签:

原文地址:http://www.cnblogs.com/czcz1024/p/4569764.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!