public ExamenRespuestaParejasViewModel() { preguntasExamen = new List <PreguntaParejaRespuesta>(); posicion = -1; tiempoTranscurrido = new Stopwatch(); servicioExamen.getExanenCompletado += (s, a) => { preguntasExamen = a.preguntas.Cast <PreguntaParejaRespuesta>().ToList(); if (preguntasExamen.Count != 0) { PreguntaMostrada = preguntasExamen[0]; posicion = 0; } NumeroPregunta = 1 + "/" + preguntasExamen.Count; respuestas = new List <int[]>(); colorBotones = new SolidColorBrush[preguntasExamen.Count, 6]; for (int i = 0; i < preguntasExamen.Count; i++) { respuestas.Add(new int[6]); //Pongo el fondo de los botones transparente. for (int j = 0; j <= 5; j++) { colorBotones[i, j] = new SolidColorBrush(Colors.Transparent); respuestas[i][j] = 0; } } }; }
public void anteriorPregunta() { if (posicion > 0) { posicion--; PreguntaMostrada = preguntasExamen[posicion]; ColorBoton1 = colorBotones[posicion, 0]; ColorBoton2 = colorBotones[posicion, 1]; ColorBoton3 = colorBotones[posicion, 2]; ColorBoton4 = colorBotones[posicion, 3]; ColorBoton5 = colorBotones[posicion, 4]; ColorBoton6 = colorBotones[posicion, 5]; NumeroPregunta = (posicion + 1) + "/" + preguntasExamen.Count; } }
public void siguientePregunta() { if (posicion < preguntasExamen.Count - 1 && posicion != -1) { posicion++; PreguntaMostrada = preguntasExamen[posicion]; ColorBoton1 = colorBotones[posicion, 0]; ColorBoton2 = colorBotones[posicion, 1]; ColorBoton3 = colorBotones[posicion, 2]; ColorBoton4 = colorBotones[posicion, 3]; ColorBoton5 = colorBotones[posicion, 4]; ColorBoton6 = colorBotones[posicion, 5]; NumeroPregunta = (posicion + 1) + "/" + preguntasExamen.Count; } }