public override void ViewDidLoad() { base.ViewDidLoad(); var titleButton = new TrendingTitleButton { Frame = new RectangleF(0, 0, 200f, 32f) }; titleButton.TouchUpInside += (sender, e) => ViewModel.GoToLanguages.ExecuteIfCan(); ViewModel.WhenAnyValue(x => x.SelectedLanguage).Subscribe(x => titleButton.Text = x.Name); NavigationItem.TitleView = titleButton; var source = new RepositoryTableViewSource(TableView); TableView.Source = source; ViewModel.WhenAnyValue(x => x.Repositories) .Where(x => x != null) .Subscribe(x => { source.Data = x.Select(g => { var t = new TableSectionInformation <RepositoryItemViewModel, RepositoryCellView>(g.Items, RepositoryCellView.Key, 64f); t.Header = new TableSectionHeader(() => CreateHeaderView(g.Name), 26f); return(t); }).ToList(); }); }
public RepositoriesTrendingViewController() { _trendingTitleButton = new TrendingTitleButton { Frame = new CGRect(0, 0, 200f, 32f) }; _trendingTitleButton.TouchUpInside += (sender, e) => ViewModel.GoToLanguages.ExecuteIfCan(); }
public override void ViewDidLoad() { base.ViewDidLoad(); EmptyView = new Lazy <UIView>(() => new EmptyListView(Octicon.Pulse.ToEmptyListImage(), "There are no repositories.")); var titleButton = new TrendingTitleButton { Frame = new CGRect(0, 0, 200f, 32f), TintColor = Theme.PrimaryNavigationBarTextColor }; NavigationItem.TitleView = titleButton; titleButton.TouchUpInside += (sender, e) => ViewModel.GoToLanguages.ExecuteIfCan(); this.WhenAnyValue(x => x.ViewModel.SelectedLanguage).IsNotNull() .Subscribe(x => titleButton.Text = x.Name); var source = new RepositoryTableViewSource(TableView); TableView.Source = source; this.WhenAnyValue(x => x.ViewModel.Repositories) .Select(x => x ?? new List <GroupedCollection <RepositoryItemViewModel> >()) .Select(x => x.Select(g => new TableSectionInformation <RepositoryItemViewModel, RepositoryCellView>(g.Items, RepositoryCellView.Key, (float)UITableView.AutomaticDimension) { Header = new TableSectionHeader(() => CreateHeaderView(g.Name), 26f) })) .Subscribe(x => source.Data = x.ToList()); }
public RepositoriesTrendingView() { var titleButton = new TrendingTitleButton { Frame = new CGRect(0, 0, 200f, 32f), TintColor = Theme.PrimaryNavigationBarTextColor }; NavigationItem.TitleView = titleButton; titleButton.TouchUpInside += (sender, e) => ViewModel.GoToLanguages.ExecuteIfCan(); this.WhenAnyValue(x => x.ViewModel.SelectedLanguage).IsNotNull() .Subscribe(x => titleButton.Text = x.Name); EmptyView = new Lazy <UIView>(() => new EmptyListView(Octicon.Pulse.ToEmptyListImage(), "There are no trending repositories.")); Appearing .Where(_ => NavigationController != null) .Subscribe(_ => NavigationController.NavigationBar.ShadowImage = new UIImage()); Disappearing .Where(_ => NavigationController != null) .Subscribe(_ => NavigationController.NavigationBar.ShadowImage = null); }
public override void ViewDidLoad() { base.ViewDidLoad(); var titleButton = new TrendingTitleButton { Frame = new RectangleF(0, 0, 200f, 32f), TintColor = _themeService.CurrentTheme.NavigationBarTextColor }; titleButton.TouchUpInside += (sender, e) => ViewModel.GoToLanguages.ExecuteIfCan(); NavigationItem.TitleView = titleButton; var source = new RepositoryTableViewSource(TableView); TableView.Source = source; this.WhenViewModel(x => x.Repositories) .Subscribe(x => { if (x == null) { source.Data = new List <TableSectionInformation <RepositoryItemViewModel, RepositoryCellView> >(); } else { source.Data = x.Select(g => new TableSectionInformation <RepositoryItemViewModel, RepositoryCellView>(g.Items, RepositoryCellView.Key, 64f) { Header = new TableSectionHeader(() => CreateHeaderView(g.Name), 26f) }).ToList(); } }); this.WhenViewModel(x => x.SelectedLanguage) .Subscribe(x => titleButton.Text = x.Name); }