Пример #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();
 }
Пример #2
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");
            }
        }