Ejemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            categoryTableSource      = new CategoryTableViewSource(Categories.Groups);
            categoryTableView.Source = categoryTableSource;
            favoritesVC = new FavoriteCategoryViewController(this);

            Favorites = new UIBarButtonItem(
                UIImage.FromBundle("favorites.png"),
                UIBarButtonItemStyle.Plain,
                (object sender, EventArgs e) => {
                if (favoritesVC.ViewedPreviously)
                {
                    if (this.PageReloaded != null)
                    {
                        this.PageReloaded(this, new EventArgs());
                    }
                    else
                    {
                        favoritesVC.Favorites = AppDelegate.databaseConnection.GetAllFavoriteCategoriesAsync().Result;
                    }
                }

                this.PresentModalViewController(favoritesVC, true);
            });

            categoryTableSource.Favorited += delegate { favoritesVC.ViewedPreviously = true; };

            NavigationItem.RightBarButtonItem = Favorites;
            favoritesVC.FavoriteSelected     += FavoritesVC_Selected;

            categoryTableSource.Selected += CategoryTableSource_Selected;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            categoryTableSource = new CategoryTableViewSource(Categories.Groups);
            categoryTableView.Source = categoryTableSource;
            favoritesVC = new FavoriteCategoryViewController(this);

            Favorites = new UIBarButtonItem (
                UIImage.FromBundle("favorites.png"),
                UIBarButtonItemStyle.Plain,
                (object sender, EventArgs e) => {
                    if (favoritesVC.ViewedPreviously)
                    {
                        if (this.PageReloaded != null)
                            this.PageReloaded(this, new EventArgs());
                        else
                            favoritesVC.Favorites = AppDelegate.databaseConnection.GetAllFavoriteCategoriesAsync().Result;
                    }

                    this.PresentModalViewController(favoritesVC, true);
            });

            categoryTableSource.Favorited += delegate { favoritesVC.ViewedPreviously = true; };

            NavigationItem.RightBarButtonItem = Favorites;
            favoritesVC.FavoriteSelected += FavoritesVC_Selected;

            categoryTableSource.Selected += CategoryTableSource_Selected;
        }
        public FavoriteCategoryTableSource(FavoriteCategoryViewController owner, List<FavoriteCategory> favorites)
        {
//            this.favorites = favorites;
            this.owner = owner;
        }
Ejemplo n.º 4
0
        public FavoriteCategoryTableSource(FavoriteCategoryViewController owner, List <FavoriteCategory> favorites)
        {
//            this.favorites = favorites;
            this.owner = owner;
        }