I would guess if you are swiping the card, there's an input somewhere on the wpf form, like a textbox for example? Then I would be inclined to add an event, perhaps a KeyUp Event handler, (The keyboard wedge card scanner does send an end-of-processing signal such as ENTER to indicate the swipe was successful yes?), In the KeyUp Event Handler, build up a string using StringBuilder, and when the end-of-processing signal such as ENTER is caught, you can then remove the "%" and ";" from the StringBuilder instance and do whatever you have to do with it.
It might be easier to use a state system, when the KeyUp event handler receives a "%", then enter another state where the end expected state would be a ";"
static bool StartState = false;
StringBuilder sbInput = new StringBuilder();
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
if (!StartState){
if (e.KeyCode == Keys.D5) StartState = true;
sbInput.Append((char)e.KeyValue);
}else{
if (e.KeyCode == Keys.OemSemicolon){
StartState = false;
// sbInput will contain the data from the scanner,
// copy it somewhere else and reset sbInput
// sbInput.Remove(0, sbInput.Length);
}
sbInput.Append((char)e.KeyValue);
}
e.Handled = true;
}
Hope this helps,
Best regards,
Tom.