예제 #1
0
        private async void LoadItems()
        {
            int countNewNotification = 0;
            var items = await _cache.GetLocalObject <ObservableCollection <Item> >(CacheKeyDictionary.ItemList);

            if (items == null || items.Count == 0)
            {
                return;
            }

            Items           = items;
            ItemsByCategory = new ObservableCollection <Item>(Items);
            DateTime?lastCheck = await _cache.GetLocalObject <DateTime>(CacheKeyDictionary.LastCheck);

            if (lastCheck == null || lastCheck.Value.Date == DateTime.MinValue.Date)
            {
                lastCheck = DateTime.Parse("1/1/2017");
            }

            foreach (var item in items)
            {
                if (item.Date == lastCheck?.Date)
                {
                    countNewNotification++;
                }
            }

            ShowNotification(countNewNotification);
        }
예제 #2
0
        private async void LoadMenu()
        {
            var categories = await _cache.GetLocalObject <ObservableCollection <Category> >(CacheKeyDictionary.CategoryItems);

            if (categories?.Count > 0)
            {
                MenuItems = new ObservableCollection <Category>(categories);
            }
            else
            {
                MenuItems = new ObservableCollection <Category>
                {
                    new Category()
                    {
                        DisplayName = "Privado"
                    },
                    new Category()
                    {
                        DisplayName = "Familia"
                    },
                    new Category()
                    {
                        DisplayName = "Trabajo"
                    }
                };
                await _cache.InsertLocalObject(CacheKeyDictionary.CategoryItems, MenuItems);
            }
        }