public override void ViewDidLoad() { base.ViewDidLoad(); TitleLabel.Text = Resources.Clients; SearchTextField.Placeholder = Resources.AddFilterClients; SuggestionsTableView.RegisterNibForCellReuse(ClientViewCell.Nib, ClientViewCell.Identifier); SuggestionsTableView.RegisterNibForCellReuse(CreateClientViewCell.Nib, CreateClientViewCell.Identifier); SuggestionsTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; SuggestionsTableView.Source = tableViewSource; ViewModel.Clients .Subscribe(replaceClients) .DisposedBy(DisposeBag); CloseButton.Rx() .BindAction(ViewModel.Close) .DisposedBy(DisposeBag); SearchTextField.Rx().Text() .Subscribe(ViewModel.FilterText) .DisposedBy(DisposeBag); tableViewSource.ClientSelected .Subscribe(ViewModel.SelectClient.Inputs) .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.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.Clients; SearchTextField.Placeholder = Resources.AddFilterClients; SuggestionsTableView.RegisterNibForCellReuse(ClientViewCell.Nib, ClientViewCell.Identifier); SuggestionsTableView.RegisterNibForCellReuse(CreateClientViewCell.Nib, CreateClientViewCell.Identifier); SuggestionsTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; var tableViewSource = new ClientTableViewSource(SuggestionsTableView); SuggestionsTableView.Source = tableViewSource; var clientsReplay = ViewModel.Clients.Replay(); clientsReplay .Subscribe(SuggestionsTableView.Rx().ReloadItems(tableViewSource)) .DisposedBy(DisposeBag); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { clientsReplay .Select((clients) => { return(new CoreGraphics.CGSize(0, (clients.ToList().Count() * ClientTableViewSource.RowHeight) + headerHeight)); }) .Subscribe(this.Rx().PreferredContentSize()) .DisposedBy(DisposeBag); } clientsReplay.Connect(); CloseButton.Rx().Tap() .Subscribe(ViewModel.CloseWithDefaultResult) .DisposedBy(DisposeBag); SearchTextField.Rx().Text() .Subscribe(ViewModel.FilterText) .DisposedBy(DisposeBag); tableViewSource.Rx().ModelSelected() .Subscribe(ViewModel.SelectClient.Inputs) .DisposedBy(DisposeBag); BottomConstraint.Active |= UIDevice.CurrentDevice.UserInterfaceIdiom != UIUserInterfaceIdiom.Pad; }
public override void ViewDidLoad() { base.ViewDidLoad(); CloseButton.SetTemplateColor(ColorAssets.Text2); SearchView.InsertSeparator(); TitleLabel.Text = Resources.Clients; SearchTextField.Placeholder = Resources.AddFilterClients; SuggestionsTableView.RegisterNibForCellReuse(ClientViewCell.Nib, ClientViewCell.Identifier); SuggestionsTableView.RegisterNibForCellReuse(CreateClientViewCell.Nib, CreateClientViewCell.Identifier); SuggestionsTableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; var tableViewSource = new ClientTableViewSource(SuggestionsTableView); SuggestionsTableView.Source = tableViewSource; tableViewSource.Rx().DragStarted() .Subscribe(_ => SearchTextField.ResignFirstResponder()) .DisposedBy(DisposeBag); var clientsReplay = ViewModel.Clients.Replay(); clientsReplay .Subscribe(SuggestionsTableView.Rx().ReloadItems(tableViewSource)) .DisposedBy(DisposeBag); clientsReplay.Connect(); CloseButton.Rx().Tap() .Subscribe(() => ViewModel.CloseWithDefaultResult()) .DisposedBy(DisposeBag); SearchTextField.Rx().Text() .Subscribe(ViewModel.FilterText) .DisposedBy(DisposeBag); tableViewSource.Rx().ModelSelected() .Subscribe(ViewModel.SelectClient.Inputs) .DisposedBy(DisposeBag); BottomConstraint.Active |= TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Compact; }