private async void TestGetStudyGroupStudent_OnClicked(object sender, EventArgs e) { StudentsController sc = new StudentsController(); List<StudyGroup> list = await sc.GetStudentsStudyGroupFromServer(); // checks if still Authorized if (!Authenticater.Authorized) { System.Diagnostics.Debug.WriteLine("TestGetStudyGroupStudent inside If: Authorized: " + Authenticater.Authorized); GoToLogin(); } else { System.Diagnostics.Debug.WriteLine("TestGetStudyGroupStudent inside Else: Authorized: " + Authenticater.Authorized); if (list == null) { System.Diagnostics.Debug.WriteLine("Server communication failed"); } System.Diagnostics.Debug.WriteLine("Studygroups.Count: " + list.Count); foreach (var sg in list) { System.Diagnostics.Debug.WriteLine("id: " + sg.id); System.Diagnostics.Debug.WriteLine("name: " + sg.name); } } }
public async Task GetAllFilters() { DbStudyGroup sgc = new DbStudyGroup(); StudentsController sc = new StudentsController(); studyGroupsFilter = sgc.GetAllStudyGroups(); //set checked to false List<StudyGroup> checkedStudyGroups = await sc.GetStudentsStudyGroupFromServer(); // use these to check some to true System.Diagnostics.Debug.WriteLine("studyGroupsFilter.Count: " + studyGroupsFilter.Count); foreach (var sg in studyGroupsFilter) { if (checkedStudyGroups.Contains(sg)) { sg.filterChecked = true; } else { sg.filterChecked = false; } //studyGroupsFilter.Add(sg); } System.Diagnostics.Debug.WriteLine("Another studyGroupsFilter.Count: " + studyGroupsFilter.Count); foreach (var studyGroup in studyGroupsFilter) { studyDict.Add(studyGroup.name, studyGroup.id); } }