예제 #1
0
        private void AddCreditCard(object sender, EventArgs args)
        {
            UIStoryboard sb = UIStoryboard.FromName("MainStoryboard", null);
            AddCreditCardViewController pvc = (AddCreditCardViewController)sb.InstantiateViewController("AddCreditCardViewController");

            pvc.fromWhere = "bill";
            _NavigationController.PushViewController(pvc, true);
        }
예제 #2
0
        private void SetBindings()
        {
            this.SetBinding(
                () => Facade.Instance.CurrentRide.PickUpLocation,
                () => txtSearchLocation.Text,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("PickUpLocationChanges");

            this.SetBinding(
                () => Facade.Instance.CurrentRide.CreditCard,
                () => txtMapCard.Text,
                BindingMode.TwoWay)
            .UpdateTargetTrigger("ValueChanged");

            txtMapPromo.Text = Facade.Instance.CurrentRide.PromoCode;

            this.SetBinding(
                () => txtMapPromo.Text,
                () => Facade.Instance.CurrentRide.PromoCode,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            btnMapAddCreditCard.TouchUpInside += (object sender, EventArgs e) => {
                UIStoryboard sb = UIStoryboard.FromName("MainStoryboard", null);
                AddCreditCardViewController pvc = (AddCreditCardViewController)sb.InstantiateViewController("AddCreditCardViewController");
                pvc.fromWhere = "map";
                NavigationController.PushViewController(pvc, true);
            };

            btnReadyPickup.TouchUpInside += ReadyForPickup;

            txtSearchLocation.EditingDidBegin += (object sender, EventArgs e) => {
                UIStoryboard         sb  = UIStoryboard.FromName("MainStoryboard", null);
                PickUpViewController pvc = (PickUpViewController)sb.InstantiateViewController("PickUpViewController");
                pvc.IsPickUpLocation = true;
                txtSearchLocation.ResignFirstResponder();
                NavigationController.PushViewController(pvc, true);
            };

            btnScheduleARide.SetCommand("TouchUpInside", Facade.Instance.CurrentRide.GoToTheRideInformation);
        }
예제 #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            thisController = NavigationController;

            Title = "SIGN UP";

            NavigationItem.Customize(NavigationController);

            btnConfirmRegistration.SetCustomButton();

            edtFirstName.ShouldReturn      += TextFieldShouldReturn;
            edtLastName.ShouldReturn       += TextFieldShouldReturn;
            edtMobileNumber.ShouldReturn   += TextFieldShouldReturn;
            edtEmailAddress.ShouldReturn   += TextFieldShouldReturn;
            edtPassword.ShouldReturn       += TextFieldShouldReturn;
            edtRepeatPassword.ShouldReturn += TextFieldShouldReturn;

            var tap = new UITapGestureRecognizer(() => { View.EndEditing(true); });

            View.AddGestureRecognizer(tap);


                        #if DEBUG
            edtFirstName.Text      = "John";
            edtLastName.Text       = "Dow";
            edtMobileNumber.Text   = "8058081234";
            edtEmailAddress.Text   = "*****@*****.**";
            edtPassword.Text       = "123456";
            edtRepeatPassword.Text = "123456";
                        #endif

            if (AppSettings.LoginType > 0)
            {
                edtFirstName.Text      = AppSettings.UserFirstName;
                edtLastName.Text       = AppSettings.UserLastName;
                edtMobileNumber.Text   = AppSettings.UserPhone;
                edtEmailAddress.Text   = AppSettings.UserEmail;
                edtPassword.Text       = "";
                edtRepeatPassword.Text = "";
            }

            this.SetBinding(
                () => edtFirstName.Text,
                () => ViewModel.FirstName,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => edtLastName.Text,
                () => ViewModel.LastName,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => edtMobileNumber.Text,
                () => ViewModel.MobileNumber,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => edtEmailAddress.Text,
                () => ViewModel.EmailAdress,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => edtPassword.Text,
                () => ViewModel.Password,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => edtRepeatPassword.Text,
                () => ViewModel.RepeatPassword,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("EditingChanged");

            this.SetBinding(
                () => chkIAgree.On,
                () => ViewModel.IsAgree,
                BindingMode.TwoWay)
            .UpdateSourceTrigger("ValueChanged");

            ViewModel.LoginType = AppSettings.LoginType.ToString();
            ViewModel.Token     = AppSettings.UserToken;

            btnConfirmRegistration.SetCommand("TouchUpInside", ViewModel.IncrementCommand);

            this.SetBinding(
                () => ViewModel.ValidaionError)
            .UpdateSourceTrigger("ValidaionErrorChanges")
            .WhenSourceChanges(
                () => {
                if (ViewModel.ValidaionError != null && ViewModel.ValidaionError.Count > 0)
                {
                    var delimeter = Environment.NewLine + "and" + Environment.NewLine;
                    var message   = String.Join(delimeter, ViewModel.ValidaionError.Select(r => r.ErrorMessage));
                    InvokeOnMainThread(() => new UIAlertView(
                                           "Just a couple things left:", message, null, "Ok", null).Show());
                }
            });

            this.SetBinding(
                () => ViewModel.CanMoveForward)
            .UpdateSourceTrigger("CanMoveForwardChanges")
            .WhenSourceChanges(
                () => {
                if (ViewModel.CanMoveForward)
                {
                    AppSettings.LoginType     = (int)LoginType.Email;
                    AppSettings.UserToken     = string.Empty;
                    AppSettings.UserEmail     = edtEmailAddress.Text;
                    AppSettings.UserPassword  = edtPassword.Text;
                    AppSettings.UserFirstName = edtFirstName.Text;
                    AppSettings.UserLastName  = edtLastName.Text;
                    AppSettings.UserPhone     = edtMobileNumber.Text;
                    AppSettings.UserPhoto     = string.Empty;

                    var dic = new Dictionary <String, String>
                    {
                        { Constant.LOGINAPI_USERNAME, edtEmailAddress.Text },
                        { Constant.LOGINAPI_PASSWORD, edtPassword.Text }
                    };

                    string result = String.Empty;

                    try
                    {
                        Task runSync = Task.Factory.StartNew(async() => {
                            result = await AppData.ApiCall(Constant.LOGINAPI, dic);
                            var tt = (LoginResponse)AppData.ParseResponse(Constant.LOGINAPI, result);

                            AppSettings.UserID = tt.Customerid;
                        }).Unwrap();
                        //runSync.Wait();
                    }
                    catch (Exception ex)
                    {
                    }
                    finally{
                        //HideLoadingView();
                    }

                    UIStoryboard sb = UIStoryboard.FromName("MainStoryboard", null);
                    AddCreditCardViewController pvc = (AddCreditCardViewController)sb.InstantiateViewController("AddCreditCardViewController");
                    pvc.fromWhere = "signup";
                    thisController.PushViewController(pvc, true);
                }
            });

            this.SetBinding(
                () => ViewModel.AppExceptions)
            .UpdateSourceTrigger("AppExceptionsChanges")
            .WhenSourceChanges(
                () => {
                if (ViewModel.AppExceptions != null && ViewModel.AppExceptions.Count > 0)
                {
                    var delimeter = Environment.NewLine + "and" + Environment.NewLine;
                    var message   = String.Join(delimeter, ViewModel.AppExceptions.Select(r => r.Message));
                    InvokeOnMainThread(() => new UIAlertView(
                                           "Errors:", message, null, "Ok", null).Show());
                }
            });
        }