protected override async Task <IEnumerable <AppItem> > LoadItemsImpl()
        {
            var result = await Task <List <AppItem> > .Run(() =>
            {
                using (var db = DbService.GetDb())
                {
                    var manager = new AppItemManager(db);
                    var lst     = manager.GetUserApps(_user);
                    return(lst);
                }
            });

            return(result);
        }
Exemple #2
0
        public AppMenuViewModel()
        {
            Items     = new ReactiveList <AppItem>();
            LoadItems = ReactiveCommand.Create(
                () =>
            {
                using (var db = DbService.GetDb())
                {
                    var manager = new AppItemManager(db);
                    var result  = manager.GetUserApps(DbService.CurrentUser);
                    Items.ReplaceRange(result);
                }
            });

            LoadItems.Execute().Subscribe(_ =>
            {
                SelectedItem = Items.FirstOrDefault(p => p.Code == GlobalService.AppSettings.LastAppCode);
                if (SelectedItem == null)
                {
                    SelectedItem = Items.FirstOrDefault();
                }
            });
        }