Пример #1
0
        //public static void GetCurrentStateVariables(QAMgr QABot)
        //{
        //    AppStateInfo asi = new AppStateInfo(QABot.QuestionCount,QABot.ExerciseCount);
        //}

        public static void SaveCurrrentStateVariables(AppStateInfo asi)
        {
            DataContractSerializer dcs = new DataContractSerializer(typeof(AppStateInfo));

            using (FileStream fs = new FileStream(_appDataFileName, FileMode.Create))
            {
                dcs.WriteObject(fs, asi);
            }
        }
Пример #2
0
 private void InitializeLoadedState(AppStateInfo loadedState)
 {
     if (string.Compare(loadedState.CurrentState, "RetakeState") == 0)
     {
         _currentAppState = new RetakeState(this);
         QABot.FailedQuestions = loadedState.FailedQuestionsList;
     }
     else if (string.Compare(loadedState.CurrentState, "NormalState") == 0)
     {
         _currentAppState = new NormalState(this);
     }
     QABot.ExerciseCount = loadedState.CurrentExerciseNo;
     QABot.QuestionCount = loadedState.CurrentQuestionNo;
     QABot.SavedAnswers = loadedState.SavedAnswers;
     _currentAppState.InitializeNew();
 }