title: How to wait for right moment to write?
body: <p>I'm trying to send my rs232 device multiple SerialPort.Write commands right after each other. However, I don't think it can handle multiple WRITE commands at once.</p>
  
  <p>Currently, I'm just using Thread.Sleep(500) to delay between WRITEs, but is there a way to detect when the perfect time to send is? Or with buffers?</p>
  
  <p>example code </p>
  
  <p>Interface</p>
  
  <pre><code>private void btn_infuse_Click(object sender, RoutedEventArgs e) {
          cmd.SetTargetInfusionVolume(spmanager, double.Parse(tbox_targetvolume.Text));
          cmd.StartInfuse(spmanager);//cmd object of Command class
  }
  </code></pre>
  
  <p>Command Class</p>
  
  <pre><code>public void StartInfuse(SPManager spm){
          spm.Write("RUN");//spm object of serialportmanager class
      }
      public void SetTargetInfusionVolume(SerialPortManager spm, double num) {
          spm.Write("MLT " + num.ToString());
      }
  </code></pre>
  
  <p>SerialPortManager class</p>
  
  <pre><code>       public void Write(string sData) {
          if (oSerialPort.IsOpen) {//oSerialPort object of SerialPort class
              try {
                  oSerialPort.Write(sData + "\r");
              }
              catch { MessageBox.Show("error"); }
          }
      } 
  </code></pre>