Пример #1
0
        public void favButtonPressed(UIButton favBtn)
        {
            Console.WriteLine("Favorite Button Pressed: {0}", favBtn);
            RSSItem item = BNRFeedStore.items[(int)favBtn.Tag];

            BNRFeedStore.markItemAsFavorite(item);
            this.TableView.ReloadData();
        }
Пример #2
0
        void fetchEntries()
        {
            UIView currentTitleView = this.NavigationItem.TitleView;

            // Create an activity indicator and start it spinning
            UIActivityIndicatorView aiView = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White);

            this.NavigationItem.TitleView = aiView;
            aiView.StartAnimating();

            BNRFeedStore.Block completionBlock = delegate(string error) {
                this.NavigationItem.TitleView = currentTitleView;
                if (error == "success")
                {
                    if (rssType == ListViewControllerRSSType.BNRFeed)
                    {
                        int newItemCount = BNRFeedStore.items.Count;
                        int itemDelta    = newItemCount - currentItemCount;
                        if (itemDelta > 0)
                        {
                            List <NSIndexPath> rows = new List <NSIndexPath>();
                            for (int i = 0; i < itemDelta; i++)
                            {
                                NSIndexPath ip = NSIndexPath.FromRowSection(i, 0);
                                rows.Add(ip);
                            }
                            this.TableView.InsertRows(rows.ToArray(), UITableViewRowAnimation.Top);
                            this.TableView.ReloadData();
                        }
                    }
                    else
                    {
                        this.TableView.ReloadData();
                    }
                }
                else
                {
                    UIAlertView av = new UIAlertView("Error", error, null, "OK", null);
                    av.Show();
                }
            };
            if (rssType == ListViewControllerRSSType.BNRFeed)
            {
                BNRFeedStore.FetchRSSFeed(completionBlock);
                currentItemCount = BNRFeedStore.items.Count;
                this.TableView.ReloadData();
            }
            else if (rssType == ListViewControllerRSSType.Apple)
            {
                BNRFeedStore.FetchRSSFeedTopSongs(numberOfSongsToGet, completionBlock);
            }
        }
Пример #3
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            if (this.SplitViewController == null)
            {
                // Push the web view controller onto the navigation stack
                // this implicitly creates the web view controller's view the first time through
                this.NavigationController.PushViewController(webViewController, true);
            }
            else
            {
                this.transferBarButtonItem(webViewController);
                // We have to create a new Navigation controller, as the old one
                // was only retained by the split view controller and is now gone
                UINavigationController nav = new UINavigationController(webViewController);

                UIViewController[] vcs = new UIViewController[] { this.NavigationController, nav };

                this.SplitViewController.ViewControllers = vcs;

                // Make the detail view controller the delegate of the split view controller
                // - ignore this warning
                this.SplitViewController.WeakDelegate = webViewController;
                if (webViewController.popover != null)
                {
                    webViewController.popover.Dismiss(true);
                }
            }

            // grab the selected item
            RSSItem entry = BNRFeedStore.items[indexPath.Row];

            if (rssType == ListViewControllerRSSType.BNRFeed)
            {
                entry.isRead = true;
                BNRFeedStore.updateItem(entry);
                tableView.CellAt(indexPath).Accessory = UITableViewCellAccessory.Checkmark;
            }

            webViewController.listViewControllerHandleObject(this, entry);
        }