public override void ViewDidLoad() { base.ViewDidLoad(); prepareViews(); prepareIndicatorView(); this.Bind(CloseButton.Rx().Tap(), ViewModel.CloseButtonTapped); this.Bind(FeedbackTextView.Rx().Text(), ViewModel.FeedbackText); this.Bind(ErrorView.Rx().Tap(), ViewModel.ErrorViewTapped); this.Bind(SendButton.Rx().Tap(), ViewModel.SendButtonTapped); SendButton.TouchUpInside += (sender, args) => { FeedbackTextView.ResignFirstResponder(); }; this.Bind(ViewModel.IsFeedbackEmpty, FeedbackPlaceholderTextView.Rx().IsVisible()); this.Bind(ViewModel.Error.Select(NotNull), ErrorView.Rx().AnimatedIsVisible()); this.Bind(ViewModel.SendEnabled, SendButton.Rx().Enabled()); this.Bind(ViewModel.IsLoading.Invert(), SendButton.Rx().IsVisible()); this.Bind(ViewModel.IsLoading.Invert(), CloseButton.Rx().IsVisible()); this.Bind(ViewModel.IsLoading, IndicatorView.Rx().IsVisible()); this.Bind(ViewModel.IsLoading, UIApplication.SharedApplication.Rx().NetworkActivityIndicatorVisible()); }
public override void ViewDidLoad() { base.ViewDidLoad(); TitleLabel.Text = Resources.ContactUs; FeedbackPlaceholderTextView.Text = Resources.FeedbackFieldPlaceholder; ErrorTitleLabel.Text = Resources.Oops.ToUpper(); ErrorMessageLabel.Text = Resources.SomethingWentWrongTryAgain; SendButton.SetTitle(Resources.Send, UIControlState.Normal); prepareViews(); prepareIndicatorView(); CloseButton.Rx() .BindAction(ViewModel.Close) .DisposedBy(DisposeBag); FeedbackTextView.Rx().Text() .Subscribe(ViewModel.FeedbackText) .DisposedBy(DisposeBag); ErrorView.Rx() .BindAction(ViewModel.DismissError) .DisposedBy(DisposeBag); SendButton.Rx() .BindAction(ViewModel.Send) .DisposedBy(DisposeBag); SendButton.TouchUpInside += (sender, args) => { FeedbackTextView.ResignFirstResponder(); }; ViewModel.IsFeedbackEmpty .Subscribe(FeedbackPlaceholderTextView.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.Error .Select(NotNull) .Subscribe(ErrorView.Rx().AnimatedIsVisible()) .DisposedBy(DisposeBag); ViewModel.SendEnabled .Subscribe(SendButton.Rx().Enabled()) .DisposedBy(DisposeBag); ViewModel.IsLoading .Invert() .Subscribe(SendButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.IsLoading .Invert() .Subscribe(CloseButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.IsLoading .Subscribe(IndicatorView.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.IsLoading .Subscribe(UIApplication.SharedApplication.Rx().NetworkActivityIndicatorVisible()) .DisposedBy(DisposeBag); }