示例#1
0
 static void Main(string[] args)
 {
     Evaluation ev = new Evaluation();
     ev.StartTimeEval();
     for (int i = 0; i < 1000000; i++)
     {
         if (i == 37) i = 38;
     }
     ev.EndTimeEval();
     ev.CorrectFraction = .45846841f;
     ev.typBadania = WyborBadaniaControl.TypBadania.Badanie10;
     ev.SaveToFile("raport");
 }
示例#2
0
        private void NextPhase(object o, EventArgs e)
        {
            switch (CurrentPhase)
            {
                case Phase.Poczatek:
                    {
                        evaluation = new Evaluation {typBadania = (CurrentControl as WyborBadaniaControl).Wynik};
                        var tc = MakeTekst("Wstep", null);
                        Fade(tc);
                        CurrentPhase = Phase.Wstep;
                        tc.ButtonClicked += NextPhase;
                    }
                    break;
                case Phase.Wstep:
                    {
                        TekstComponent tc;
                        switch (evaluation.typBadania)
                        {
                            case WyborBadaniaControl.TypBadania.Badanie5:
                                CurrentPhase = Phase.Zadanie1_Opis;
                                IleSlow = 5;
                                break;
                            case WyborBadaniaControl.TypBadania.Badanie10:
                                CurrentPhase = Phase.Zadanie1_Opis;
                                IleSlow = 10;
                                break;
                            case WyborBadaniaControl.TypBadania.Badanie15:
                                CurrentPhase = Phase.Zadanie1_Opis;
                                IleSlow = 15;
                                break;
                            case WyborBadaniaControl.TypBadania.BadanieK:
                                CurrentPhase = Phase.Zadanie2_Opis;
                                IleSlow = 15;
                                break;
                        }
                        Fade(tc = MakeTekst("Zadanie1", IleSlow));
                        tc.ButtonClicked += NextPhase;
                    }
                    break;
                case Phase.Zadanie1_Opis:
                    {
                        MakeWordList(slowa1, IleSlow);
                        CurrentPhase = Phase.Zadanie1_ListaSlow;
                    }
                    break;
                case Phase.Zadanie1_ListaSlow:
                    {
                        StartGame(slowa1, IleSlow);
                        CurrentPhase = Phase.Zadanie1_Gra;
                    }
                    break;
                case Phase.Zadanie1_Gra:
                    {
                        PlayGame(Phase.Zadanie1_Opis, () =>
                            {
                                var tc2 = MakeTekst("Przerwa", null);
                                Fade(tc2);
                                CurrentPhase = Phase.Przerwa;
                                StartTimer(new TimeSpan(0, 2, 0), () => NextPhase(o, e));
                            });
                    }
                    break;
                case Phase.Przerwa:
                    {
                        TekstComponent tc;
                        IleSlow = 15;
                        Fade(tc = MakeTekst("Zadanie2", 15));
                        tc.ButtonClicked += NextPhase;
                        CurrentPhase = Phase.Zadanie2_Opis;
                    }
                    break;
                case Phase.Zadanie2_Opis:
                    {
                        MakeWordList(slowa2, 15);
                        evaluation.StartTimeEval();
                        CurrentPhase = Phase.Zadanie2_ListaSlow;
                    }
                    break;
                case Phase.Zadanie2_ListaSlow:
                    {
                        StartGame(slowa2, 15);
                        CurrentPhase = Phase.Zadanie2_Gra;
                    }
                    break;
                case Phase.Zadanie2_Gra:
                    {
                        PlayGame(Phase.Zadanie2_Opis, () =>
                            {
                                var tc = MakeTekst("Zadanie3", null);
                                Fade(tc);
                                tc.ButtonClicked += NextPhase;
                                CurrentPhase = Phase.Zadanie3_Opis;
                                evaluation.EndTimeEval();
                            });
                    }
                    break;
                case Phase.Zadanie3_Opis:
                    {
                        StartTimer(new TimeSpan(0,2,0), () =>
                            {
                                var tc = MakeTekst("Zadanie4", evaluation.typBadania == WyborBadaniaControl.TypBadania.BadanieK?1:2);
                                Fade(tc);
                                CurrentPhase = Phase.Zadanie4_Opis;
                                tc.ButtonClicked += NextPhase;
                            });
                        CurrentPhase = Phase.Zadanie3_Gra;
                        NextPhase(o, e);
                    }
                    break;
                case Phase.Zadanie3_Gra:
                    {
                        Random rand = new Random();
                        int min = int.Parse(xnav.SelectSingleNode("TekstyBadania/Zadanie3/Min/text()").Value);
                        int max = int.Parse(xnav.SelectSingleNode("TekstyBadania/Zadanie3/Max/text()").Value);

                        string[] sgns = {"-", "+", "*"};

                        string query = String.Format("{0} \t {1} \t {2} \t =", rand.Next(min, max), sgns[rand.Next(sgns.Length)], rand.Next(min, max));

                        var tc = new TekstComponent(query, "Dalej", "0");
                        Fade(tc);
                        tc.ButtonClicked += NextPhase;
                    }
                    break;
                case Phase.Zadanie4_Opis:
                    {
                        var rand = new Random();
                        var tc = new KoncowyTest(slowa2.OrderBy((st) => rand.Next()).ToList());
                        StartTimer(new TimeSpan(0, 2, 0), () =>
                        {
                            var tkon = MakeTekst("Koniec", null);
                            Fade(tkon);
                            evaluation.CorrectFraction = tc.GetPercentage();
                            evaluation.SaveToFile("raport");
                            CurrentPhase = Phase.Koniec;
                        });
                        Fade(tc);
                    }
                    break;
                case Phase.Koniec:
                    break;
            }
        }