예제 #1
0
 /// <summary>
 /// Capture an Updated event for later call on main thread.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="args">Args containing relevant QRCode.</param>
 private void OnQRCodeUpdatedEvent(object sender, QRCodeUpdatedEventArgs args)
 {
     lock (pendingActions)
     {
         pendingActions.Enqueue(new PendingQRCode(PendingQRCode.QRAction.Update, args.Code));
     }
 }
 /// <summary>
 /// Capture an Updated event for later call on main thread.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="args">Args containing relevant QRCode.</param>
 private void OnQRCodeUpdatedEvent(object sender, QRCodeUpdatedEventArgs args)
 {
     SimpleConsole.AddLine(trace, $"Updating {args.Code.Data}");
     lock (pendingActions)
     {
         pendingActions.Enqueue(new PendingQRCode(PendingQRCode.QRAction.Update, args.Code));
     }
 }
예제 #3
0
        private void QrTracker_Updated(QRCodeUpdatedEventArgs args)
        {
            lock (qrCodesList)
            {
                qrCodesList[args.Code.Id] = args.Code;
            }
            var handlers = QRCodeUpdated;

            if (handlers != null)
            {
                handlers(this, QRCodeEventArgs.Create(args.Code));
            }
        }
예제 #4
0
        private void QrTracker_Updated(QRCodeUpdatedEventArgs args)
        {
            lock (qrCodesList)
            {
                if (!qrCodesList.ContainsKey(args.Code.Id))
                {
                    Debug.LogWarning("QRCode updated that was not previously being observed: " + args.Code.Code);
                }

                qrCodesList[args.Code.Id] = args.Code;
            }

            QRCodeUpdated?.Invoke(this, QRCodeEventArgs.Create(args.Code));
        }
        private void QRWatcherUpdated(object sender, QRCodeUpdatedEventArgs args)
        {
            lock (qrCodesList)
            {
                if (!qrCodesList.ContainsKey(args.Code.Id))
                {
                    Debug.LogWarning($"QRCode updated that was not previously being observed: {args.Code.Data}");
                }

                qrCodesList[args.Code.Id] = args.Code;
            }

            Debug.Log("QR Code Updated: " + args.Code.Data);
            QRCodeUpdated?.Invoke(this, args.Code);
        }
        private void QRCodeWatcher_Updated(object sender, QRCodeUpdatedEventArgs args)
        {
            Debug.Log("QRCodesManager QRCodeWatcher_Updated");

            // change logic : do nothing on added and act on first update
            bool found = false;

            lock (qrCodesList)
            {
                found = qrCodesList.ContainsKey(args.Code.Id);

                qrCodesList[args.Code.Id] = args.Code;
            }
            if (!found) // this is what we use for added
            {
                OnQRCode(args.Code, QREventType.Added);
            }
            else
            {
                OnQRCode(args.Code, QREventType.Updated);
            }

            /*
             * bool found = false;
             * lock (qrCodesList)
             * {
             *  if (qrCodesList.ContainsKey(args.Code.Id))
             *  {
             *      found = true;
             *      qrCodesList[args.Code.Id] = args.Code;
             *  }
             * }
             * if (found)
             * {
             *  if (OnQRCode != null)
             *  {
             *      OnQRCode(args.Code, QREventType.Updated);
             *  }
             * }
             */
        }
예제 #7
0
        private void QRCodeWatcher_Updated(object sender, QRCodeUpdatedEventArgs args)
        {
            Debug.Log("QRCodesManager QRCodeWatcher_Updated");

            bool found = false;

            lock (qrCodesList)
            {
                if (qrCodesList.ContainsKey(args.Code.Id))
                {
                    found = true;
                    qrCodesList[args.Code.Id] = args.Code;
                }
            }
            if (found)
            {
                var handlers = QRCodeUpdated;
                if (handlers != null)
                {
                    handlers(this, QRCodeEventArgs.Create(args.Code));
                }
            }
        }
예제 #8
0
 private void QRCodeWatcher_Updated(object sender, QRCodeUpdatedEventArgs e)
 {
     pendingActions.Enqueue(new ActionData {
         Type = ActionData.EventType.Updated, QRCode = e.Code
     });
 }
예제 #9
0
 private void QRCodeWatcher_Updated(object sender, QRCodeUpdatedEventArgs e)
 {
     SendProgressMessage($"Found QR code {e.Code.Data}");
     QRCodeFound?.Invoke(this, new QRInfo(e.Code));
 }