private async void GetAllProjectsFromWebApi_OnClicked(object sender, EventArgs e) { ProjectsController jc = new ProjectsController(); IEnumerable<Project> projects = await jc.GetProjectsBasedOnFilter(); if (!Authenticater.Authorized) { GoToLogin(); } if (projects != null) { System.Diagnostics.Debug.WriteLine("GetJobsBasedOnFilter: jobs.Count(): " + projects.Count()); } }
private async void TestProjectsFilter_OnClicked(object sender, EventArgs e) { List<string> studyGroups = new List<string>(); string helse = Hasher.Base64Encode("helse"); string datateknologi = Hasher.Base64Encode("datateknologi"); studyGroups.Add(helse); studyGroups.Add(datateknologi); //LEGG FAGOMRÅDER TIL AKTIVT FILTER HER MED EN SWITCH ELLER LIGNENDE Dictionary<string, string> filter = new Dictionary<string, string>(); string DAT304 = Hasher.Base64Encode("DAT-304"); string virksomhet = Hasher.Base64Encode("virksomhet"); filter.Add("courses", DAT304); filter.Add("types", virksomhet); ProjectsController jc = new ProjectsController(); IEnumerable<Project> projects = await jc.GetProjectsBasedOnFilter(studyGroups, filter); if (!Authenticater.Authorized) { GoToLogin(); } if (projects != null) { System.Diagnostics.Debug.WriteLine("GetProjectsBasedOnFilter: projects.Count(): " + projects.Count()); foreach (var project in projects) { System.Diagnostics.Debug.WriteLine("Companies is not null: " + project.companies[0].id); System.Diagnostics.Debug.WriteLine("Companies is not null: " + project.companies[0].name); System.Diagnostics.Debug.WriteLine("Companies is not null: " + project.companies[0].logo); } } }
//public Dictionary<string, string> GetCourse() //{ // foreach (Course course in listInit.coursesSettings) // { // object itemname = OppgaverEmner.SelectedItem; // string i = itemname.ToString(); // if (course.name == i) { // listInit.coursesFilter.Add("courses", course.id); // System.Diagnostics.Debug.WriteLine("ITEMNAME TOSTRING DOES NOT WORK::::: " + i); // } // else // { // System.Diagnostics.Debug.WriteLine("ITEMNAME TOSTRING PRODUCES STRING::::: " + i); // } // } // return listInit.coursesFilter; //} //void OnSelection(object sender, SelectedItemChangedEventArgs e) //{ // if (e.SelectedItem == null) // { // return; //ItemSelected is called on deselection, which results in SelectedItem being set to null // } // DisplayAlert("Item Selected", e.SelectedItem.ToString(), "Ok"); // //((ListView)sender).SelectedItem = null; //uncomment line if you want to disable the visual selection state. //} private async Task AddData() { //Dictionary<string, string> filter = new Dictionary<string, string>(); //contains only one item from each group //filter.Add("courses", "DAT-304"); //filter.Add("types", "virksomhet"); //if (pullList == false) //{ //} //else if (pullList == true) //{ ProjectsController jc = new ProjectsController(); IEnumerable<Project> projects = await jc.GetProjectsBasedOnFilter(listInit.GetSettings(), null); HashSet<Project> newProjects = new HashSet<Project>(projects); HashSet<Project> oldProjects = new HashSet<Project>(oppgaver); bool sameProjects = newProjects.SetEquals(oldProjects); if (!sameProjects) { //OppgaveList.ItemsSource = null; oppgaver.Clear(); foreach (Project project in projects) { System.Diagnostics.Debug.WriteLine("project.title: " + project.title); oppgaver.Add(project); } //OppgaveList.ItemsSource = oppgaver; } if (!Authenticater.Authorized) { GoToLogin(); } }