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(); }
void ReleaseDesignerOutlets() { if (CountriesSearchBar != null) { CountriesSearchBar.Dispose(); CountriesSearchBar = null; } if (CountriesTableView != null) { CountriesTableView.Dispose(); CountriesTableView = null; } if (CountriesTextField != null) { CountriesTextField.Dispose(); CountriesTextField = null; } if (ButtonReturn != null) { ButtonReturn.Dispose(); ButtonReturn = null; } }
void ReleaseDesignerOutlets() { if (BottomConstraint != null) { BottomConstraint.Dispose(); BottomConstraint = null; } if (CloseButton != null) { CloseButton.Dispose(); CloseButton = null; } if (CountriesTableView != null) { CountriesTableView.Dispose(); CountriesTableView = null; } if (SearchTextField != null) { SearchTextField.Dispose(); SearchTextField = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } }
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(); }
private void CountriesSearchBar_TextChanged(object sender, UISearchBarTextChangedEventArgs e) { if (CountriesSearchBar.Text != string.Empty) { var data = Countries.Where(a => a.CountryName.ToLowerInvariant().StartsWith(CountriesSearchBar.Text.ToLowerInvariant())).ToList(); CountriesTableView.Source = new TableSource(data, NavController); } else { CountriesTableView.Source = new TableSource(Countries, NavController); } CountriesTableView.ReloadData(); }
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; }
private void replaceCountries(IEnumerable <SelectableCountryViewModel> countries) { tableViewSource.SetNewCountries(countries); CountriesTableView.ReloadData(); }