Example #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _bindings.Initialize(this);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            _bindings.BindText(
                FindViewById <EditText>(Resource.Id.userName),
                () => _viewModel.UserName,
                s => _viewModel.UserName = s);
            _bindings.BindText(
                FindViewById <TextView>(Resource.Id.password),
                () => _viewModel.Password,
                s => _viewModel.Password = s);
            _bindings.BindCommand(
                FindViewById <Button>(Resource.Id.myButton),
                () => _viewModel.Login(),
                () => _viewModel.CanLogIn);
            _bindings.BindText(
                FindViewById <TextView>(Resource.Id.welcome),
                () => _viewModel.Welcome);
        }
Example #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            _bindings.Initialize(this);

            _bindings.BindText(
                FindViewById <EditText>(Resource.Id.editName),
                () => _viewModel.NewName,
                s => _viewModel.NewName = s);
            _bindings.BindCommand(
                FindViewById <Button>(Resource.Id.buttonAdd),
                () => _viewModel.AddPerson(),
                () => _viewModel.CanAddPerson);
            _bindings.BindItems(
                FindViewById <ListView>(Resource.Id.listPeople),
                () => _viewModel.People,
                Android.Resource.Layout.SimpleListItem1,
                (view, person, bindings) =>
            {
                bindings.BindText(
                    view.FindViewById <TextView>(Android.Resource.Id.Text1),
                    () => person.Name);
            });
        }
Example #3
0
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            _bindings.BindText(userNameTextField,
                               () => _viewModel.UserName,
                               s => _viewModel.UserName = s);
            _bindings.BindText(passwordTextField,
                               () => _viewModel.Password,
                               s => _viewModel.Password = s);
            _bindings.BindCommand(loginButton,
                                  () => _viewModel.Login(),
                                  () => _viewModel.CanLogIn);
            _bindings.BindText(welcomeLabel,
                               () => _viewModel.Welcome);
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            _viewModel.CityName = null;

            _bindings.BindText(
                CityName,
                () => _viewModel.CityName,
                value => _viewModel.CityName = value);

            _bindings.BindCommand(
                OkButton,
                () => _viewModel.AddCity(),
                () => _viewModel.CanAddCity);
        }
Example #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.NewCity);

            _bindings.Initialize(this);

            _viewModel.CityName = null;

            _bindings.BindText(
                FindViewById <EditText>(Resource.Id.editName),
                () => _viewModel.CityName,
                value => _viewModel.CityName = value);

            _bindings.BindCommand(
                FindViewById <Button>(Resource.Id.buttonAdd),
                () => OnAdd(),
                () => _viewModel.CanAddCity);
        }
        public override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);

            _bindings.BindText(
                textName,
                () => _viewModel.NewName,
                s => _viewModel.NewName = s);
            _bindings.BindCommand(
                buttonAdd,
                () => _viewModel.AddPerson(),
                () => _viewModel.CanAddPerson);
            _bindings.BindItems(
                tablePeople,
                () => _viewModel.People,
                (view, person, bindings) =>
            {
                bindings.BindText(
                    view.TextLabel,
                    () => person.Name);
            });
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Master);

            _bindings.Initialize(this);
            ViewModelLocator.Initialize(
                Resources.GetString(Resource.String.MashapeKey),
                new AndroidStorageService());

            _viewModel = ViewModelLocator.Instance.Main;

            _viewModel.SelectedCityHeader = null;

            _bindings.BindCommand(
                FindViewById <Button>(Resource.Id.buttonAdd),
                () => StartActivity(typeof(NewCityActivity)));

            _bindings.BindItems(
                FindViewById <ListView>(Resource.Id.listCities),
                () => _viewModel.CityHeaders,
                global::Android.Resource.Layout.SimpleListItem1,
                () => _viewModel.SelectedCityHeader,
                value => _viewModel.SelectedCityHeader = value,
                (cell, city, bindings) =>
            {
                bindings.BindText(
                    cell.FindViewById <TextView>(global::Android.Resource.Id.Text1),
                    () => city.Name);
            });

            _bindings.Bind(
                () => _viewModel.SelectedCityHeader,
                cityHeader => OnSelected(cityHeader));
        }