예제 #1
0
		protected Element CreateElement(RepositoryDetailedModel repo)
        {
            var description = ViewModel.ShowRepositoryDescription ? repo.Description : string.Empty;
            var sse = new RepositoryElement(repo.Name, description, repo.Owner, new Avatar(repo.Logo));
            sse.Tapped += () => ViewModel.GoToRepositoryCommand.Execute(repo);
            return sse;
        }
예제 #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TableView.RowHeight = UITableView.AutomaticDimension;
            TableView.EstimatedRowHeight = 80f;

			var vm = (RepositoriesExploreViewModel)ViewModel;
            var search = (UISearchBar)TableView.TableHeaderView;

			BindCollection(vm.Repositories, repo =>
            {
				var description = vm.ShowRepositoryDescription ? repo.Description : string.Empty;
                var sse = new RepositoryElement(repo.Name, description, repo.Owner, new Avatar(repo.Logo));
				sse.Tapped += () => vm.GoToRepositoryCommand.Execute(repo);
                return sse;
            });

            OnActivation(d =>
            {
                d(vm.Bind(x => x.IsSearching).SubscribeStatus("Searching..."));
                d(vm.Bind(x => x.SearchText).Subscribe(x => search.Text = x));
                d(search.GetChangedObservable().Subscribe(x => vm.SearchText = x));
                d(search.GetSearchObservable().Subscribe(_ => {
                    search.ResignFirstResponder();
                    vm.SearchCommand.Execute(null);
                }));
            });
        }