private void Form2_Load(object sender, EventArgs e) { //Cargando el archivo Json de configuración de la autoevaluación this.miAutoeva = this.LoadJson(); this.Text = this.miAutoeva.Nombre; this.lbl_nro.Text = this.preguntaActual.ToString(); this.btn_izq.Enabled = false; this.btn_der.Enabled = false; this.btn_fin.Enabled = false; //Cargo los alumnos foreach (Alumno alu in this.miAutoeva.Alumnos) { this.cmb_alumnos.Items.Add(alu.Nombre + ", " + alu.Apellido); } }
private Autoevaluacion LoadJson() { Autoevaluacion preguntas = new Autoevaluacion(); try { using StreamReader r = new StreamReader("autoeva.json"); string json = r.ReadToEnd(); //dynamic array = JsonConvert.DeserializeObject(json); preguntas = JsonConvert.DeserializeObject <Autoevaluacion>(json); } catch (Exception e) { Console.WriteLine(e); } return(preguntas); }