Tell me more ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

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.

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.

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.

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
    }
    }
}

Is this a workable solution?

share|improve this question
Could any one tell me which tag to use when submitting WPF application questions? – Vidhya Aug 29 '12 at 4:37

closed as off topic by Alex, ChrisF Aug 28 '12 at 23:41

Questions on Web Applications Stack Exchange are expected to relate to web applications within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

Browse other questions tagged or ask your own question.