Esempio n. 1
0
        public AnswerDialogViewModel(ObservableCollection <SpellingViewModel> spellTests,
                                     ISpeachService speachService)
        {
            _spellTestService = new SpellTestService(spellTests, speachService);
            _speachService    = speachService;

            CurrentSpelling = _spellTestService.NextQuestion();

            RequestSpelling(CurrentSpelling);


            AnswerCommand = new RelayCommand <Window>(OnAnswer, CanAnswer);
            SkipCommand   = new RelayCommand <Window>(OnSkip, CanSkip);
            QuitCommand   = new RelayCommand <Window>(OnQuit);
            RepeatCommand = new RelayCommand(OnRepeat, CanRepeat);
        }
        public VocabularyItemDialogViewModel(Action <VocabularyRecord> onSaveItem)

        {
            Question        = question;
            this.onSaveItem = onSaveItem;

            translationService = ViewModelLocator.Resolve <ITranslationService>();
            speachService      = ViewModelLocator.Resolve <ISpeachService>();

            SaveCommand   = new RelayCommand(SaveCommandHandler, () => Question != null);
            CancelCommand = new RelayCommand(() => { Close(); });

            TranslateForeignCommand = new RelayCommand(TranslateForeignCommandHandler, () => Question != null);
            TranslateNativeCommand  = new RelayCommand(TranslateNativeCommandHandler, () => Question != null);

            SpeakForeignCommand = new RelayCommand(SpeakForeignCommandHandler);
            SpeakNativeCommand  = new RelayCommand(SpeakNativeCommandHandler);
        }
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public VocabularyListViewModel(IDataService dataService, IDialogService dialogService)
        {
            this.dataService   = dataService;
            this.dialogService = dialogService;

            this.speachService = ViewModelLocator.Resolve <ISpeachService>();

            QuestionList = new ObservableCollection <VocabularyRecordViewModel>();

            AddCommand               = new RelayCommand(AddCommandHandler);
            EditCommand              = new RelayCommand(EditCommandHandler, () => VocabularyItem != null);
            SaveCommand              = new RelayCommand(SaveCommandHandler);
            RefreshCommand           = new RelayCommand(RefreshCommandHandler);
            DelCommand               = new RelayCommand(DeleteCommandHandler, () => VocabularyItem != null);
            ParseFileCommand         = new RelayCommand(ParseFileCommandHandler, () => QuestionList.Count == 0);
            TranslateSelectedCommand = new RelayCommand(TranslateSelectedCommandHandler);

            RaiseCanExecuteChanged();
        }
Esempio n. 4
0
        public AnswerViewModel(int spellTestId,
                               ObservableCollection <SpellingViewModel> spellTests,
                               ISpeachService speachService,
                               ConnectedRepository repo)
        {
            _spellTestId      = spellTestId;
            _spellTestService = new SpellTestService(spellTests, speachService);
            _speachService    = speachService;
            _repo             = repo;
            _spellTests       = spellTests;

            CurrentSpelling = _spellTestService.NextQuestion();

            RequestSpelling(CurrentSpelling);

            AnswerCommand = new RelayCommand <Window>(OnAnswer, CanAnswer);
            SkipCommand   = new RelayCommand <Window>(OnSkip, CanSkip);
            QuitCommand   = new RelayCommand <Window>(OnQuit);
            RepeatCommand = new RelayCommand(OnRepeat, CanRepeat);
        }
 public TrainingController(ICardService cardService, ISpeachService speachService, IDeckService deckService)
 {
     _cardService   = cardService;
     _speachService = speachService;
     _deckService   = deckService;
 }
Esempio n. 6
0
 public SpellTestService(ObservableCollection <SpellingViewModel> questions, ISpeachService speachService)
 {
     Questions      = questions;
     _speachService = speachService;
 }