protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_simulationForm != null)
         {
             if (Application.OpenForms.Cast <object>().Any(form => form == _simulationForm))
             {
                 _simulationForm.Close();
                 _simulationForm = null;
             }
         }
     }
 }
        public void Connect(SerialPortViewModel serialPort)
        {
            if (serialPort == null)
            {
                throw new ArgumentNullException("serialPort");
            }

            SerialPort      = serialPort;
            _simulationForm = new SimulatedSerialPortForm
            {
                SerialPortDescription = string.Format("{0} (DtrEnable: {1})", serialPort.DisplayValue, serialPort.DtrEnable)
            };
            _simulationForm.Show();
        }
        public void Connect(SerialPortViewModel serialPort)
        {
            if (serialPort == null)
            {
                throw new ArgumentNullException("serialPort");
            }

            SerialPort = serialPort;
            _simulationForm = new SimulatedSerialPortForm
            {
                SerialPortDescription = string.Format("{0} (DtrEnable: {1})", serialPort.DisplayValue, serialPort.DtrEnable)
            };
            _simulationForm.Show();
        }
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_simulationForm != null)
         {
             if (Application.OpenForms.Cast<object>().Any(form => form == _simulationForm))
             {
                 _simulationForm.Close();
                 _simulationForm = null;
             }
         }
     }
 }