I m doing image processing for Win Phone, using visual studio 2010. In order to let a a picture displayed for 2 seconds (like slide show), the following class is called
namespace photoBar
{
public class WaitTwoSeconds
{
DispatcherTimer timer = new DispatcherTimer();
public bool timeUp = false;
// This is the method to run when the timer is raised.
private void TimerEventProcessor(Object myObject,
EventArgs myEventArgs)
{
timer.Stop();
timeUp = true;
}
public WaitTwoSeconds()
{
/* Adds the event and the event handler for the method that will
process the timer event to the timer. */
timer.Tick += new EventHandler(TimerEventProcessor);
// Sets the timer interval to 2 seconds.
timer.Interval = new TimeSpan(0, 0, 2); // one second
timer.Start();
//// Runs the timer, and raises the event.
while (timeUp== false)
{
// Processes all the events in the queue.
Application.DoEvents();
}
}
}
}
It is called in this way:
WaitTwoSeconds waitTimer = new WaitTwoSeconds();
while (!waitTimer.timeUp)
{
}
Because the Application.DoEvents();
is claimed as an error: 'System.Windows.Application' does not contain a definition for 'DoEvents' . So I deleted that code block
while (timeUp== false)
{
// Processes all the events in the queue.
Application.DoEvents();
}
After compile and run the program, it shows resume ...
How could I correct this? Thanks