public frmMain() { InitializeComponent(); mMessageLogger = new MessageLogger(); mChatManager = new ChatManager(); mUserManager = new UserManager(mMessageLogger); mQuestionManager = new QuestionManager(mUserManager); mAnswerManager = new AnswerManager(); mIOProcessor = new IOProcessor(mMessageLogger, mUserManager, mQuestionManager, mAnswerManager, mChatManager); //mIOProcessor = new IOProcessor(mMessageLogger, mUserManager); mNetwork = new Network(mMessageLogger, mUserManager, mQuestionManager, mAnswerManager, mIOProcessor); // Load the registered tutors if (!mUserManager.LoadTutors("tutors.xml")) { mMessageLogger.NewMessage("Can't load file \"tutors.xml\" or the contents in it. " + "Please use the admin tool to recreate it", mMessageLogger.MESSAGE_ERROR); } mUser = new User(); mRunning = true; mDictionarySerialiser = new DictionarySerialiserMethods(); // Attempt to load questions from the questions.xml file if (LoadQuestions("questions.xml") == false) { // Add some demo questions if none could be loaded from a file question iDemoQuestion = new question(); // Multi-choice iDemoQuestion.QuestionID = 0; iDemoQuestion.Question = "How many days in a week?"; iDemoQuestion.QuestionType = "MC"; iDemoQuestion.PossibleAnswers = new string[4] { "Ten", "Three", "Seven", "Nine" }; iDemoQuestion.Answer = "Seven"; mQuestionManager.AddNewQuestion(iDemoQuestion); // True/False iDemoQuestion = new question(); iDemoQuestion.QuestionID = 1; iDemoQuestion.Question = "Fire burns?"; iDemoQuestion.QuestionType = "TF"; iDemoQuestion.PossibleAnswers = new string[4] { "True", "False", "", "" }; iDemoQuestion.Answer = "True"; mQuestionManager.AddNewQuestion(iDemoQuestion); // Short Answer iDemoQuestion = new question(); iDemoQuestion.QuestionID = 2; iDemoQuestion.Question = "What is 5x5?"; iDemoQuestion.QuestionType = "SA"; iDemoQuestion.PossibleAnswers = new string[4] { "", "", "", "" }; iDemoQuestion.Answer = ""; mQuestionManager.AddNewQuestion(iDemoQuestion); } mTimer = new System.Timers.Timer(1000); mTimer.Elapsed += new ElapsedEventHandler(TimeElapsed); mTimer.Enabled = true; }