Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using MvvmCross.Binding.BindingContext;
- using MvvmCross.iOS.Views;
- using Colingual.Core.ViewModels;
- namespace Colingual.iOS
- {
- public partial class LoginView : MvxViewController
- {
- public LoginView() : base("LoginView", null)
- {
- }
- public override void ViewDidLoad()
- {
- base.ViewDidLoad();
- // Perform any additional setup after loading the view, typically from a nib.
- var set = this.CreateBindingSet<LoginView, LoginViewModel>();
- set.Bind(Username).To(vm => vm.Username);
- set.Bind(Password).To(vm => vm.Password);
- set.Bind(btnLogin).To(vm => vm.MyAwesomeCommand);
- set.Apply();
- }
- public override void DidReceiveMemoryWarning()
- {
- base.DidReceiveMemoryWarning();
- // Release any cached data, images, etc that aren't in use.
- }
- }
- }
- using MvvmCross.Core.ViewModels;
- namespace Colingual.Core.ViewModels
- {
- public class LoginViewModel : MvxViewModel
- {
- readonly IAuthenticationService _authenticationService;
- public LoginViewModel(IAuthenticationService authenticationService)
- {
- _authenticationService = authenticationService;
- }
- string _username = string.Empty;
- public string Username
- {
- get { return _username; }
- set { SetProperty(ref _username, value); }
- }
- string _password = string.Empty;
- public string Password
- {
- get { return _password; }
- set { SetProperty(ref _password, value); }
- }
- public bool AuthenticateUser() {
- return true;
- }
- MvxCommand _myAwesomeCommand;
- public IMvxCommand MyAwesomeCommand
- {
- get
- {
- DoStuff();
- return _myAwesomeCommand;
- }
- }
- void DoStuff()
- {
- string test = string.Empty;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement