Ejemplo n.º 1
0
        public CategoryVM(User _user)
        {
            Title = "Категории";
            User  = _user;

            Categories       = new ObservableCollection <Category>();
            repository       = new CategoryRepository(User);
            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());

            MessagingCenter.Subscribe <NewCategoryPage, Category>(this, "AddCategory", async(obj, item) =>
            {
                var newItem = item as Category;
                Categories.Add(newItem);
                await repository.AddItemAsync(newItem);
            });
        }