You can do;
var timer = new DispatcherTimer (
TimeSpan.FromMinutes(5),
DispatcherPriority.ApplicationIdle,// Or DispatcherPriority.SystemIdle
(s, e) => { mainWindow.Activate(); }, // or something similar
Application.Current.Dispatcher
);
picked up from here
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…