protected override void Dispose(bool disposing) { try { if (disposing) { Logger.Info("PosKeyboardSimulator", "Disposing class: " + this.ToString()); // Release the managed resources you added in // this derived class here. } // Release the native unmanaged resources // WindowThread needs to be treated as an unmanaged resource because // it is a class that contain threads and windows and won't get collected // by the GC if (Window != null) { Window.Close(); } Window = null; } finally { // Call Dispose on your base class. base.Dispose(disposing); } }
protected override void Dispose(bool disposing) { try { if(disposing) { Logger.Info("PosKeyboardSimulator", "Disposing class: " + this.ToString()); // Release the managed resources you added in // this derived class here. } // Release the native unmanaged resources // WindowThread needs to be treated as an unmanaged resource because // it is a class that contain threads and windows and won't get collected // by the GC if (Window != null) Window.Close(); Window = null; } finally { // Call Dispose on your base class. base.Dispose(disposing); } }