// // Read UID Tab // private void ReadUIDButton_Click(object sender, RoutedEventArgs e) { ShowPendingStatus("Waiting for tap"); Command cmd = new DetectSingleTagUid((byte)timeout.Value, DetectTagSetting.Type2Type4AandMifare); tappy.SendCommand(cmd, AddUID); }
private void WriteUrlWithTagMirror_Click(object sender, RoutedEventArgs e) { string temp = string.Copy(urlTextBox.Text); bool willLock = (bool)lockCheckBox.IsChecked; bool repeat = (bool)repeatUrlWrite.IsChecked; byte timeoutValue = (byte)timeout.Value; Command detectTag = new DetectSingleTagUid(timeoutValue, DetectTagSetting.Type2Type4AandMifare); ShowPendingStatus("Waiting for tap"); Callback detectTagCallback = null; Callback writeCallback = (ResponseFrame frame, Exception exc) => { if (CheckForErrorsOrTimeout(frame, exc)) { return; } ShowSuccessStatus(); if (repeat) { Thread.Sleep(1000); ShowPendingStatus("Waiting for tap"); Task.Run(() => tappy.SendCommand(detectTag, detectTagCallback)); } }; detectTagCallback = (ResponseFrame frame, Exception exc) => { if (CheckForErrorsOrTimeout(frame, exc)) { return; } Tag tag = new Tag(frame.Data); Command write = new WriteUri(timeoutValue, willLock, temp.Replace("[uid]", tag.UidToString())); ShowPendingStatus("Tag detected, please hold steady while tag is written"); Task.Run(() => tappy.SendCommand(write, writeCallback)); }; tappy.SendCommand(detectTag, detectTagCallback); }
private void configureTagForPlatform_Click(object sender, RoutedEventArgs e) { Command readCommand = new DetectSingleTagUid(0, DetectTagSetting.Type2Type4AandMifare); tappy.SendCommand(readCommand, delegate(ResponseFrame frame, Exception exc) { if (CheckForErrorsOrTimeout(frame, exc)) { return; } Tag tag = new Tag(frame.Data); string uid = BitConverter.ToString(tag.UID).Replace("-", ""); string url = $"https://members.taptrack.com/m?id={uid}"; Command write = new WriteUri(0, false, new NdefUri(url)); Task.Run(() => { tappy.SendCommand(write, ConfigSuccess); }); }); }
// // Lock Tag Tab // private void LockButton_Click(object sender, RoutedEventArgs e) { ShowPendingStatus("Waiting for tap"); Command readCommand = new DetectSingleTagUid((byte)timeout.Value, DetectTagSetting.Type2Type4AandMifare); tappy.SendCommand(readCommand, delegate(ResponseFrame frame, Exception exc) { if (CheckForErrorsOrTimeout(frame, exc)) { return; } Tag tag = new Tag(frame.Data); Action Lock = () => { Command lockCommand = new LockTag((byte)timeout.Value, tag.UID); tappy.SendCommand(lockCommand, ResponseCallback); }; Dispatcher.BeginInvoke(Lock); }); }