internal void OnWindowClosing() { try { QueueService.Disconnect(true); QueueService.CloseConnection(); } catch (Exception ex) { string message = String.Format("Program shutdown not gracefully \n{0}", ex.Message); MessageBox.Show(message, "Error", MessageBoxButton.OK); } }