Exemplo n.º 1
0
 /// <summary>
 /// Starts scanning for nfc tags.
 /// </summary>
 /// <param name="nfc"><see cref="ICrossNearFieldCommunication"/> to use.</param>
 public async static void GloballyStartScanning(ICrossNearFieldCommunication nfc)
 {
     _nfc             = nfc;
     _nfc.Association = Association;
     _nfc.Initialize();
     await _nfc.StartListeningAsync();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Attempts to stop scanning for nfc tags.
 /// </summary>
 public async static void TryGloballyStopScanning()
 {
     if (await _nfc?.TryStopListeningAsync())
     {
         _nfc = null;
     }
     else
     {
         Console.WriteLine("Unable to stop scanning, check console for error - XNFC");
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Attempts to start scanning for nfc tags.
        /// </summary>
        /// <param name="nfc"><see cref="ICrossNearFieldCommunication"/> to use.</param>
        public async static void TryGloballyStartScanning(ICrossNearFieldCommunication nfc)
        {
            try
            {
                _nfc             = nfc;
                _nfc.Association = Association;
                _nfc.Initialize();
            }
            catch (Exception e)
            {
                Console.WriteLine("Unable to start scanning - XNFC");
                Console.WriteLine($"Error: {e}");
                return;
            }

            if (!await _nfc?.TryStartListeningAsync())
            {
                Console.WriteLine("Unable to start scanning, check console for error - XNFC");
            }
        }
Exemplo n.º 4
0
 public MainPage()
 {
     _xnfc              = XNFC.GetApi();
     _xnfc.TagDetected += XnfcOnTagDetected;
     InitializeComponent();
 }
Exemplo n.º 5
0
        /// <summary>
        /// Stops scanning for nfc tags.
        /// </summary>
        public async static void GloballyStopScanning()
        {
            await _nfc?.StopListeningAsync();

            _nfc = null;
        }