Programming/C#

Handling Application Events: On Idle

blueasa 2010. 6. 28. 21:43

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);
    }
}


출처 : http://www.java2s.com/Code/CSharp/Development-Class/HandlingApplicationEventsOnIdle.htm           

       
반응형