/// <summary>Send a key to PC-EFTPOS.</summary> /// <param name="key">An <see cref="EFTPOSKey" />.</param> /// <returns>FALSE if an error occured.</returns> public bool DoSendKey(EFTPOSKey key) { return(DoRequest(new EFTSendKeyRequest() { Key = key })); }
public async Task StartSendKeysTest(EFTPOSKey key) { _ct = new CancellationTokenSource(); var progress = new Progress <string>((s) => { _data.Log(s); }); _data.Progress = progress; await Task.Run(() => SpawnSendKeys(key, _ct.Token, progress), _ct.Token); }
public async Task SendKey(EFTPOSKey option, string data = "") { try { await _eft.WriteRequestAsync(new EFTSendKeyRequest { Data = data, Key = option }); } catch (Exception ex) { ShowError(ex.HResult.ToString(), ex.Message); } }
private async Task SpawnSendKeys(EFTPOSKey key, CancellationToken token, IProgress <string> p) { try { while (!token.IsCancellationRequested) { await Task.Delay(100); await _eft.WriteRequestAsync(new EFTSendKeyRequest { Key = key }); p.Report(_eftLogs); } } catch (Exception ex) { ShowError(ex.HResult.ToString(), ex.Message); } }