示例#1
0
        public void saveState()
        {
            JObject state = new JObject();

            state.Add(exercises.ExerciseManager.MODULE_NAME, SharedLocator.getExercisesManager().save());
            SaveManager.getInstance().writeSave(state);
        }
示例#2
0
        public void loadState()
        {
            JObject state = SaveManager.getInstance().readSave();

            if (state != null)
            {
                JObject exercisesSave = (JObject)state[exercises.ExerciseManager.MODULE_NAME];
                SharedLocator.getExercisesManager().load(exercisesSave);
            }
        }
示例#3
0
        private void menuButtonCallback(object sender, EventArgs e)
        {
            string exerciseName = (sender as Button).Tag as string;

            if (SharedLocator.getStaticInfo().hasConfig(exerciseName))
            {
                closeThisWindow(false);
                SharedLocator.getExercisesManager().startExercise(exerciseName);
            }
            else
            {
                MessageBox.Show(Properties.Strings.error_cannot_find_config_file, Properties.Strings.error_text);
            }
        }
示例#4
0
        private void continueLoading()
        {
            SharedLocator.setStaticInfo(new StaticInfo());
            SharedLocator.setExercisesManager(new exercises.ExerciseManager());

            loadState();
            if (_preloaderScreen != null)
            {
                _preloaderScreen.Close();
                _preloaderScreen.Dispose();
            }
            showTasksWindow();
            ApplicationUpdateHelper.checkForTheNewVersion();
        }
示例#5
0
        private List <VariantWordInfo> prepareMaterial()
        {
            JObject config     = SharedLocator.getStaticInfo().getVariantExerciseConfig();
            JArray  wordsArray = (JArray)config[VariantWordInfo.KEY_CONTENTS];

            List <VariantWordInfo> ret = new List <VariantWordInfo>(wordsArray.Count);

            foreach (JObject obj in wordsArray)
            {
                VariantWordInfo info = VariantWordInfo.createFromDict(obj);
                if (!_sectionsList.ContainsKey(info.section))
                {
                    _sectionsList.Add(info.section, Properties.Strings.ResourceManager.GetString(string.Format(VARIANT_SECTION_NAME_TEMPLATE, info.section)));
                }
                ret.Add(info);
            }

            return(ret);
        }
示例#6
0
        public List <AccentWordInfo> prepareMaterial()
        {
            List <AccentWordInfo> ret = new List <AccentWordInfo>();

            JObject config     = SharedLocator.getStaticInfo().getAccentsExerciseConfig();
            JArray  wordsArray = (JArray)config[KEY_CONTENTS];

            ret.Capacity = wordsArray.Count;
            foreach (JObject obj in wordsArray)
            {
                AccentWordInfo wordInfo = new AccentWordInfo(obj);
                ret.Add(wordInfo);
                if (!_sectionsList.ContainsKey(wordInfo.section))
                {
                    _sectionsList.Add(wordInfo.section, Properties.Strings.ResourceManager.GetString(string.Format(ACCENTS_SECTION_NAME_TEMPLATE, wordInfo.section)));
                }
            }
            _sectionsList.Add(Constants.EXERCISE_SECTION_EVERYTHING, Properties.Strings.section_name_shuffle);

            return(ret);
        }