Exemplo n.º 1
0
        public ShowWord(Dispatcher context)
        {
            _locker = new object();
            var intervalInMinutes = WordsSettings.WordsAsapSettings.WordDialogShowInterval;
            var interval          = GetMiliseconds(intervalInMinutes);

            if (interval < MinimumShowInterval)
            {
                interval = GetMiliseconds(MinimumShowInterval);
            }

            _context    = context;
            _showDialog = ShowDialog;
            _timer      = new Timer {
                Enabled = false, Interval = interval
            };
            _timer.Elapsed += OnElapsed;
            _random         = new Random();
            //TODO: refactor, handle correctly
            try
            {
                _wordsCollectionService = WordsCollectionService.CreateWordsCollectionService(WordsSettings.WordsAsapSettings);
            }
            catch (Exception e)
            {
                DefaultMessageService.MessageService.ShowErrorMessage("WordsAsap Error", e.ToString());
                //TODO: add log
            }
            WordsSettings.SettingsChanged += WordsSettings_SettingsChanged;
        }
Exemplo n.º 2
0
 protected void ViewModelInit()
 {
     try
     {
         if (IsInDesignMode)
         {
             return;
         }
         _wordsCollectionService = WordsCollectionService.CreateWordsCollectionService(WordsSettings.WordsAsapSettings);
         InitializeModel();
     }
     catch (Exception e)
     {
         if (MessagesService != null)
         {
             MessagesService.ShowErrorMessage("WordsAsap Error", e.ToString());
         }
         DefaultMessageService.MessageService.ShowErrorMessage("WordsAsap Error", e.ToString());
         //TODO: log
     }
 }
Exemplo n.º 3
0
 public WordViewModel()
 {
     _wordsCollectionService = WordsCollectionService.CreateWordsCollectionService(WordsSettings.WordsAsapSettings);
     Translations            = new ObservableCollection <Translation>();
 }