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

            TitleLabel.Text             = Resources.CountryOfResidence;
            SearchTextField.Placeholder = Resources.Search;

            CountriesTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            CountriesTableView.RegisterNibForCellReuse(CountryViewCell.Nib, CountryViewCell.Identifier);
            CountriesTableView.RowHeight = rowHeight;

            var source = new CustomTableViewSource <SectionModel <string, SelectableCountryViewModel>, string, SelectableCountryViewModel>(
                CountryViewCell.CellConfiguration(CountryViewCell.Identifier));

            CountriesTableView.Source = source;

            source.Rx().ModelSelected()
            .Subscribe(ViewModel.SelectCountry.Inputs)
            .DisposedBy(DisposeBag);

            ViewModel.Countries
            .Subscribe(CountriesTableView.Rx().ReloadItems(source))
            .DisposedBy(DisposeBag);

            CloseButton.Rx().Tap()
            .Subscribe(ViewModel.CloseWithDefaultResult)
            .DisposedBy(DisposeBag);

            SearchTextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            SearchTextField.BecomeFirstResponder();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TitleLabel.Text             = Resources.CountryOfResidence;
            SearchTextField.Placeholder = Resources.Search;

            CountriesTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
            CountriesTableView.RegisterNibForCellReuse(CountryViewCell.Nib, CountryViewCell.Identifier);
            CountriesTableView.Source = tableViewSource;

            ViewModel.Countries
            .Subscribe(replaceCountries)
            .DisposedBy(DisposeBag);

            CloseButton.Rx()
            .BindAction(ViewModel.Close)
            .DisposedBy(DisposeBag);

            SearchTextField.Rx().Text()
            .Subscribe(ViewModel.FilterText)
            .DisposedBy(DisposeBag);

            tableViewSource.CountrySelected
            .Subscribe(ViewModel.SelectCountry.Inputs)
            .DisposedBy(DisposeBag);

            SearchTextField.BecomeFirstResponder();
        }
Esempio n. 3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Countries = GlobalCountries.GetCountries();
            CountriesTableView.RegisterNibForCellReuse(CountryTableViewCell.Nib, CountryTableViewCell.Key);

            CountriesTableView.Source = new TableSource(Countries, NavController);
            CountriesTableView.ReloadData();

            CountriesSearchBar.AutocorrectionType = UITextAutocorrectionType.No;
            CountriesSearchBar.TextChanged       += CountriesSearchBar_TextChanged;

            ButtonReturn.TouchUpInside += ButtonReturn_TouchUpInside;
        }