I am writing a neural network simulator application in C# WPF and would like to run the main program loop in a given ms cycle.
For this I have the following code:
while(true)
{
if(main_cycle_watch.ElapsedMilliseconds >= main_cycle_watch_ms + target_cycle_time)
{
/* Refresh timer base */
main_cycle_watch_ms = main_cycle_watch.ElapsedMilliseconds;
/* Call main world handling method */
WorldHandlingMain();
}
/* Handle window events */
???
}
As the while loop runs infinitely the main window events do not get the chance to be handled therefor the application is not responsive at all.
So I would like to know if there is a way to force the main window to handle its events.