private void OnFormClosing(object sender, FormClosingEventArgs e) { _Logger.Info("Application closing."); SerialPortService.CleanUp(); if (m_TerminalProcess != null) { m_TerminalProcess.Disconnect(); m_TerminalProcess = null; } }
public Form1() { m_Config = Configuration.GetInstance(); BasicConfigurator.Configure(); InitializeComponent(); errorLabel.Text = ""; var connectedModemPorts = FilterPorts(SerialPortService.GetAvailableSerialPorts()); SetSerialPortsList(connectedModemPorts); HandleSerialPortsChange(connectedModemPorts); SerialPortService.PortsChanged += SerialPortServicePortsChanged; if (!File.Exists(m_Config.TerminalApplicationPath)) { MessageBox.Show( "The terminal application specified in the configuration file was not found. This application will not be able to automatically open the terminal when the modem is connected.\n\nTo resolve, either:\na) install TeraTerm (see installation directory for install file) or\nb) update the configuration file.", "OpenXC Modem Connect", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }