public static async Task <Competence> GetCompetenceById(string id) { var httpResponseMessage = await client.GetAsync("http://" + host + "/competences/" + id); if (httpResponseMessage.StatusCode == HttpStatusCode.OK) { var content = httpResponseMessage.Content; var comp = await content.ReadAsAsync <Competence>(); return(comp); } Competence othercomp = new Competence(); return(othercomp); }
public Form3(Competence competence, UserCompetence usercompetence, User user) { this.resources = competence.ressources; this.usercompetence = usercompetence; this.user = user; InitializeComponent(); //Affichage HideRessources(); ShowEvaluation(); //Informations labelCompetence.Text = competence.name; studentnumber = usercompetence.userPercent; labelEvaluationNumberStudent.Text = studentnumber.ToString() + "%"; teachernumber = usercompetence.teacherPercent; labelEvaluationNumberTeacher.Text = teachernumber.ToString() + "%"; //Bouton de validation de compétence if (this.usercompetence.isValidated) { buttonValidCompetence.BackColor = Color.ForestGreen; buttonValidCompetence.Text = "Invalider la compétence"; if (!(this.user is Teacher)) { buttonValidCompetence.Text = "Validée"; } } else { buttonValidCompetence.BackColor = Color.Firebrick; buttonValidCompetence.Text = "Valider la compétence"; if (!(this.user is Teacher)) { buttonValidCompetence.Text = "En attente de validation"; } } if (this.user is Teacher) { trackBarStudent.Value = Convert.ToInt32(teachernumber); } else { trackBarStudent.Value = Convert.ToInt32(studentnumber); buttonValidCompetence.Enabled = false; } this.usercompetence.doclist.ForEach((elem) => { listBoxProof.Items.Add(elem.link); }); //Ajout des ressource dans listBoxResources foreach (Resource res in competence.ressources) { listBoxResources.Items.Add(res.title); } //Pour éviter probleme si une listbox est vide if (resources.Count != 0) { listBoxResources.SelectedIndex = 0; } }