void getQuestionWorker_DoWork(object sender, DoWorkEventArgs e) { if (_currentQuestion != null) Thread.Sleep(700); Question question=null; while(question==null) try { question = QuizDB.CreateNewQuestion(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } this.Dispatcher.Invoke(new Action(()=>this._currentQuestion = new QuestionVM(question))); }
void getQuestionWorker_DoWork(object sender, DoWorkEventArgs e) { if (_currentQuestion != null) { Thread.Sleep(700); } Question question = null; while (question == null) { try { question = QuizDB.CreateNewQuestion(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } } this.Dispatcher.Invoke(new Action(() => this._currentQuestion = new QuestionVM(question))); }