private async void GetStudentView() { await GetStudentNumPastQs(); if (numpastqs == 0) { NoQsPresent fragment = new NoQsPresent(); Bundle arguments = new Bundle(); arguments.PutString("Sender", "PastQs"); fragment.Arguments = arguments; Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction(); trans.Replace(Resource.Id.qs_root_frame, fragment); trans.Commit(); } else { Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction(); trans.Replace(Resource.Id.qs_root_frame, new Fragments.StudentPastQs()); trans.Commit(); } }
private async void PopulateList() { progressBar.Visibility = ViewStates.Visible; string fileName_myQs = "myqs_" + myAttributes.cfid.ToString() + "_" + myAttributes.typeid.ToString(); string fileName_myCareerFair = myAttributes.cfid.ToString(); var firebase = new FirebaseClient(FirebaseURL); var myQs = await firebase.Child("qs").Child(fileName_myQs).OnceAsync <StudentQ>(); var myCareerFair = await firebase.Child("careerfairs").Child(fileName_myCareerFair).OnceAsync <Company>(); if (myQs.Count == 0) { NoQsPresent fragment = new NoQsPresent(); Bundle arguments = new Bundle(); arguments.PutString("Sender", "CurrentQs"); fragment.Arguments = arguments; Android.Support.V4.App.FragmentTransaction trans = FragmentManager.BeginTransaction(); trans.Replace(Resource.Id.qs_root_frame, fragment); trans.Commit(); } List <string> mItems = new List <string>(); List <int> companyIds = new List <int>(); List <string> mPositions = new List <string>(); List <string> mWaitTimes = new List <string>(); List <bool> favs = new List <bool>(); int position = -1; foreach (var q in myQs) { position = position + 1; mItems.Add(q.Object.company); mPositions.Add(q.Object.position); foreach (var company in myCareerFair) { if (company.Object.name == mItems[position]) { long partialWaitTime = Convert.ToInt64(company.Object.waittime); long totalWaitTime = partialWaitTime * (Convert.ToInt32(mPositions[position]) - 1); // -1 because they are already in the line TimeSpan ts = TimeSpan.FromTicks(totalWaitTime); string waittime = String.Format("{0:00}:{1:00}:{2:00}", ts.Hours, ts.Minutes, ts.Seconds); mWaitTimes.Add(waittime); } } } string fileName_favorites = "fav_" + myAttributes.cfid.ToString() + "_" + myAttributes.typeid.ToString(); var myFavs = await firebase.Child("favorites").Child(fileName_favorites).OnceAsync <Favorite>(); for (int i = 0; i <= mItems.Count - 1; i++) { foreach (var fav in myFavs) { if (mItems[i] == fav.Object.name) { favs.Add(fav.Object.isFavorite); companyIds.Add(Convert.ToInt32(fav.Object.companyid)); } } } QsListViewAdapter adapter = new QsListViewAdapter(mContainer.Context, mItems, "CurrentQs", favs, companyIds, mWaitTimes, mPositions); mListView.Adapter = adapter; progressBar.Visibility = ViewStates.Invisible; }
public static NoQsPresent newInstance() { NoQsPresent fragment = new NoQsPresent(); return(fragment); }