Application.Idle : Application « System.Windows.Forms « C# / C Sharp by API






Application.Idle

 


using System;
using System.Threading;
using System.Reflection;
using System.Windows.Forms;

public class HelloWorldForm : Form {
    public HelloWorldForm() {
    }

    public static void OnApplicationExit(object sender, EventArgs e) {
        try {
            Console.WriteLine("shutting down.");
        } catch (NotSupportedException) {
        }
    }

    public static void OnIdle(object sender, EventArgs e) {
        Console.WriteLine("idle.");
    }

    public static void OnThreadException(object sender, ThreadExceptionEventArgs e) {
        Console.WriteLine("caught!");
    }

    public static void OnThreadExit(object sender, EventArgs e) {
        Console.WriteLine("thread is shutting down.");
    }

    public static void Main() {
        HelloWorldForm FormObject = new HelloWorldForm();

        Application.ApplicationExit += new EventHandler(OnApplicationExit);
        Application.Idle += new EventHandler(OnIdle);
        Application.ThreadException += new ThreadExceptionEventHandler(OnThreadException);
        Application.ThreadExit += new EventHandler(OnThreadExit);
        Application.Run(FormObject);
    }
}

   
  








Related examples in the same category

1.Application.AddMessageFilter
2.Application.ApplicationExit
3.Application.CompanyName
4.Application.ProductName
5.Application.RemoveMessageFilter
6.Application.Run
7.Application.StartupPath
8.Application.ThreadException
9.Application.ThreadExit