Please tell me, I'm developing a WPF application for FrameWork 4.0, because Win XP compatibility is required. Under certain conditions, I need to call a modal window, but with all the richness of the description of this procedure - I fail ... I get an exception: Exception thrown: 'System.InvalidOperationException' in PresentationCore.dll on this line: Window_Dialog winDialog = new Window_Dialog();

The error seems to be not new, there is a solution to it, a challenge in the second thread, but most likely a poor experience is having an effect, because it does not work out a solution.

 void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { timer.Stop(); Order result = orders.Find(x => x.Id == TempOrder.Id); if(result.CustomerName == "") { Window_Dialog winDialog = new Window_Dialog(); if (winDialog.ShowDialog() == true) { MessageBox.Show("Записано!"); } else { MessageBox.Show("Отмена"); } } } 

I will be glad to your advice! Thank!

  • Attach the full text of the error - Andrey NOP
  • one
    Possible duplicate question: Working with controls from background thread - MSDN.WhiteKnight 2:58 pm
  • Full text of the error: Exception thrown: 'System.InvalidOperationException' in PresentationCore.dll The window simply does not open. In Output, only this line - Andrey
  • @MSDN, and unless it is impossible to create a window in other flow? It seems possible. - Andrei NOP
  • one
    @Andrey, try using DispatcherTimer instead of this timer. Well, I asked the whole glass show to show - Andrew NOP

0