Esempio n. 1
0
 private void copyWord(WordViewModel source, WordViewModel dest)
 {
     dest.WordID     = source.WordID;
     dest.Correct    = source.Correct;
     dest.Incorrect  = source.Incorrect;
     dest.OriginName = source.OriginName;
     dest.SecondName = "";
 }
Esempio n. 2
0
        private void SaveWord()
        {
            if (CurrentOptions.CurrentUser != null)
            {
                WordViewModel newWord = new WordViewModel();
                newWord.OriginName = _newWord.OriginName;
                newWord.SecondName = _newWord.SecondName;
                newWord.Incorrect  = _newWord.Incorrect;
                newWord.Correct    = _newWord.Correct;
                newWord.WordID     = _newWord.WordID;

                _dao.addWord(newWord.getWord());
                NewWord = new WordViewModel();
            }
        }
Esempio n. 3
0
        public WordInsertViewModel()
        {
            #if DEBUG
            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                return;
            }
            #endif

            InputNotEmpty = false;
            _dao          = (IDAO)LateBinding.GetDAOConstructor().Invoke(new object[] { });
            NewWord       = new WordViewModel();

            _saveNewWordCommand = new RelayCommand(param => this.SaveWord());
        }
Esempio n. 4
0
        public WordShowViewModel()
        {
            #if DEBUG
            if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                return;
            }
            #endif

            _custom           = false;
            _customPercentage = 0;
            _confirmInfo      = "";
            _currentWordIndex = null;
            _dao                = (IDAO)LateBinding.GetDAOConstructor().Invoke(new object[] { });
            _words              = new List <WordViewModel>();
            _currentWord        = new WordViewModel();
            _startStudyCommand  = new RelayCommand(param => this.StartStudy());
            _confirmWordCommand = new RelayCommand(param => this.ConfirmWord());
        }
Esempio n. 5
0
        private void ConfirmWord()
        {
            Console.WriteLine("CONFIRM WORD");
            bool correct = false;

            if (_currentWordIndex != null && _words.Count() > 0)
            {
                if (_currentWord.SecondName == _words.ElementAt((int)_currentWordIndex).SecondName)
                {//correct
                    Console.WriteLine("Typed: " + _currentWord.SecondName);
                    Console.WriteLine("Original: " + _words.ElementAt((int)_currentWordIndex).SecondName);
                    Console.WriteLine("CORRECT");
                    ConfirmInfo = "DOBRZE";
                    correct     = true;
                }
                else
                {//incorrect
                    Console.WriteLine("Typed: " + _currentWord.SecondName);
                    Console.WriteLine("Original: " + _words.ElementAt((int)_currentWordIndex).SecondName);
                    Console.WriteLine("INCORRECT");
                    ConfirmInfo = "ŹLE";
                    correct     = false;
                }

                //DAO
                _dao.updateWord(_currentWord.getWord(), correct);

                _currentWordIndex++;
                if (_words.Count > _currentWordIndex)
                {//next word
                    copyWord(_words.ElementAt((int)_currentWordIndex), CurrentWord);
                }
                else
                {
                    ConfirmInfo       = _confirmInfo + "\nKoniec nauki" + "\nWybierz inny słownik i rozpocznij naukę";
                    _words            = new List <WordViewModel>();
                    CurrentWord       = new WordViewModel();
                    _currentWordIndex = null;
                    Console.WriteLine("Przejrzane wszystkie wyrazy");
                }
            }
        }