private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (!exit) { this.Hide(); e.Cancel = true; return; } PSVRController.DeviceDisconnected(); try { if (hookedEvents != null) { hookedEvents.KeyDown -= HookedEvents_KeyDown; hookedEvents.Dispose(); } } catch { } trayIcon.Visible = false; if (CurrentOS.IsLinux) { Environment.Exit(0); } }