Пример #1
0
        public async void Enable(Guid alarmId)
        {
            var alarm = await alarmDatabase.GetAlarmAsync(alarmId);

            alarm.IsRunning = true;
            await alarmDatabase.UpdateAlarmAsync(alarm);

            gpsListener.AddObserver(alarmId);
        }
        public async Task UpdatePosition(Position position, Guid alarmId)
        {
            var alarm = await alarmDatabase.GetAlarmAsync(alarmId);

            var currentDistance = CalculateDistance(position, alarm);

            if (currentDistance <= alarm.Distance)
            {
                notificationService.LocalNotification("Alarm", "Wyłącz alarm", alarmId);
            }
        }