private void LaunchCallback(ResponseFrame frame, Exception e) { if (CheckForErrorsOrTimeout(frame, e)) { return; } byte[] data = frame.Data; byte[] temp = new byte[data.Length - data[1] - 2]; Array.Copy(data, 2 + data[1], temp, 0, temp.Length); NdefMessage message = NdefMessage.FromByteArray(temp); if (message.Count > 0) { if (Encoding.UTF8.GetString(message[0].Type).Equals("U")) { NdefUriRecord uriRecord = new NdefUriRecord(message[0]); NdefUri uri = new NdefUri(uriRecord.Uri); if (uri.Scheme == 0) { return; } Process.Start(uriRecord.Uri); } } Task.Run(() => { Thread.Sleep(500); DetectandLaunch(); }); }
/// <summary> /// /// </summary> /// <param name="timeout">Maximum time the Tappy will wait for a tag. Time out is in seconds. 0 = No time out</param> /// <param name="willLock">If true, the Tappy will lock the tag after writing</param> /// <param name="uri">Uri to be written to a tag</param> public WriteUri(byte timeout, bool willLock, NdefUri uri) { parameters.Add(timeout); parameters.Add(Convert.ToByte(willLock)); parameters.Add(uri.Scheme); parameters.AddRange(Encoding.UTF8.GetBytes(uri.Path)); }