public override void ViewDidLoad() { base.ViewDidLoad(); var tableViewSource = new SelectTagsTableViewSource(TagsTableView); tableViewSource.Rx().ModelSelected() .Subscribe(ViewModel.SelectTag.Inputs) .DisposedBy(DisposeBag); var tagsReplay = ViewModel.Tags.Replay(); tagsReplay .Subscribe(TagsTableView.Rx().ReloadItems(tableViewSource)) .DisposedBy(DisposeBag); if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) { tagsReplay .Select((tags) => { var count = tags.ToList().Count(); var contentHeight = count > 0 ? count * SelectTagsTableViewSource.RowHeight : placeholderHeight; return(new CoreGraphics.CGSize(0, contentHeight + headerHeight)); }) .Subscribe(this.Rx().PreferredContentSize()) .DisposedBy(DisposeBag); } tagsReplay.Connect(); ViewModel.IsEmpty .Subscribe(EmptyStateImage.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.IsEmpty .Subscribe(EmptyStateLabel.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.FilterText .Subscribe(TextField.Rx().TextObserver()) .DisposedBy(DisposeBag); CloseButton.Rx().Tap() .Subscribe(ViewModel.CloseWithDefaultResult) .DisposedBy(DisposeBag); SaveButton.Rx() .BindAction(ViewModel.Save) .DisposedBy(DisposeBag); TextField.Rx().Text() .Subscribe(ViewModel.FilterText) .DisposedBy(DisposeBag); BottomConstraint.Active |= UIDevice.CurrentDevice.UserInterfaceIdiom != UIUserInterfaceIdiom.Pad; }
public override void ViewDidLoad() { base.ViewDidLoad(); CloseButton.SetTemplateColor(ColorAssets.Text2); SearchView.InsertSeparator(); TitleLabel.Text = Resources.Tags; TextField.Placeholder = Resources.AddFilterTags; EmptyStateLabel.Text = Resources.EmptyTagText; SaveButton.SetTitle(Resources.Save, UIControlState.Normal); var tableViewSource = new SelectTagsTableViewSource(TagsTableView); tableViewSource.Rx().ModelSelected() .Subscribe(ViewModel.SelectTag.Inputs) .DisposedBy(DisposeBag); tableViewSource.Rx().DragStarted() .Subscribe(_ => TextField.ResignFirstResponder()) .DisposedBy(DisposeBag); var tagsReplay = ViewModel.Tags.Replay(); tagsReplay .Subscribe(TagsTableView.Rx().ReloadItems(tableViewSource)) .DisposedBy(DisposeBag); tagsReplay.Connect(); ViewModel.IsEmpty .Subscribe(EmptyStateImage.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.IsEmpty .Subscribe(EmptyStateLabel.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.FilterText .Subscribe(TextField.Rx().TextObserver()) .DisposedBy(DisposeBag); CloseButton.Rx().Tap() .Subscribe(() => ViewModel.CloseWithDefaultResult()) .DisposedBy(DisposeBag); SaveButton.Rx() .BindAction(ViewModel.Save) .DisposedBy(DisposeBag); TextField.Rx().Text() .Subscribe(ViewModel.FilterText) .DisposedBy(DisposeBag); BottomConstraint.Active |= TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Compact; }
public override void ViewDidLoad() { base.ViewDidLoad(); var tableViewSource = new SelectTagsTableViewSource(TagsTableView); tableViewSource.Rx().ModelSelected() .Subscribe(ViewModel.SelectTag.Inputs) .DisposedBy(DisposeBag); ViewModel.Tags .Subscribe(TagsTableView.Rx().ReloadItems(tableViewSource)) .DisposedBy(DisposeBag); ViewModel.IsEmpty .Subscribe(EmptyStateImage.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.IsEmpty .Subscribe(EmptyStateLabel.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.FilterText .Subscribe(TextField.Rx().TextObserver()) .DisposedBy(DisposeBag); CloseButton.Rx() .BindAction(ViewModel.Close) .DisposedBy(DisposeBag); SaveButton.Rx() .BindAction(ViewModel.Save) .DisposedBy(DisposeBag); TextField.Rx().Text() .Subscribe(ViewModel.FilterText) .DisposedBy(DisposeBag); }