async void LoadData() { progress.Visibility = ViewStates.Visible; progress.Indeterminate = true; List<LichThi> list = new List<LichThi>(); var t=await BLichThi.MakeDataFromXml( SQLite_Android.GetConnection()); list = BLichThi.getAll (SQLite_Android.GetConnection ()); List<User> l = new List<User> (); System.Diagnostics.Debug.WriteLine("size: " + list.Count); l.Add(BUser.GetUser (SQLite_Android.GetConnection (),"1111")); LichThiAdapter adapter = new LichThiAdapter(Activity, list); listView.Adapter = adapter; progress.Indeterminate = false; progress.Visibility = ViewStates.Gone; }
public async void LoadData() { progress.Visibility = ViewStates.Visible; progress.Indeterminate = true; list = new List<LichThi>(); if (Common.checkNWConnection (Activity) == true && autoupdate == true&&isfirst) { var newlistlt= BLichThi.MakeDataFromXml (SQLite_Android.GetConnection ()); List<LichThi> newListLT= await newlistlt; if (newListLT == null) { Toast.MakeText (Activity, "Xảy ra lỗi trong quá trình cập nhật dữ liệu từ server", ToastLength.Long).Show (); } else { if (check) { ScheduleReminder reminder = new ScheduleReminder (Activity); await reminder.RemindAllLT (newListLT); } } } list = BLichThi.GetNewestLT (SQLite_Android.GetConnection ()); //list = BLichThi.getAll (SQLite_Android.GetConnection ()); if (list.Count > 0) { linear.Visibility = ViewStates.Visible; txtNotify.Visibility = ViewStates.Gone; LichThiAdapter adapter = new LichThiAdapter (Activity, list); rootView.FindViewById<TextView> (Resource.Id.txtHocKy).Text = "Học Kỳ " + list [0].HocKy + " Năm Học " + list [0].NamHoc; listView.Adapter = adapter; isfirst = false; } else { linear.Visibility = ViewStates.Gone; txtNotify.Visibility = ViewStates.Visible; txtNotify.Text = "Hiện tại lịch thi chưa có dữ liệu. Xin vui lòng thử lại sau!!!"; } progress.Visibility = ViewStates.Gone; progress.Indeterminate = false; }