/// <summary> /// We inherit from the VB.NET WindowsFormApplicationBase class, which has the /// single-instance functionality. /// </summary> public SAApplication(ISAApplication sa) { this.mSAapplication = sa; // Make this a single-instance application this.IsSingleInstance = true; this.EnableVisualStyles = true; // There are some other things available in the VB application model, for // instance the shutdown style: //this.ShutdownStyle = Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses; // Add StartupNextInstance handler this.StartupNextInstance += new StartupNextInstanceEventHandler(this.SAApplication_StartupNextInstance); }