Hie guys, i have no code at the moment but my problem is like this. i want to display a message box after a certain period of time after an event has occurred lets say after an enquiry has been made and this message box seeks to remind the user to check on the delivery status of the enquiry lets say after 5 minutes. Any ideas or alternatives?
Asked
Active
Viewed 2,392 times
2 Answers
2
First create a function to show your message, then you can use a timer.tick event to show your message at a given interval
static System.Windows.Threading.DispatcherTimer myTimer = new System.Windows.Threading.DispatcherTimer();
public void DoInquiry()
{
// do your inquiry stuff
////////////////////////
// Set Timer Interval
myTimer.Interval = = new TimeSpan(0,5,0); // 5 Minutes
// Set Timer Event
myTimer.Tick += new EventHandler(TimerEventProcessor);
// Start timer
myTimer.Start();
}
private static void TimerEventProcessor(Object myObject, EventArgs myEventArgs) {
ShowMessage("Please check on the status");
}
protected void ShowMessage(string Message)
{
System.Windows.MessageBox.Show(Message);
}

Tim Davis
- 524
- 6
- 17
-
1This was tagged as WPF, rather than WinForms. – Paul Coghill Dec 11 '13 at 08:02
-
You are correct Paul, updated sample to use DispatchTimer – Tim Davis Dec 11 '13 at 08:08
1
You would probably want to use a DispatcherTimer. You can use that to check when five minutes have passed then show a MessageBox when appropriate.

Paul Coghill
- 667
- 6
- 27