title: Using Serial Port communication in all WPF forms in an application
body: <p>I have two WPF forms (Main and Book Time). As soon as application receives employee data from serial port with prefix "EMPXXXX", main form will handle the call and update the UI. User then will be presented with two button "Start Job"and "Switch Job" based on their day log. Now user will press either the start or switch button , which will bring the Book time screen.Now user will scan the JOB sheet, which is prefixed with "JOBXXXX" . Book time screen should show the Job code in the text box and update the database on user pressing "YES" or "NO" button in the Button screen.</p>
  
  <p>Please can some one tell me appropriate way to share the receiving data between two WPF forms and update them based "EMP" or "JOB" prefix.</p>
  
  <p>I was thinking of creating a common class, which will receive the data in serialdatareceive event and based on the prefix invoke appropriate handling method.</p>
  
  <pre><code>Class SerialDataReceive {
  
      Serialport SP = new serialport("COM1",9600);
      SP.DataReceived += New SerailPortDataReceiveHandler(DataReceiveHandler);
  }
  
  private voif SerialPortDataReceiveHandler(object sender, serialdatareceiveeventArg e)
  {
      SerialPort SP1 = new serialport(sender);
      sCommdata = Sp1.ReadExisting();
  
      If(ScommData.substring(0,3)== "EMP")
      {
          //call the function in Main form
  
      }
      else 
      {
          // call function in BookTime.XAML.Cs and update the UI
      }
      }
  }
  </code></pre>
  
  <p>Is this a workable solution?</p>