I have that working code in a c# Console Application.
using Sydesoft.NfcDevice;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NFCCardReaderTest
{
internal class Program
{
private static ACR122U acr122u = new ACR122U();
static void Main(string[] args)
{
acr122u.Init(false, 50, 4, 4, 200); // NTAG213
acr122u.CardInserted += Acr122u_CardInserted;
acr122u.CardRemoved += Acr122u_CardRemoved;
Console.ReadLine();
}
private static void Acr122u_CardInserted(PCSC.ICardReader reader)
{
Console.WriteLine("NFC Transponder wurde aufgelegt.");
Console.WriteLine("Unique ID: " + BitConverter.ToString(acr122u.GetUID(reader)).Replace("-", ""));
}
private static void Acr122u_CardRemoved()
{
Console.WriteLine("NFC Transponder wurde entfernt.");
}
}
}
Thats for reading out a NFC card with a reader.
I wanted now to implement this in another c# WPF application. But at the moment, where i just implement the field in the WPF:
private static ACR122U acr122u = new ACR122U();
I'm then getting that error: System.Windows.Markup.XamlParseException: 'The type initializer for 'ChecklistenTest.MainWindow' threw an exception.', FileNotFoundException: Could not load file or assembly 'Sydesoft.NfcDevice.ACR122U, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Das System kann die angegebene Datei nicht finden.
Anyone knows how to fix that? Or what have to do here.
Thats the nfc reader i have and where i found the code I've tested: https://www.sydesoft-blog.de/nfc-reader-acr122u.html
WPF Framework instead of WPF App