Beispiel #1
0
 private static void ReadTheXml()
 {
     System.Xml.XmlReaderSettings oSettings = new System.Xml.XmlReaderSettings();
     oSettings.IgnoreComments = true;
     oSettings.IgnoreWhitespace = true;
     System.Xml.XmlReader oXmlReader = System.Xml.XmlReader.Create(sPathToXml, oSettings);
     Tester oTester = new Tester();
     while (oXmlReader.Read())
     {
         if (oXmlReader.NodeType == System.Xml.XmlNodeType.EndElement)
         {
             if (oXmlReader.Name == "test")
             {
                 oHashtable.Add(oTester.Id, oTester);
                 oTester = new Tester();
             }
         }
         else
         {
             if (oXmlReader.Name == "id")
             {
                 oTester.Id = oXmlReader.ReadString().Trim();
             }
             else if (oXmlReader.Name == "group")
             {
                 oTester.Group = int.Parse(oXmlReader.ReadString().Trim());
             }
             else if (oXmlReader.Name == "gender")
             {
                 oTester.Gender = oXmlReader.ReadString().Trim();
             }
             else if (oXmlReader.Name == "familiar_name")
             {
                 oTester.familiar_name = oXmlReader.ReadString().Trim();
             }
             else if (oXmlReader.Name == "unfamiliar_name")
             {
                 oTester.unfamiliar_name = oXmlReader.ReadString().Trim();
             }
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// this function is being called when we are out of a screen, and want to go to the next one
        /// </summary>
        private void GotoNextScreen()
        {
            if (iScreenIndex == 0)
            {
                // get id, search for it.
                try
                {
                    oCurrentTester = Testers.GetTester(((Screen1Opening)Screens[0]).IdNumber);
                    if (oCurrentTester == null)
                    {
                        MessageBox.Show(TextsGlobal.GetText("ErrorIdNotExist"));
                    }
                    else
                    {
                        /*if (oCurrentTester.Group == 1)
                        {
                            currentUserScreensIndexes = group1ScreenOrder;
                        }
                        else
                        {
                            currentUserScreensIndexes = group2ScreenOrder;
                        }
                         */
                        // Guy: removed group 1 screen order

                        currentUserScreensIndexes = group2ScreenOrder;

                        if (oCurrentTester.Gender == "female")
                        {
                            Texts.PathToXml = "xml/Texts_female.xml";
                            ((Screen8SheelonZminut)Screens[7]).XMLPath = "xml/Sheelon_female.xml";
                            ((Screen11Thunot)Screens[12]).XMLPath = "xml/Thunot_female.xml"; //Guy: set Thunot xml name
                        }
                        else
                        {
                            Texts.PathToXml = "xml/Texts_male.xml";
                            ((Screen8SheelonZminut)Screens[7]).XMLPath = "xml/Sheelon_male.xml";
                            ((Screen11Thunot)Screens[12]).XMLPath = "xml/Thunot_male.xml"; //Guy: set Thunot xml name
                        }

                        // add data to logger
                        oResultsLogger.familiar_name = oCurrentTester.familiar_name;
                        oResultsLogger.Gender = oCurrentTester.Gender;
                        oResultsLogger.Group = oCurrentTester.Group;
                        oResultsLogger.Id = oCurrentTester.Id;
                        oResultsLogger.unfamiliar_name = oCurrentTester.unfamiliar_name;
                        oResultsLogger.oTesterDatetime = DateTime.Now;

                        // goto next screen
                        iScreenIndex++;
                        LoadScreen(currentUserScreensIndexes[iScreenIndex]);
                    }
                }
                catch (Exception ex)
                {
                }
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 2)
            {
                oResultsLogger.screen2_ChosenArachim = ((Screen2KtivaAlArachim)Screens[1]).ChosenArachim;
                oResultsLogger.screen2_notes = ((Screen2KtivaAlArachim)Screens[1]).Notes;

                // goto next screen
                iScreenIndex++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 3)
            {
                iHatramaNumber++;
                // goto next screen
                iScreenIndex++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 4)
            {
                if (iCurrentHatrama == 1)
                {
                    oResultsLogger.screen4Hatrama_result = ((Screen4Hatrama)Screens[3]).Result;
                }
                else if (iCurrentHatrama == 2)
                {
                    oResultsLogger.screen4Hatrama_again_result = ((Screen4Hatrama)Screens[3]).Result;
                }

                // goto next screen
                iScreenIndex++;
                iCurrentHatrama++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 12) // Hatrama end
            {
                if (iCurrentHatrama == 2) // after 1st hatrama
                {
                    oResultsLogger.screenHatramaEnd_1_Answer1 = ((ScreenHatramaEnd)Screens[11]).Answer1;
                    oResultsLogger.screenHatramaEnd_1_Answer2 = ((ScreenHatramaEnd)Screens[11]).Answer2;
                    oResultsLogger.screenHatramaEnd_1_Answer3 = ((ScreenHatramaEnd)Screens[11]).Answer3;
                }
                if (iCurrentHatrama == 3) // after 2nd hatrama
                {
                    oResultsLogger.screenHatramaEnd_2_Answer1 = ((ScreenHatramaEnd)Screens[11]).Answer1;
                    oResultsLogger.screenHatramaEnd_2_Answer2 = ((ScreenHatramaEnd)Screens[11]).Answer2;
                    oResultsLogger.screenHatramaEnd_2_Answer3 = ((ScreenHatramaEnd)Screens[11]).Answer3;
                }
                // goto next screen
                iScreenIndex++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 5)
            {
                oResultsLogger.screen5MathIntro_Gender = ((Screen5MathIntro)Screens[4]).Gender;
                // goto next screen
                iScreenIndex++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 6)
            {
                if (iCurrentMathTestNum == 1)
                {
                    oResultsLogger.screen6Math_1_result = ((Screen6Math)Screens[5]).Result;
                }
                else if (iCurrentMathTestNum == 2)
                {
                    oResultsLogger.screen6Math_2_result = ((Screen6Math)Screens[5]).Result;
                }

                // goto next screen
                iScreenIndex++;
                iCurrentMathTestNum++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 7)
            {
                oResultsLogger.screen2_notes_again = ((Screen7Arachim2)Screens[6]).Result;
                // goto next screen
                iScreenIndex++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 8)
            {
                oResultsLogger.screen8Sheelon_result = ((Screen8SheelonZminut)Screens[7]).Result;
                // goto next screen
                iScreenIndex++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 9)
            {
                oResultsLogger.screen9Lexical_result = ((Screen9LexicalDecision)Screens[8]).Result;
                // goto next screen
                iScreenIndex++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 10) // last question
            {
                oResultsLogger.screenLastQuestionYourLanguage = ((ScreenLastQuestion)Screens[9]).Result;
                oResultsLogger.screenLastQuestionYesNo1 = ((ScreenLastQuestion)Screens[9]).YesNo1Result;
                oResultsLogger.screenLastQuestionYesNo2 = ((ScreenLastQuestion)Screens[9]).YesNo2Result;
                oResultsLogger.screenLastQuestionYesNo3 = ((ScreenLastQuestion)Screens[9]).YesNo3Result;
                // goto next screen
                iScreenIndex++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
            else if (currentUserScreensIndexes[iScreenIndex] == 11)
            {
                try
                {
                    oResultsLogger.WriteFile();
                    bWroteFile = true;
                }
                catch { }
                this.Close();
            }
            //Guy: new screen number 13
            else if (currentUserScreensIndexes[iScreenIndex] == 13)
            {

                oResultsLogger.screen13Sheelon_result = ((Screen11Thunot)Screens[12]).Result;
                // goto next screen
                iScreenIndex++;
                LoadScreen(currentUserScreensIndexes[iScreenIndex]);
            }
        }