Ejemplo n.º 1
0
 public TaskViewModel()
 {
     search = new SearchForm()
     {
         Page   = 0,
         Status = 1
     };
     Items = new IncrementalLoadingCollection <TaskItem>(count =>
     {
         return(Task.Run(async() =>
         {
             search.Page++;
             var data = await App.Repository.Task.GetTaskAsync(search);
             if (data == null)
             {
                 return Tuple.Create <IList <TaskItem>, bool>(null, false);
             }
             return Tuple.Create(data.Data, data.Paging.More);
         }));
     });
     StatusItems.Add(new TabItem(1, Constants.GetString("task_tab_1")));
     StatusItems.Add(new TabItem(2, Constants.GetString("task_tab_2")));
 }
Ejemplo n.º 2
0
 public ArticleViewModel()
 {
     search = new SearchForm()
     {
         Page = 0
     };
     Items = new IncrementalLoadingCollection <Article>(count =>
     {
         return(Task.Run(async() =>
         {
             search.Page++;
             var data = await App.Repository.Article.GetPageAsync(search);
             if (data == null)
             {
                 return Tuple.Create <IList <Article>, bool>(null, false);
             }
             return Tuple.Create(data.Data, data.Paging.More);
         }));
     });
     SortItems.Add(new TabItem("new", Constants.GetString("article_tab_new")));
     SortItems.Add(new TabItem("hot", Constants.GetString("article_tab_hot")));
     SortItems.Add(new TabItem("recommend", Constants.GetString("article_tab_best")));
     _ = LoadCategories();
 }