public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            DismissButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) =>
                {
                    ViewedPreviously = true;
                    this.DismissViewControllerAsync(true);
                });
            NavBarItem.RightBarButtonItem = DismissButton;
            myNavBar.SetItems(new UINavigationItem[]{NavBarItem}, true);
            Console.WriteLine(Favorites.Count);
            FavoriteCatTableSource = new FavoriteCategoryTableSource(this, Favorites);
            FavoriteCatTableView.Source = FavoriteCatTableSource;

            FavoriteCatTableSource.Selected += (object sender, FavoriteSelectedEventArgs e) => {
                if (this.FavoriteSelected != null)
                    this.FavoriteSelected(this, e);
            };

            sender.PageReloaded += (object sender, EventArgs e) => {
                Favorites = AppDelegate.databaseConnection.GetAllFavoriteCategoriesAsync().Result;
                Favorites.Sort((s1, s2)=>s2.Updated.CompareTo(s1.Updated));
                this.InvokeOnMainThread(() => {
                    FavoriteCatTableView.ReloadData();
                    this.View.SetNeedsDisplay();
                });
            };
        }
Esempio n. 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            DismissButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) =>
            {
                ViewedPreviously = true;
                this.DismissViewControllerAsync(true);
            });
            NavBarItem.RightBarButtonItem = DismissButton;
            myNavBar.SetItems(new UINavigationItem[] { NavBarItem }, true);
            Console.WriteLine(Favorites.Count);
            FavoriteCatTableSource      = new FavoriteCategoryTableSource(this, Favorites);
            FavoriteCatTableView.Source = FavoriteCatTableSource;

            FavoriteCatTableSource.Selected += (object sender, FavoriteSelectedEventArgs e) => {
                if (this.FavoriteSelected != null)
                {
                    this.FavoriteSelected(this, e);
                }
            };

            sender.PageReloaded += (object sender, EventArgs e) => {
                Favorites = AppDelegate.databaseConnection.GetAllFavoriteCategoriesAsync().Result;
                Favorites.Sort((s1, s2) => s2.Updated.CompareTo(s1.Updated));
                this.InvokeOnMainThread(() => {
                    FavoriteCatTableView.ReloadData();
                    this.View.SetNeedsDisplay();
                });
            };
        }