public frmTTBOpen CreateTTBConnectWindow() { if (!base.IsDisposed) { string str = "Connect TTB"; if ((this._TTBConnect == null) || this._TTBConnect.IsDisposed) { this._TTBConnect = new frmTTBOpen(); } this._TTBConnect.CommWindow = this.comm; this._TTBConnect.Text = str; this._TTBConnect.ShowDialog(); } else { MessageBox.Show("COM window not initialized!", "Information"); } return this._TTBConnect; }
public frmTTBOpen CreateTTBConnectWindow(PortManager target) { if (target == null) { return null; } frmTTBOpen open = null; if (!base.IsDisposed) { if (target.comm.IsSourceDeviceOpen()) { string str = "Connect TTB: " + target.comm.PortName; open = new frmTTBOpen(); open.CommWindow = target.comm; open.Text = str; if (open.ShowDialog() != DialogResult.OK) { target.ReconnectTTB = false; return open; } target.TTBPortProperties = new UART_Properties(); target.TTBPortProperties.PortName = target.comm.TTBPort.PortName; target.TTBPortProperties.BaudRate = target.comm.TTBPort.BaudRate; target.TTBPortProperties.DataBits = target.comm.TTBPort.DataBits; target.TTBPortProperties.StopBits = target.comm.TTBPort.StopBits; target.TTBPortProperties.Parity = target.comm.TTBPort.Parity; } return open; } MessageBox.Show("Port not initialized!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); return open; }