It is useful to check whether the current program has been operated. The simplest way is to determine whether the mouse position has changed. The same is true in winform. Code: [csharp] public class CheckUsedManager {public static event EventHandler TimeToFinishedEvent = null; private static DispatcherTimer checkUsedTimer = new DispatcherTimer (); private static Point mousePosition = GetMousePoint (); static CheckUsedManager () {checkUsedTimer. interval = TimeSpan. fromSeconds (seconds); checkUsedTimer. tick + = new EventHandler (CheckUsedTimer_Tick); checkUsedTimer. start ();} Static void CheckUsedTimer_Tick (object sender, EventArgs e) {if (! HaveUsedTo () {if (TimeToFinishedEvent! = Null) {TimeToFinishedEvent (null, null) ;}} private static bool HaveUsedTo () {Point point = GetMousePoint (); if (point = mousePosition) {return false ;} mousePosition = point; return true;} [StructLayout (LayoutKind. sequential)] private struct MPoint {public int X; public int Y; public MPoint (int x, int y) {this. X = x; this. Y = y ;}} [DllImport ("user32.dll", CharSet = CharSet. auto)] priv Ate static extern bool GetCursorPos (out MPoint mpt ); /// <summary> /// obtain the current mouse position on the screen /// </summary> /// <returns> </returns> public static Point GetMousePoint () {MPoint mpt = new MPoint (); GetCursorPos (out mpt); Point p = new Point (mpt. x, mpt. y); return p ;}} public class CheckUsedManager {public static event EventHandler TimeToFinishedEvent = null; private static DispatcherTimer checkUsedTimer = n Ew DispatcherTimer (); private static Point mousePosition = GetMousePoint (); static CheckUsedManager () {checkUsedTimer. interval = TimeSpan. fromSeconds (seconds); checkUsedTimer. tick + = new EventHandler (CheckUsedTimer_Tick); checkUsedTimer. start ();} static void CheckUsedTimer_Tick (object sender, EventArgs e) {if (! HaveUsedTo () {if (TimeToFinishedEvent! = Null) {TimeToFinishedEvent (null, null) ;}} private static bool HaveUsedTo () {Point point = GetMousePoint (); if (point = mousePosition) {return false ;} mousePosition = point; return true;} [StructLayout (LayoutKind. sequential)] private struct MPoint {public int X; public int Y; public MPoint (int x, int y) {this. X = x; this. Y = y ;}} [DllImport ("user32.dll", CharSet = CharSet. auto)] priv Ate static extern bool GetCursorPos (out MPoint mpt ); /// <summary> /// obtain the current mouse position on the screen /// </summary> /// <returns> </returns> public static Point GetMousePoint () {MPoint mpt = new MPoint (); GetCursorPos (out mpt); Point p = new Point (mpt. x, mpt. y); return p ;}} then bind the event to this class. Complete Code implemented using WPF: Judgment class: [csharp] public class CheckUsedManager {public static event EventHandler TimeToFinishedEvent = null; private static DispatcherTimer checkUsedTimer = new DispatcherTimer (); private static Point mousePosition = GetMousePoint (); static CheckUsedManager () {checkUsedTimer. interval = TimeSpan. fromSeconds (ReadConfig. autoCheckUsedTime); checkUsedTimer. tick + = new EventHandler (CheckUs EdTimer_Tick); checkUsedTimer. Start ();} static void CheckUsedTimer_Tick (object sender, EventArgs e) {if (! HaveUsedTo () {if (TimeToFinishedEvent! = Null) {TimeToFinishedEvent (null, null) ;}} private static bool HaveUsedTo () {Point point = GetMousePoint (); if (point = mousePosition) {return false ;} mousePosition = point; return true;} [StructLayout (LayoutKind. sequential)] private struct MPoint {public int X; public int Y; public MPoint (int x, int y) {this. X = x; this. Y = y ;}} [DllImport ("user32.dll", CharSet = CharSet. auto)] priv Ate static extern bool GetCursorPos (out MPoint mpt ); /// <summary> /// obtain the current mouse position on the screen /// </summary> /// <returns> </returns> public static Point GetMousePoint () {MPoint mpt = new MPoint (); GetCursorPos (out mpt); Point p = new Point (mpt. x, mpt. y); return p ;}} public class CheckUsedManager {public static event EventHandler TimeToFinishedEvent = null; private static DispatcherTimer checkUsedTimer = n Ew DispatcherTimer (); private static Point mousePosition = GetMousePoint (); static CheckUsedManager () {checkUsedTimer. interval = TimeSpan. fromSeconds (ReadConfig. autoCheckUsedTime); checkUsedTimer. tick + = new EventHandler (CheckUsedTimer_Tick); checkUsedTimer. start ();} static void CheckUsedTimer_Tick (object sender, EventArgs e) {if (! HaveUsedTo () {if (TimeToFinishedEvent! = Null) {TimeToFinishedEvent (null, null) ;}} private static bool HaveUsedTo () {Point point = GetMousePoint (); if (point = mousePosition) {return false ;} mousePosition = point; return true;} [StructLayout (LayoutKind. sequential)] private struct MPoint {public int X; public int Y; public MPoint (int x, int y) {this. X = x; this. Y = y ;}} [DllImport ("user32.dll", CharSet = CharSet. auto)] priv Ate static extern bool GetCursorPos (out MPoint mpt ); /// <summary> /// obtain the current mouse position on the screen /// </summary> /// <returns> </returns> public static Point GetMousePoint () {MPoint mpt = new MPoint (); GetCursorPos (out mpt); Point p = new Point (mpt. x, mpt. y); return p ;}} read the time in the Configuration: [csharp] public class ReadConfig {// <summary> /// check whether the interval is used /// </summary> public static int AutoCheckUsedTime {get {int time = 10; try {string timeStr = ConfigurationManager. appSettings ["AutoCheckUsedTime"]; if (string. isNullOrEmpty (timeStr) {timeStr = "10";} time = int. parse (timeStr) ;}catch {} return time ;}}} public class ReadConfig {// <summary> /// check whether the interval is used /// </summary> public static int AutoCheckUsedTime {get {int time = 10; try {string timeStr = ConfigurationManager. appSettings ["AutoCheckUsedTime"]; If (string. isNullOrEmpty (timeStr) {timeStr = "10";} time = int. parse (timeStr);} catch {} return time ;}} configure the App. config: [csharp] <? Xml version = "1.0" encoding = "UTF-8"?> <Configuration> <etettings> <add key = "AutoCheckUsedTime" value = "10"/> </appSettings> </configuration> <? Xml version = "1.0" encoding = "UTF-8"?> <Configuration> <etettings> <add key = "AutoCheckUsedTime" value = "10"/> </appSettings> </configuration> interface call: [csharp] public partial class MainWindow: window {public MainWindow () {InitializeComponent (); CheckUsedManager. timeToFinishedEvent-= new EventHandler (CheckUsedManager_TimeToFinishedEvent); CheckUsedManager. timeToFinishedEvent + = new EventHandler (CheckUsedManager_TimeToFinishedEvent);} vo Id CheckUsedManager_TimeToFinishedEvent (object sender, EventArgs e) {MessageBox. Show ("unattended! ") ;}} Public partial class MainWindow: Window {public MainWindow () {InitializeComponent (); CheckUsedManager. timeToFinishedEvent-= new EventHandler (CheckUsedManager_TimeToFinishedEvent); CheckUsedManager. timeToFinishedEvent + = new EventHandler (CheckUsedManager_TimeToFinishedEvent);} void CheckUsedManager_TimeToFinishedEvent (object sender, EventArgs e) {MessageBox. show ("no one is using it! ") ;}} Result: