Handling Application Events: On Idle
using System;
using System.Threading;
using System.Reflection;
using System.Windows.Forms;
public class HelloWorldForm : Form
{
public HelloWorldForm()
{
Text = "Hello, WindowsForms!";
}
}
public class ApplicationEventHandlerClass
{
public void OnIdle(object sender, EventArgs e)
{
Console.WriteLine("The application is idle.");
}
}
public class MainClass
{
public static void Main()
{
HelloWorldForm FormObject = new HelloWorldForm();
ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();
Application.Idle += new EventHandler(AppEvents.OnIdle);
Application.Run(FormObject);
}
}
Related examples in the same category