public override void ViewDidLoad() { base.ViewDidLoad(); CreateWorkspaceButton.SetTitle(Resources.CreateNewWorkspace, UIControlState.Normal); HeadingLabel.Text = Resources.UhOh; TextLabel.Text = Resources.NoWorkspaceErrorMessage; var screenWidth = UIScreen.MainScreen.Bounds.Width; PreferredContentSize = new CGSize { // ScreenWidth - 32 for 16pt margins on both sides Width = screenWidth > 320 ? screenWidth - 32 : 312, Height = cardHeight }; prepareViews(); CreateWorkspaceButton.Rx() .BindAction(ViewModel.CreateWorkspaceWithDefaultName) .DisposedBy(DisposeBag); TryAgainButton.Rx() .BindAction(ViewModel.TryAgain) .DisposedBy(DisposeBag); ViewModel.IsLoading .Invert() .Subscribe(CreateWorkspaceButton.Rx().Enabled()) .DisposedBy(DisposeBag); ViewModel.IsLoading .Invert() .Subscribe(TryAgainButton.Rx().IsVisibleWithFade()) .DisposedBy(DisposeBag); ViewModel.IsLoading.StartWith(false) .Subscribe(ActivityIndicatorView.Rx().IsVisibleWithFade()) .DisposedBy(DisposeBag); }
public override void ViewDidLoad() { base.ViewDidLoad(); var screenWidth = UIScreen.MainScreen.Bounds.Width; PreferredContentSize = new CGSize { // ScreenWidth - 32 for 16pt margins on both sides Width = screenWidth > 320 ? screenWidth - 32 : 312, Height = cardHeight }; prepareViews(); this.Bind(CreateWorkspaceButton.Rx().Tap(), ViewModel.CreateWorkspaceWithDefaultName); this.Bind(TryAgainButton.Rx().Tap(), ViewModel.TryAgain); this.Bind(ViewModel.IsLoading.Select(CommonFunctions.Invert), CreateWorkspaceButton.Rx().Enabled()); this.Bind(ViewModel.IsLoading.Select(CommonFunctions.Invert), TryAgainButton.Rx().IsVisibleWithFade()); this.Bind(ViewModel.IsLoading.StartWith(false), ActivityIndicatorView.Rx().IsVisibleWithFade()); }
public override void ViewDidLoad() { base.ViewDidLoad(); CreateWorkspaceButton.SetTitle(Resources.CreateNewWorkspace, UIControlState.Normal); HeadingLabel.Text = Resources.UhOh; TextLabel.Text = Resources.NoWorkspaceErrorMessage; var tryAgainString = string.Format(Resources.NoWorkspaceOr, Resources.NoWorkspaceTryAgain); var rangeStart = tryAgainString.IndexOf(Resources.NoWorkspaceTryAgain, System.StringComparison.CurrentCulture); var rangeEnd = Resources.NoWorkspaceTryAgain.Length; var range = new NSRange(rangeStart, rangeEnd); var attributedString = new NSMutableAttributedString( tryAgainString, new UIStringAttributes { ForegroundColor = ColorAssets.Text }); attributedString.AddAttributes( new UIStringAttributes { ForegroundColor = Colors.NoWorkspace.ActivityIndicator.ToNativeColor() }, range); TryAgainButton.SetAttributedTitle(attributedString, UIControlState.Normal); var screenWidth = UIScreen.MainScreen.Bounds.Width; PreferredContentSize = new CGSize { // ScreenWidth - 32 for 16pt margins on both sides Width = screenWidth > 320 ? screenWidth - 32 : 312, Height = cardHeight }; prepareViews(); CreateWorkspaceButton.Rx() .BindAction(ViewModel.CreateWorkspaceWithDefaultName) .DisposedBy(DisposeBag); TryAgainButton.Rx() .BindAction(ViewModel.TryAgain) .DisposedBy(DisposeBag); ViewModel.IsLoading .Invert() .Subscribe(CreateWorkspaceButton.Rx().Enabled()) .DisposedBy(DisposeBag); ViewModel.IsLoading .Invert() .Subscribe(TryAgainButton.Rx().IsVisibleWithFade()) .DisposedBy(DisposeBag); ViewModel.IsLoading.StartWith(false) .Subscribe(ActivityIndicatorView.Rx().IsVisibleWithFade()) .DisposedBy(DisposeBag); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = Resources.LoginTitle; ResetSuccessLabel.Text = Resources.APITokenResetSuccess; InstructionLabel.Text = Resources.TokenResetInstruction; PasswordTextField.Placeholder = Resources.Password; SignOutButton.SetTitle(Resources.OrSignOut, UIControlState.Normal); prepareViews(); ViewModel.Error .Subscribe(ErrorLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.Email .SelectToString() .Subscribe(EmailLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.Password .Subscribe(PasswordTextField.Rx().TextObserver()) .DisposedBy(DisposeBag); PasswordTextField.Rx().Text() .Subscribe(ViewModel.Password) .DisposedBy(DisposeBag); ViewModel.IsPasswordMasked .Subscribe(PasswordTextField.Rx().SecureTextEntry()) .DisposedBy(DisposeBag); SignOutButton.Rx() .BindAction(ViewModel.SignOut) .DisposedBy(DisposeBag); ShowPasswordButton.Rx() .BindAction(ViewModel.TogglePasswordVisibility) .DisposedBy(DisposeBag); nextButton.Rx().Tap() .Subscribe(ViewModel.Done.Inputs) .DisposedBy(DisposeBag); PasswordTextField.Rx().ShouldReturn() .Subscribe(ViewModel.Done.Inputs) .DisposedBy(DisposeBag); //Enabled ViewModel.NextIsEnabled .Subscribe(nextButton.Rx().Enabled()) .DisposedBy(DisposeBag); //Visibility ViewModel.HasError .Subscribe(ErrorView.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.Done.Executing .Invert() .Subscribe(ShowPasswordButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.Done.Executing .Subscribe(ActivityIndicatorView.Rx().IsVisible()) .DisposedBy(DisposeBag); PasswordTextField.BecomeFirstResponder(); }
public override void ViewDidLoad() { base.ViewDidLoad(); Title = Resources.LoginTitle; ResetSuccessLabel.Text = Resources.APITokenResetSuccess; InstructionLabel.Text = Resources.TokenResetInstruction; PasswordTextField.Placeholder = Resources.Password; SignOutButton.SetTitle(Resources.OrSignOut, UIControlState.Normal); EmailLabel.Text = ViewModel.Email.ToString(); ViewModel.Error .Subscribe(ErrorLabel.Rx().Text()) .DisposedBy(DisposeBag); ViewModel.Password .Subscribe(PasswordTextField.Rx().TextObserver()) .DisposedBy(DisposeBag); PasswordTextField.Rx().Text() .Subscribe(ViewModel.Password) .DisposedBy(DisposeBag); SignOutButton.Rx() .BindAction(ViewModel.SignOut) .DisposedBy(DisposeBag); ViewModel.SignOut.Elements .Subscribe(IosDependencyContainer.Instance.IntentDonationService.ClearAll) .DisposedBy(DisposeBag); ShowPasswordButton.Rx().Tap() .Subscribe(_ => { PasswordTextField.ResignFirstResponder(); PasswordTextField.SecureTextEntry = !PasswordTextField.SecureTextEntry; PasswordTextField.BecomeFirstResponder(); }) .DisposedBy(DisposeBag); LoginButton.Rx().Tap() .Subscribe(ViewModel.Done.Inputs) .DisposedBy(DisposeBag); PasswordTextField.Rx().ShouldReturn() .Subscribe(ViewModel.Done.Inputs) .DisposedBy(DisposeBag); //Enabled ViewModel.NextIsEnabled .Subscribe(LoginButton.Rx().Enabled()) .DisposedBy(DisposeBag); //Visibility ErrorLabel.Hidden = true; ViewModel.HasError .Subscribe(ErrorLabel.Rx().AnimatedIsVisible()) .DisposedBy(DisposeBag); ViewModel.Done.Executing .Invert() .Subscribe(ShowPasswordButton.Rx().IsVisible()) .DisposedBy(DisposeBag); ViewModel.Done.Executing .Subscribe(ActivityIndicatorView.Rx().IsVisibleWithFade()) .DisposedBy(DisposeBag); ViewModel.Done.Executing.Select(loginButtonTitle) .Subscribe(LoginButton.Rx().AnimatedTitle()) .DisposedBy(DisposeBag); PasswordTextField.BecomeFirstResponder(); ShowPasswordButton.SetupShowPasswordButton(); //Color ViewModel.HasError .Select(loginButtonTintColor) .Subscribe(LoginButton.Rx().TintColor()) .DisposedBy(DisposeBag); ViewModel.NextIsEnabled .Select(loginButtonTitleColor) .Subscribe(LoginButton.Rx().TitleColor()) .DisposedBy(DisposeBag); UIColor loginButtonTintColor(bool hasError) => hasError ? UIColor.White : UIColor.Black; UIColor loginButtonTitleColor(bool enabled) => enabled ? Core.UI.Helper.Colors.Login.EnabledButtonColor.ToNativeColor() : Core.UI.Helper.Colors.Login.DisabledButtonColor.ToNativeColor(); }