Exemple #1
0
        void LoadedQuestionsAndAnswers(List <Common.QuestionAndAnswer> list, string fileName)
        {
            if (list == null || list.Count == 0)
            {
                return;
            }

            if (currentMode != TaskModeFactory.Mode.Unknow)
            {
                choicesUserControl.SendClickEvent -= availableTaskModes[currentMode].AnswerArrived;
            }
            FileName = fileName;
            CloseResultViewer();
            foreach (var item in availableTaskModes)
            {
                item.Value.SetQuestionsAndAnswers(list);
            }
            currentMode = TaskModeFactory.Mode.TrainingMode;
            choicesUserControl.SendClickEvent += availableTaskModes[currentMode].AnswerArrived;
            trainingModePanel.IsEnabled        = true;
            raceModePanel.IsEnabled            = true;
            raceModePanel.FilesPath            = System.IO.Path.GetDirectoryName(FileName);
            bodyGrid.Effect          = bodyEffect;
            tabControl.SelectedIndex = 1;
            ChangeRunningState(availableTaskModes[currentMode].ModeName, TaskMode.State.Default);
        }
Exemple #2
0
        private IPanelEventHandler GetIPanelEventHandler(TaskModeFactory.Mode mode)
        {
            switch (mode)
            {
            case TaskModeFactory.Mode.TrainingMode: return(trainingModePanel);

            case TaskModeFactory.Mode.RaceMode: return(raceModePanel);

            default: return(null);
            }
        }
Exemple #3
0
        private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.OriginalSource == tabControl)
            {
                if (currentMode == TaskModeFactory.Mode.Unknow || currentMode == TaskModeFactory.Mode.RaceMode)
                {
                    return;
                }

                if (tabControl.SelectedIndex == 1) //Trainer
                {
                    currentMode = TaskModeFactory.Mode.TrainingMode;
                }
                else if (tabControl.SelectedIndex == 2) //Race
                {
                    currentMode = TaskModeFactory.Mode.RaceMode;
                }
                TaskMode mode = availableTaskModes[currentMode];
                ChangeRunningState(mode.ModeName, TaskMode.State.Default);
            }
        }