示例#1
0
        protected BaseRepositoriesViewController()
            : base(unevenRows: true)
        {
            SearchTextChanging.Where(x => ViewModel != null).Subscribe(x => ViewModel.SearchKeyword = x);

            this.WhenAnyValue(x => x.ViewModel)
            .Where(x => x != null)
            .Select(x => x.Repositories.Changed.StartWith(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)))
            .Switch()
            .Subscribe(_ =>
            {
                var sec = new Section();
                sec.AddAll(
                    from x in ViewModel.Repositories
                    select new RepositoryElement(x.Owner, x.Name, x.Description, x.ImageUrl, () => ViewModel.GoToRepositoryCommand.ExecuteIfCan(x)));
                Root.Reset(sec);
            });
        }
示例#2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SearchTextChanging.Where(x => ViewModel != null).Subscribe(x => ViewModel.SearchKeyword = x);

            TableView.RegisterNibForCellReuse(RepositoryTableViewCell.Nib, RepositoryTableViewCell.Key);
            TableView.RowHeight          = UITableView.AutomaticDimension;
            TableView.EstimatedRowHeight = 80f;

            this.WhenAnyValue(x => x.ViewModel)
            .Where(x => x != null)
            .Select(x => x.Repositories.Changed.StartWith(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)))
            .Switch()
            .Subscribe(_ =>
            {
                var sec = new Section();
                sec.AddAll(
                    from x in ViewModel.Repositories
                    select new RepositoryElement(x.Owner, x.Name, x.Description, x.ImageUrl, () => ViewModel.GoToRepositoryCommand.ExecuteIfCan(x)));
                Root.Reset(sec);
            });
        }