private async void B_Clicked(object sender, EventArgs e) { b.IsEnabled = false; //Nieuw project toevoegen aan de database ContactDataBase.createProject(ContactDataBase.currentUserName, ContactDataBase.currentToken, nameEntry.Text, descriptionEntry.Text, start.Date); await Navigation.PushAsync(new ProjectsPage((List <Project>)ContactDataBase.GetProjects(ContactDataBase.currentUserName, ContactDataBase.currentToken)), false); //Het verwijderen van de oude pages in de stack for (int counter = 1; counter <= 2; counter++) { Navigation.RemovePage(Navigation.NavigationStack[1]); } }
private async void AddTask(object sender, EventArgs e) { addTask.IsEnabled = false; int projectID; //De nieuwe taak toevoegen aan project in de database try { projectID = saved.projectid; ContactDataBase.addTaskToProject(ContactDataBase.currentUserName, ContactDataBase.currentToken, nameEntry.Text, descriptionEntry.Text, project.projectid, int.Parse(rroeValueEntry.Text), int.Parse(jobSizeEntry.Text), int.Parse(userBusinessValueEntry.Text), int.Parse(timeCriticalityEntry.Text), int.Parse(uncertaintyEntry.Text)); List <Project> projects = (List <Project>)ContactDataBase.GetProjects(ContactDataBase.currentUserName, ContactDataBase.currentToken); foreach (Project project in projects) { if (project.projectid == projectID) { project.Tasks = (List <Task>)ContactDataBase.GetTasks(ContactDataBase.currentUserName, ContactDataBase.currentToken, project.projectid); Sprint s = (Sprint)ContactDataBase.GetSprint(ContactDataBase.currentUserName, ContactDataBase.currentToken, project.projectid); List <Task> tasks = new List <Task>(); foreach (Task t in project.Tasks) { if (s != null && t.sprintid == s.sprintid) { tasks.Add(t); } } if (s != null) { s.Sprinttasks = tasks; project.CurrentSprint = s; } await Navigation.PushAsync(new TabbedPage() { Children = { new ProjectInfoPage(project), new SprintPage(project.CurrentSprint, project.Tasks, project), new NewSprintPage(project), new burndown(project) }, Title = project.projectname }); } } // Het verwijderen van de oude pages in de stack for (int counter = 1; counter <= 2; counter++) { Navigation.RemovePage(Navigation.NavigationStack[2]); } addTask.IsEnabled = true; } //Opvangen error catch { await DisplayAlert(Globals.taakallerttitel, Globals.taakallertmessage, "ok"); addTask.IsEnabled = true; } }
//Refresh de pagina private async void refreshPage() { int projectID = t.projectid; try { List <Project> projects = (List <Project>)ContactDataBase.GetProjects(ContactDataBase.currentUserName, ContactDataBase.currentToken); foreach (Project project in projects) { if (project.projectid == projectID) { project.Tasks = (List <Task>)ContactDataBase.GetTasks(ContactDataBase.currentUserName, ContactDataBase.currentToken, project.projectid); Sprint s = (Sprint)ContactDataBase.GetSprint(ContactDataBase.currentUserName, ContactDataBase.currentToken, project.projectid); List <Task> tasks = new List <Task>(); foreach (Task t in project.Tasks) { if (s != null && t.sprintid == s.sprintid) { tasks.Add(t); } } if (s != null) { s.Sprinttasks = tasks; project.CurrentSprint = s; } await Navigation.PushAsync(new TabbedPage() { Children = { new ProjectInfoPage(project), new SprintPage(project.CurrentSprint, project.Tasks, project), new NewSprintPage(project), new burndown(project) }, Title = project.projectname }); } } // Het verwijderen van de oude pages in de stack for (int counter = 1; counter <= 2; counter++) { Navigation.RemovePage(Navigation.NavigationStack[2]); } } catch { //error opvangen await DisplayAlert(Globals.taakallerttitel, Globals.taakallertmessage, "ok"); } }
private async void ProjectButtonClicked(object sender, EventArgs e) { //Animeren van de knop await projectImage.ScaleTo(0.9, 100); await projectImage.ScaleTo(1, 100); var tokenSource2 = new CancellationTokenSource(); //Een nieuwe thread openen await System.Threading.Tasks.Task.Run(() => { List <Project> s = (List <Project>)ContactDataBase.GetProjects(ContactDataBase.currentUserName, ContactDataBase.currentToken); Device.BeginInvokeOnMainThread(() => { //Zet de nieuwe pagina op de stack. Navigation.PushAsync(new ProjectsPage(s)); }); }, tokenSource2.Token); //Sluit de thread af tokenSource2.Cancel(); }