private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { e.Cancel = true; Exit posEvent = new Exit(); posEvent.Engage(0); // PosHardware.Instance.Close(); } catch { } }