//private TextBox TextFocusedFirstLoop() //{ // // Look through all the controls on this form. // foreach (Control con in this.Controls) // { // // Every control has a Focused property. // if (con.Focused == true) // { // // Try to cast the control to a TextBox. // TextBox textBox = con as TextBox; // if (textBox != null) // { // return textBox; // We have a TextBox that has focus. // } // } // } // return null; // No suitable TextBox was found. //} #endregion #region IDisposable Members void IDisposable.Dispose() { this.powerManager.PowerNotify -= new EventHandler(OnPowerNotify); this.powerManager.DisableNotifications(); this.powerManager.Dispose(); FullScreenHandle.StopFullScreen(this); GC.SuppressFinalize(this); }
static void Main() { frmLockDown tempLock = null; try { HTN.BITS.FGTRACK.LIB.ResourceManager.Instance.CallingAssembly = Assembly.GetExecutingAssembly(); // clsBarcodeReader.Instance.InitialComponent(); //Application.Run(new frmLockDown()); using (frmLockDown fLockDown = new frmLockDown()) { GC.ReRegisterForFinalize(fLockDown); tempLock = fLockDown; Application.Run(fLockDown); // clsBarcodeReader.Instance.Release(); tempLock = null; GC.SuppressFinalize(fLockDown); GC.Collect(); GC.WaitForPendingFinalizers(); } if (tempLock != null) { FullScreenHandle.StopFullScreen(tempLock); GC.SuppressFinalize(tempLock); GC.Collect(); GC.WaitForPendingFinalizers(); } Application.Exit(); } catch (Exception ex) { if (tempLock != null) { FullScreenHandle.StopFullScreen(tempLock); GC.SuppressFinalize(tempLock); } GC.Collect(); GC.WaitForPendingFinalizers(); Application.Exit(); } }