Exemplo n.º 1
0
        private void Init(Context context)
        {
            try
            {
                var setupSingleton = MvxAndroidSetupSingleton.EnsureSingletonAvailable(context);
                setupSingleton.EnsureInitialized();

                this.storage             = Mvx.Resolve <IPermanentStorageService>();
                this.notificationService = Mvx.Resolve <INotificationService>();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"[PILLER] Error during NotificationPublisher Init: {ex}");
            }
        }
Exemplo n.º 2
0
        public async Task reloadDataBase()
        {
            IPermanentStorageService storage       = Mvx.Resolve <IPermanentStorageService>();
            INotificationService     notifications = Mvx.Resolve <INotificationService>();
            var items = await storage.List <MedicationDosage>();

            if (items == null)
            {
                return;
            }
            var medicationList = new List <MedicationDosage>(items);

            foreach (var item in medicationList)
            {
                var dosageHours = new List <TimeSpan>();
                var hours       = item.Hours.Split(new string[] { ", " }, StringSplitOptions.None);

                dosageHours = HoursList
                              .Where(h => hours.Contains(h.Name))
                              .Select(i => i.Hour)
                              .ToList();

                if (dosageHours.Count > 0)
                {
                    item.DosageHours = dosageHours;
                    item.RingUri     = ringUri;

                    // szud bi in som separet entity
                    await notifications.CancelAllNotificationsForMedication(item);

                    await storage.SaveAsync <MedicationDosage>(item);

                    await DbHelper.AddNotificationOccurrences(item);

                    await notifications.ScheduleNotifications(item);
                }
            }
        }
Exemplo n.º 3
0
 public DebugController(ActivitiesClient activitiesClient, ICachingService cachingService, IPermanentStorageService permanentStorageService)
 {
     _activitiesClient        = activitiesClient;
     _cachingService          = cachingService;
     _permanentStorageService = permanentStorageService;
 }
Exemplo n.º 4
0
 public CachingService(MemoryCacheService memoryCacheService, IPermanentStorageService permanentStorageService)
 {
     _memoryCacheService      = memoryCacheService;
     _permanentStorageService = permanentStorageService;
 }
Exemplo n.º 5
0
 public ActivitiesClient(IHttpClientFactory httpClientFactory, ICachingService cachingService, IPermanentStorageService permanentStorageService) : base(
         httpClientFactory)
 {
     _cachingService          = cachingService;
     _permanentStorageService = permanentStorageService;
 }