public APDUResponse SendAPDU(string reader, APDURequest request) { using (var context = new SCardContext()) { context.Establish(SCardScope.System); using (var isoReader = new IsoReader(context, reader, SCardShareMode.Shared, SCardProtocol.Any)) { var apdu = new CommandApdu(IsoCase.Case3Short, isoReader.ActiveProtocol) { CLA = request.CLA, // Class INS = request.INS, //Instruction P1 = request.P1, // Parameter 1 P2 = request.P2, // Parameter 2 Data = request.Data }; byte[] id = null; var response = isoReader.Transmit(apdu); return(new APDUResponse() { Data = response.GetData(), SW1 = response.SW1, SW2 = response.SW2 }); }; } }
public MainWindow() { Request = new APDURequest(); this.DataContext = Request; InitializeComponent(); SetReaders(controller.GetReaders()); }