示例#1
0
        private ProfileButton CreateGoogleButton()
        {
            var socialNetworkButton = ProfileButtonManager.ButtonInitiaziler(EnvironmentInfo.GetGoogleButtonDistanceBetweenTextAndIcon, 0.1f, 0.6f, 0.3f, 0.5f, "Sign in",
                                                                             UIImage.FromFile(@"Images/LoginView/ic_google.png"), UIColor.DarkGray, UIColor.White);

            socialNetworkButton.Layer.CornerRadius  = 5;
            socialNetworkButton.Layer.ShadowColor   = UIColor.Black.CGColor;
            socialNetworkButton.Layer.ShadowOpacity = 0.1f;
            socialNetworkButton.Layer.ShadowRadius  = 1;
            socialNetworkButton.Layer.ShadowOffset  = new CGSize(1, 1);
            return(socialNetworkButton);
        }
        protected override void InitializeObjects()
        {
            base.InitializeObjects();

            var topView           = new UIView();
            var scrollView        = new UIScrollView();
            var topTextRowView    = new UIView();
            var centerTextRowView = new UIView();
            var bottomTextRowView = new UIView();
            var bottomView        = new UIView();
            var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png"));

            backHomeView = UIButton.FromType(UIButtonType.Custom);
            backHomeView.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal);
            nameOfPageLabel           = LabelInformationAboutPage(UIColor.White, "Profile", UIFont.BoldSystemFontOfSize(16f));
            informationAboutPageLabel = LabelInformationAboutPage(UIColor.FromRGB(29, 157, 189), "Please, Enter Your Personal Information.", UIFont.FromName("Helvetica", 14f));

            // Hide navigation bar
            NavigationController.SetNavigationBarHidden(true, false);
            View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size));
            profileNavigationBarBackground.Frame = new CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height);

            var labelView = new UIView();

            labelView.AddIfNotNull(nameOfPageLabel, informationAboutPageLabel);
            labelView.AddConstraints(
                nameOfPageLabel.AtTopOf(labelView, 20),
                nameOfPageLabel.WithSameCenterX(labelView),
                nameOfPageLabel.WithSameCenterY(labelView),
                nameOfPageLabel.WithSameWidth(labelView),
                nameOfPageLabel.WithRelativeHeight(labelView, 0.3f),

                informationAboutPageLabel.Below(nameOfPageLabel, 5),
                informationAboutPageLabel.WithSameWidth(labelView),
                informationAboutPageLabel.WithSameCenterX(labelView),
                informationAboutPageLabel.WithRelativeHeight(labelView, 0.3f)
                );

            topView.AddIfNotNull(profileNavigationBarBackground, backHomeView, labelView);
            topView.AddConstraints(
                profileNavigationBarBackground.WithSameWidth(topView),
                profileNavigationBarBackground.WithSameHeight(topView),
                profileNavigationBarBackground.AtTopOf(topView),

                backHomeView.WithSameCenterY(topView),
                backHomeView.AtLeftOf(topView, 20),
                backHomeView.WithRelativeWidth(topView, 0.1f),
                backHomeView.WithRelativeHeight(topView, 0.2f),

                labelView.WithSameCenterX(topView),
                labelView.WithSameCenterY(topView),
                labelView.WithRelativeWidth(topView, 0.8f),
                labelView.WithRelativeHeight(topView, 0.6f)
                );

            firstNameTextField = TextFieldInitializer("First Name");
            lastNameTextField  = TextFieldInitializer("Last Name");
            emailTextField     = TextFieldInitializer("Email");
            addressTextField   = TextFieldInitializer("Address");
            cityTextField      = TextFieldInitializer("City");
            zipCodeTextField   = TextFieldInitializer("Zip Code");

            stateTextField        = TextFieldInitializer("State");
            statesPicker          = new UIPickerView();
            statesPickerViewModel = new MvxPickerViewModel(statesPicker);
            statesPicker.Model    = statesPickerViewModel;
            statesPicker.ShowSelectionIndicator = true;
            statesPicker.BackgroundColor        = UIColor.White;


            addLicenseButton    = ProfileButtonManager.ButtonInitiaziler("Add License Plate", UIImage.FromFile(@"Images/ProfileView/ic_license.png"));
            addCreditCardButton = ProfileButtonManager.ButtonInitiaziler("Add Credit Card", UIImage.FromFile(@"Images/ProfileView/ic_card.png"));

            topTextRowView.AddIfNotNull(firstNameTextField, lastNameTextField);
            topTextRowView.AddConstraints(
                firstNameTextField.AtTopOf(topTextRowView),
                firstNameTextField.AtLeftOf(topTextRowView),
                firstNameTextField.WithRelativeWidth(topTextRowView, 0.475f),
                firstNameTextField.WithSameHeight(topTextRowView),

                lastNameTextField.AtTopOf(topTextRowView),
                lastNameTextField.AtRightOf(topTextRowView),
                lastNameTextField.WithRelativeWidth(topTextRowView, 0.475f),
                lastNameTextField.WithSameHeight(topTextRowView)
                );

            centerTextRowView.AddIfNotNull(emailTextField, addressTextField, cityTextField);
            centerTextRowView.AddConstraints(
                emailTextField.AtTopOf(centerTextRowView),
                emailTextField.WithSameCenterX(centerTextRowView),
                emailTextField.WithSameWidth(centerTextRowView),
                emailTextField.WithRelativeHeight(centerTextRowView, 0.3f),

                addressTextField.Below(emailTextField, 10),
                addressTextField.WithSameCenterX(centerTextRowView),
                addressTextField.WithSameWidth(centerTextRowView),
                addressTextField.WithRelativeHeight(centerTextRowView, 0.3f),

                cityTextField.Below(addressTextField, 10),
                cityTextField.WithSameCenterX(centerTextRowView),
                cityTextField.WithSameWidth(centerTextRowView),
                cityTextField.WithRelativeHeight(centerTextRowView, 0.3f)
                );

            bottomTextRowView.AddIfNotNull(stateTextField, zipCodeTextField);
            bottomTextRowView.AddConstraints(
                stateTextField.AtTopOf(bottomTextRowView),
                stateTextField.AtLeftOf(bottomTextRowView),
                stateTextField.WithRelativeWidth(bottomTextRowView, 0.475f),
                stateTextField.WithSameHeight(bottomTextRowView),

                zipCodeTextField.AtTopOf(bottomTextRowView),
                zipCodeTextField.AtRightOf(bottomTextRowView),
                zipCodeTextField.WithRelativeWidth(bottomTextRowView, 0.475f),
                zipCodeTextField.WithSameHeight(bottomTextRowView)
                );

            bottomView.AddIfNotNull(addLicenseButton, addCreditCardButton);
            bottomView.AddConstraints(
                addLicenseButton.AtTopOf(bottomView),
                addLicenseButton.WithSameCenterX(bottomView),
                addLicenseButton.WithSameWidth(bottomView),
                addLicenseButton.WithRelativeHeight(bottomView, 0.4f),

                addCreditCardButton.Below(addLicenseButton, 10),
                addCreditCardButton.WithSameCenterX(bottomView),
                addCreditCardButton.WithSameWidth(bottomView),
                addCreditCardButton.WithRelativeHeight(bottomView, 0.4f)
                );

            scrollView.AddIfNotNull(topTextRowView, centerTextRowView, bottomTextRowView, bottomView);
            scrollView.AddConstraints(
                topTextRowView.AtTopOf(scrollView, 30),
                topTextRowView.WithSameWidth(scrollView),
                topTextRowView.WithSameCenterX(scrollView),
                topTextRowView.WithRelativeHeight(scrollView, 0.12f),

                centerTextRowView.Below(topTextRowView, 10),
                centerTextRowView.WithSameWidth(scrollView),
                centerTextRowView.AtLeftOf(scrollView),
                centerTextRowView.AtRightOf(scrollView),
                centerTextRowView.WithRelativeHeight(scrollView, 0.4f),

                bottomTextRowView.Below(centerTextRowView, 10),
                bottomTextRowView.WithSameWidth(scrollView),
                bottomTextRowView.WithSameCenterX(scrollView),
                bottomTextRowView.WithRelativeHeight(scrollView, 0.12f),

                bottomView.Below(bottomTextRowView, 10),
                bottomView.WithSameWidth(scrollView),
                bottomView.AtLeftOf(scrollView),
                bottomView.AtRightOf(scrollView),
                bottomView.AtBottomOf(scrollView, 100),
                bottomView.WithRelativeHeight(scrollView, 0.27f)
                );

            View.AddIfNotNull(topView, scrollView);
            View.AddConstraints(
                topView.AtTopOf(View),
                topView.WithSameWidth(View),
                topView.WithRelativeHeight(View, 0.2f),

                scrollView.Below(topView, 30),
                scrollView.AtLeftOf(View, 30),
                scrollView.AtRightOf(View, 30),
                scrollView.WithRelativeHeight(View, 0.8f)
                );
            EnableNextKeyForTextFields(firstNameTextField.TextFieldWithValidator.TextField, lastNameTextField.TextFieldWithValidator.TextField, emailTextField.TextFieldWithValidator.TextField,
                                       addressTextField.TextFieldWithValidator.TextField, cityTextField.TextFieldWithValidator.TextField, stateTextField.TextFieldWithValidator.TextField,
                                       zipCodeTextField.TextFieldWithValidator.TextField);
        }
        protected override void InitializeObjects()
        {
            base.InitializeObjects();

            var topView    = new UIView();
            var scrollView = new UIView();
            var bottomView = new UIView();

            informationLabel               = new UILabel();
            informationLabel.TextColor     = UIColor.White;
            informationLabel.Text          = "Payment History";
            informationLabel.Font          = UIFont.BoldSystemFontOfSize(16f);
            informationLabel.TextAlignment = UITextAlignment.Center;

            backHomeView = UIButton.FromType(UIButtonType.Custom);
            backHomeView.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal);
            var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png"));

            // Hide navigation bar
            NavigationController.SetNavigationBarHidden(true, false);
            View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size));//EnvironmentInfo.CheckDevice().Scale(View.Frame.Size));
            profileNavigationBarBackground.Frame = new CoreGraphics.CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height);

            topView.AddIfNotNull(profileNavigationBarBackground, backHomeView, informationLabel);
            topView.AddConstraints(
                profileNavigationBarBackground.WithSameWidth(topView),
                profileNavigationBarBackground.WithSameHeight(topView),
                profileNavigationBarBackground.AtTopOf(topView),

                backHomeView.WithSameCenterY(topView),
                backHomeView.AtLeftOf(topView, 20),
                backHomeView.WithRelativeWidth(topView, 0.1f),
                backHomeView.WithRelativeHeight(topView, 0.2f),

                informationLabel.WithSameCenterY(topView),
                informationLabel.WithSameCenterX(topView),
                informationLabel.WithSameWidth(topView),
                informationLabel.WithRelativeHeight(topView, 0.3f)
                );

            dowloadHistoryButton = ProfileButtonManager.ButtonInitiaziler("Download History", UIImage.FromFile(@"Images/ProfileView/ic_license.png"));
            tableView            = new UITableView();

            bottomView.AddIfNotNull(dowloadHistoryButton, tableView);
            bottomView.AddConstraints(
                dowloadHistoryButton.AtTopOf(bottomView),
                dowloadHistoryButton.WithSameCenterX(bottomView),
                dowloadHistoryButton.WithSameWidth(bottomView),
                dowloadHistoryButton.WithRelativeHeight(bottomView, 0.1f),

                tableView.Below(dowloadHistoryButton),
                tableView.WithSameCenterX(bottomView),
                tableView.WithSameWidth(bottomView),
                tableView.WithRelativeHeight(bottomView, 1)
                );

            scrollView.AddIfNotNull(bottomView);
            scrollView.AddConstraints(
                bottomView.AtTopOf(scrollView),
                bottomView.WithSameWidth(scrollView),
                bottomView.AtLeftOf(scrollView),
                bottomView.AtRightOf(scrollView),
                bottomView.AtBottomOf(scrollView),
                bottomView.WithRelativeHeight(scrollView, 0.9f)
                );

            View.AddIfNotNull(topView, scrollView);
            View.AddConstraints(
                topView.AtTopOf(View),
                topView.WithSameWidth(View),
                topView.WithRelativeHeight(View, 0.2f),

                scrollView.Below(topView, 1),
                scrollView.AtLeftOf(View, 30),
                scrollView.AtRightOf(View, 30),
                scrollView.WithRelativeHeight(View, 0.8f)
                );
        }