Esempio n. 1
0
        public HomePageViewModel(IMyService myService)
        {
            _myService = myService;

            if (AppCache.Default.Has("items"))
            {
                Items = new ObservableCollection <Item>(AppCache.Default.Get <List <Item> >("items"));
                Debug.WriteLine("Items from cache");
            }
            else
            {
                var items = _myService.GetAll();
                Items = new ObservableCollection <Item>(items);
                AppCache.Default.Add("items", items);
            }
            CreatedTime = "Create view model  at " + DateTime.Now.ToString("HH:mm:ss");
        }