views:

825

answers:

3

How can I create and show a popup window at a specific time in WPF? What I mean how to display the window on the side of system tray.

A: 

Check out this question for firing an event at a set time.

PaulB
+2  A: 

You could use a timer if you're trying to make the thing popup in a certain number of hours/seconds/minutes (or work out how many hours/seconds/minutes are left until your specific time comes around).

private System.Windows.Threading.DispatcherTimer popupTimer;

// Whatever is going to start the timer - I've used a click event
private void OnClick(object sender, RoutedEventArgs e)
{
    popupTimer = new System.Windows.Threading.DispatcherTimer();

    // Work out interval as time you want to popup - current time
    popupTimer.Interval = specificTime - DateTime.Now;
    popupTimer.IsEnabled = true;
    popupTimer.Tick += new EventHandler(popupTimer_Tick);
}

void popupTimer_Tick(object sender, EventArgs e)
{
    popupTimer.IsEnabled = false;
    // Show popup
    // ......
}


Ok, so you also want to know how to do a notifier popup type thing, which maybe this article in CodeProject might help.

Dave Arkell
A: 

You might want to check out DispatcherTimer.

HTH, Kent

Kent Boogaart