public void GetWord(Word word = null) { thread = Thread.CurrentThread; if (word == null) { word = wordsManager.GetWord(isPreventWord); } isPreventWord = false; if (word != null) { Application.Current.Dispatcher.Invoke(() => { WordWindow wordWindow = new WordWindow(); WordViewModel wordViewModel = wordWindow.DataContext as WordViewModel; wordViewModel.WordEvent = word; wordWindow.ShowDialog(); if (wordViewModel.EditingWord != null) { EditWordEvent = wordViewModel.EditingWord; OnPropertyChanged("EditWordEvent"); mainWindow.Show(); thread.Suspend(); } isPreventWord = wordViewModel.PreviousWordEvent; }); try { GetWord(); } catch (Exception ex) { Loger.Write(ex.Message); } } try { wordsManager.Save(); Thread.Sleep(config.SleepBetweenShows * 1000); wordsManager.GetNextWordsList(); GetWord(); } catch (Exception ex) { Loger.Write(ex.Message); } }
public void toWords_Click(object sender, RoutedEventArgs e) { WordWindow wordWindow = new WordWindow(); wordWindow.Show(); }