コード例 #1
0
        public static WordsCollectionService CreateWordsCollectionService(WordsSettings settings)
        {
            if (_wordsCollectionService != null && string.Equals(_wordsCollectionService._databaseFile, Path.Combine(settings.CollectionStorageFolder, settings.CollectionStorageFile)))
            {
                return(_wordsCollectionService);
            }
            if (_wordsCollectionService != null)
            {
                _wordsCollectionService.Dispose();
                _wordsCollectionService = null;
            }

            _wordsCollectionService = new WordsCollectionService(settings.CollectionStorageFolder, settings.CollectionStorageFile);
            return(_wordsCollectionService);
        }
コード例 #2
0
 private GetWordToLearn()
 {
     _random    = new Random();
     _lastWords = new Queue <Word>();
     try
     {
         _wordsCollectionService = WordsCollectionService.CreateWordsCollectionService(WordsSettings.WordsAsapSettings);
     }
     catch (Exception e)
     {
         DefaultMessageService.MessageService.ShowErrorMessage("WordsAsap Error", e.ToString());
         //TODO: add log
     }
     _maxNumberOfWordDisplays = WordsSettings.WordsAsapSettings.MaxNumberOfWordDisplays;
 }