コード例 #1
0
        public TrainingViewModel()
        {
            _viewModels = new[]
            {
                new TrainingStepViewModel(5),
                new TrainingStepViewModel(8),
                new TrainingStepViewModel(9)
            };
            _horizontalControls = new ITrainingStep[]
            {
                new HPreparation {
                    DataContext = _viewModels[0]
                },
                new HPerformanceTest {
                    DataContext = _viewModels[1]
                },
                new HFrequencyCheck {
                    DataContext = _viewModels[2]
                }
            };
            _verticalControls = new ITrainingStep[]
            {
                new VPreparation {
                    DataContext = _viewModels[0]
                },
                new VPerformanceTest {
                    DataContext = _viewModels[1]
                },
                new VFrequencyCheck {
                    DataContext = _viewModels[2]
                }
            };

            _message = GetMessageBoxParameters("Preparation.Begin");

            _openNextStepCommand = new SimpleCommand(() => CurrentStep++,
                                                     () => _currentStep < _horizontalControls.Length && _currentStep < _maxStep);
            _openPrevStepCommand      = new SimpleCommand(() => CurrentStep--, () => _currentStep > 1);
            _changeOrientationCommand = new SimpleCommand(() => Orientation =
                                                              Orientation == Orientation.Horizontal
                                ? Orientation.Vertical
                                : Orientation.Horizontal);

            _radioViewModel = new RadioViewModel();
            _radioViewModel.Model.SetWrongInitialState();

            _learning         = new LearningBl(_radioViewModel.Model, Learning_Completed, Learning_StepChanged, _horizontalControls[0].Type);
            _startOverCommand = new SimpleCommand(StartOver);

            _maxStep    = 1;
            CurrentStep = 1;
            Orientation = Orientation.Horizontal;
        }
コード例 #2
0
        public TasksViewModel()
        {
            Message = GetMessageBoxParameters("Begin");

            var option = App.ServiceCollection.Resolve <ActionDescriptionOption>();

            _keyboardHandler = App.ServiceCollection.Resolve <KeyboardHandler>();


            _taskViewModels = new Dictionary <TaskTypes, TaskViewModel>
            {
                { TaskTypes.PreparationToWork, new TaskViewModel(option.Tasks.PreparationToWork.Title, () => StartTask(TaskTypes.PreparationToWork)) },
                { TaskTypes.PerformanceTest, new TaskViewModel(option.Tasks.HealthCheck.Title, () => StartTask(TaskTypes.PerformanceTest)) },
                { TaskTypes.FrequencyTask, new TaskViewModel(option.Tasks.WorkingFrequencyPreparation.Title, () => StartTask(TaskTypes.FrequencyTask)) },
                { TaskTypes.ConnectionEasy, new TaskViewModel(option.Tasks.ConnectionEasy.Title, StartTaskWithNetwork) },
                //{ TaskTypes.ConnectionHard, new TaskViewModel(option.Tasks.ConnectionHard.Title, StartTaskWithNetwork)},
            };
            _tasks = new[]
            {
                _taskViewModels[TaskTypes.PreparationToWork],
                _taskViewModels[TaskTypes.PerformanceTest],
                _taskViewModels[TaskTypes.FrequencyTask],
                _taskViewModels[TaskTypes.ConnectionEasy],
                //_taskViewModels[TaskTypes.ConnectionHard],
            };
            _stopTaskCommand = new SimpleCommand(StopTask);
            RadioViewModel   = new RadioViewModel();

            var networkTaskManager  = App.ServiceCollection.Resolve <INetworkTaskManager>();
            var networkTaskListener = App.ServiceCollection.Resolve <INetworkTaskListener>();

            _tasksBl = new TasksBl(RadioViewModel.Model, networkTaskManager, networkTaskListener);

            _taskService = App.ServiceCollection.Resolve <ITaskService>();

            _taskService.TaskCreated += TaskService_TaskCreated;
            _taskService.TaskStarted += TaskService_TaskStarted;
        }