private MathGate[] findMathGates() { CoolIt_Service.MathGate[] rawMathGates = webService.GetMathGates(); MathGate[] answer = new MathGate[rawMathGates.Length]; for (int i = 0; i < rawMathGates.Length; i++) { CoolIt_Service.MathGate rawGate = rawMathGates[i]; MathGateProblem[] problems = new MathGateProblem[rawGate.Problems.Length]; for (int j = 0; j < rawGate.Problems.Length; j++) { CoolIt_Service.MathGateProblem rawProblem = rawGate.Problems[j]; problems[j] = new MathGateProblem(rawProblem.Description, rawProblem.CorrectAnswer, rawProblem.PrecisionRequired); } CAPABILITY cap; switch (rawGate.Capability) { case DesktopClient.CoolIt_Service.CAPABILITY.CP_VS_HEAT_LEAK_GRAPH: cap = CAPABILITY.CP_VS_HEAT_LEAK_GRAPH; break; default: throw new Exception("Unexpteded capability found"); } answer[i] = new MathGate(rawGate.Name, rawGate.ID, problems, cap); } return(answer); }
public MathGate[] GetMathGates() { MathGate[] answer = new MathGate[mathGates.Count]; for (int i = 0; i < mathGates.Count; i++) { answer[i] = (MathGate)mathGates[i]; } return(answer); }
public MathGateQuiz(MathGate gate) { InitializeComponent(); problems = new ProblemAndAnswer[gate.Problems.Length]; for (int i = 0; i < problems.Length; i++) { problems[i] = new ProblemAndAnswer(gate.Problems[i]); } bindingSource = new BindingSource(); bindingSource.DataSource = problems; navigator.BindingSource = bindingSource; descriptionTextBox.DataBindings.Add("Text", bindingSource, "Description"); precisionTextBox.DataBindings.Add("Text", bindingSource, "PrecisionRequired"); answerTextBox.DataBindings.Add("Text", bindingSource, "ProposedAnswer"); }