public MainForm() { mainDriver = new Driver(); InitializeComponent(); Driver.Log += Driver_Log; JoystickHelper.Log += Driver_Log; SystemHelper.Log += Driver_Log; Configuration.Log += Driver_Log; Configuration.StopProc += btnStop_Click; this.FormClosing += MainForm_FormClosing; this.FormClosed += MainForm_FormClosed; Configuration.PropogateSettings(); JoystickHelper.DestroyAll(); //quietly finish the constructor if we're updating. SystemHelper.checkForMissingDrivers(); if (disablePortsOnExit) { } if (startInTray) { this.Hide(); } else { this.Show(); } if (autoStart) { btnStart_Click(null, EventArgs.Empty); } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (!exit && Driver.run) { this.Hide(); e.Cancel = true; } if (disablePortsOnExit) { JoystickHelper.DestroyAll(); } }