Пример #1
0
        private void Instance_Ranged(object sender, IEnumerable <IBeacon> e)
        {
            try
            {
                Beacons.Clear();
                foreach (var beacon in e)
                {
                    var imageCellBeacon = new ImageCellBeacon
                    {
                        Text        = beacon.Proximity.ToString(),
                        Detail      = $"{beacon.Major}.{beacon.Minor}",
                        DetailColor =
                            beacon.Uuid == EstimoteConfig.EstimoteUuidVirtual ? "Blue" : "Purple",
                        ImageSource =
                            beacon.Uuid == EstimoteConfig.EstimoteUuidVirtual ? "EstimoteBlue.png"
                                : "EstimotePurple.png",
                    };
                    Beacons.Add(imageCellBeacon);
                }
                _beaconsFound = DateTime.Now;
                DisplayCurrentStatus();
                if (!_timerStarted)
                {
                    Device.StartTimer(TimeSpan.FromSeconds(5), TimerElapsed);
                    _timerStarted = true;
                }

                Debug.WriteLine("Beacons : " + Beacons.Count);
            }
            catch (Exception exception)
            {
                LogStatus = exception.Message;
            }
        }
Пример #2
0
        private bool TimerElapsed()
        {
            var dif = DateTime.Now.Subtract(_beaconsFound);

            Debug.WriteLine("Dif " + dif.Seconds);
            if (dif.Seconds <= 5)
            {
                return(true);
            }
            Beacons.Clear();
            DisplayCurrentStatus();
            return(true);
        }