title: .NET C# Serialport not working as it should
body: <p>I am having problems with doing stuff on my serialport communication. 
  The issue is that the port is open but when I check if(_cc.port.IsOpen) nothing happens and it jumps to else where it will try open the port. Well, the port cannot be opened as it says it's already open. </p>
  
  <p>COMcon.CS</p>
  
  <pre><code>private void connectSerial(string indata, string password) 
          {
              port = new SerialPort(indata, 9600, Parity.None, 8, StopBits.One);
  
              DateTime dt = DateTime.Now;
              string time = dt.ToShortTimeString();
  
              try 
              {
                  port.Open();
                  port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
  
                  if (port.IsOpen)
                  {
                      port.WriteLine(Environment.NewLine);
                      port.WriteLine("no");
                      port.WriteLine("enable");
  
                      if (password != String.Empty)
                      {
                          port.WriteLine(password);
                      }
  
                      port.WriteLine("terminal length 0");
                      port.WriteLine("config terminal");
                  }
              }
              catch (Exception ex) { Console.WriteLine("Error" + ex);  } 
  </code></pre>
  
  <p>CommandManager.CS</p>
  
  <pre><code> public bool rCommand(string command) 
          {
              try
              {
                  if (_cc.port.IsOpen)
                  {
                      _cc.port.WriteLine(command);
                      log.WriteLine(command);
                      return true; // True?
                  }
                  else
                  {
                      _cc.port.Open();
                      log.Write(logger.logHandler("CODE1"));
  
                      if (_cc.port.IsOpen)
                          log.Write(logger.logHandler("CODE2"));
                      return false;
                  }
              }
              catch (Exception ex) { Console.WriteLine("Error: " + ex); log.Write("Error: " + ex); return false; } // Error
          }
  </code></pre>