コード例 #1
0
        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);
        }