protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_result); SignInButton.SetCommand("Click", Vm.BackToLoginCommand); }
//OnCreate protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); //Set Layout SetContentView(Resource.Layout.activity_signin); //binding _usernameBinding = this.SetBinding(() => EditUserName.Text, () => Vm.UserName); _passwordBinding = this.SetBinding(() => EditPassword.Text, () => Vm.Password); SignInButton.SetCommand("Click", Vm.LoginCommand); SignUpButton.SetCommand("Click", Vm.SignUpCommand); }
private void SetupBinding() { EmailTextField.EditingChanged += (s, e) => { }; Bindings.Add(this.SetBinding( () => EmailTextField.Text, () => Vm.Email, BindingMode.OneWay)); PasswordTextField.EditingChanged += (s, e) => { }; Bindings.Add(this.SetBinding( () => PasswordTextField.Text, () => Vm.Password, BindingMode.OneWay)); Bindings.Add(this .SetBinding(() => Vm.EmailValidationError) .WhenSourceChanges(() => { if (Vm.EmailValidationError) { EmailTextField.Shake(); } })); Bindings.Add(this .SetBinding(() => Vm.PasswordValidationError) .WhenSourceChanges(() => { if (Vm.PasswordValidationError) { PasswordTextField.Shake(); } })); SignInButton.TouchUpInside += (s, e) => { }; SignInButton.SetCommand( "TouchUpInside", Vm.SignInCommand); SignUpButton.TouchUpInside += (s, e) => { }; SignUpButton.SetCommand( "TouchUpInside", Vm.SignUpCommand); }
protected override void InitBindings() { Bindings = new List <Binding>(); Bindings.Add(this.SetBinding(() => ViewModel.UserNameInput, () => UsernameInput.Text, BindingMode.TwoWay)); Bindings.Add(this.SetBinding(() => ViewModel.Authenticating, () => LoginPageLoadingSpinner.Visibility, BindingMode.OneWay) .ConvertSourceToTarget(Converters.BoolToVisibility)); Bindings.Add(this.SetBinding(() => ViewModel.PasswordInput, () => PasswordInput.Text, BindingMode.TwoWay)); LoginPageRegisterButton.SetCommand(ViewModel.NavigateRegister); LoginPageProblemsButton.SetCommand(ViewModel.ProblemsCommand); UsernameInput.FocusChange += UsernameInputOnFocusChange; PasswordInput.FocusChange += UsernameInputOnFocusChange; // LoginPageButtonHum.Click += LoginPageButtonOnClick; // LoginPageButtonMal.Click += LoginPageButtonOnClick; SignInButton.SetCommand(ViewModel.LogInCommand); }
public override void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); bindings.Add(this.SetBinding(() => Vm.State, () => SignInButton.Visibility).ConvertSourceToTarget(s => s == "NotAuthenticated" ? ViewStates.Visible : ViewStates.Gone)); bindings.Add(this.SetBinding(() => Vm.State, () => AuthLayout.Visibility).ConvertSourceToTarget(s => s == "Authenticated" ? ViewStates.Visible : ViewStates.Gone)); bindings.Add(this.SetBinding(() => Vm.Bio, () => BioView.Text, BindingMode.TwoWay)); bindings.Add(this.SetBinding(() => Vm.PublicImages, () => ImagePublicSwitch.Checked, BindingMode.TwoWay)); bindings.Add(this.SetBinding(() => Vm.MessagingEnabled, () => EnableMessagingSwitch.Checked, BindingMode.TwoWay)); ArrayAdapter adapter = ArrayAdapter.CreateFromResource(Activity, Resource.Array.AlbumPrivacyItems, global::Android.Resource.Layout.SimpleSpinnerItem); adapter.SetDropDownViewResource(global::Android.Resource.Layout.SimpleSpinnerDropDownItem); AlbumPrivacySpinner.Adapter = adapter; bindings.Add(this.SetBinding(() => Vm.AlbumPrivacyIndex).WhenSourceChanges(() => AlbumPrivacySpinner.SetSelection(Vm.AlbumPrivacyIndex))); AlbumPrivacySpinner.ItemSelected += AlbumPrivacySpinner_ItemSelected; bindings.Add(this.SetBinding(() => Vm.ShowMature, () => MatureContentSwitch.Checked, BindingMode.TwoWay)); SignInButton.SetCommand("Click", Vm.SignInCommand); SaveSettingsButton.SetCommand("Click", Vm.SaveCommand); SignOutButton.SetCommand("Click", Vm.SignOutCommand); }