private void AddLoader() { activityIndicatorView = (UIActivityIndicatorView)View.ViewWithTag(1000); // show busy indicator. create it first if it doesn't already exists if (activityIndicatorView == null) { var s = scrollView.Bounds; activityIndicatorView = new UIActivityIndicatorView() { ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray, Tag = 1000 }; activityIndicatorView.BackgroundColor = UIColor.White; activityIndicatorView.Alpha = 0.7f; scrollView.AddIfNotNull(activityIndicatorView); scrollView.AddConstraints( activityIndicatorView.AtTopOf(scrollView), activityIndicatorView.AtLeftOf(scrollView), activityIndicatorView.AtRightOf(scrollView), activityIndicatorView.AtBottomOf(scrollView) ); scrollView.BringSubviewToFront(activityIndicatorView); activityIndicatorView.StartAnimating(); } }
public static UIView AddTopBottomLine(this UIView view, UIColor color, int height) { UIView _top = new UIView(); _top.BackgroundColor = color; UIView _bottom = new UIView(); _bottom.BackgroundColor = color; view.AddIfNotNull(_top, _bottom); view.AddConstraints( _top.AtTopOf(view), _top.AtLeftOf(view), _top.AtRightOf(view), _top.Height().EqualTo(height), _bottom.AtBottomOf(view), _bottom.AtLeftOf(view), _bottom.AtRightOf(view), _bottom.Height().EqualTo(height) ); return(view); }
protected override void InitializeObjects() { base.InitializeObjects(); var topView = new UIView(); var centerView = new UIView(); var bottomView = new UIView(); var socialNetworksView = new UIView(); var applicationLogo = new UIImageView(UIImage.FromBundle(@"Images/logo.png")); // Hide navigation bar NavigationController.SetNavigationBarHidden(true, false); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/main_background.png").Scale(View.Frame.Size)); applicationLogo.Frame = new CGRect(10, 10, applicationLogo.Image.CGImage.Width, applicationLogo.Image.CGImage.Height); topView.AddIfNotNull(applicationLogo); topView.AddConstraints( applicationLogo.WithRelativeWidth(topView, 0.5f), applicationLogo.WithRelativeHeight(topView, 0.25f), applicationLogo.WithSameCenterX(topView), applicationLogo.WithSameCenterY(topView) ); _loginTextField = TextFieldInitializer("Login"); _loginTextField.TextFieldWithValidator.TextField.KeyboardType = UIKeyboardType.EmailAddress; socialNetworkLabel = LabelInitializer("Login With:", UIColor.LightGray); registrationLabel = LabelInitializer("Don't have an account?", UIColor.LightGray); _passwordTextField = TextFieldInitializer("Password"); _loginButton = ButtonInitializer("Login", UIControlState.Normal, Theme.BlueDark.ToUIColor(), UIColor.White, UIControlState.Normal, null, UIControlState.Disabled); _googlePlusLoginButton = CreateGoogleButton(); var sloginView = new LoginButton(new CGRect(51, 0, 218, 46)) { LoginBehavior = LoginBehavior.Native, ReadPermissions = readPermissions.ToArray() }; _facebookLoginButton = ButtonInitializer(sloginView.CurrentTitle, UIControlState.Normal, null, sloginView.CurrentTitleColor, UIControlState.Normal, sloginView.CurrentImage, UIControlState.Normal); _facebookLoginButton.SetBackgroundImage(sloginView.CurrentBackgroundImage, UIControlState.Normal); _facebookLoginButton.Font = UIFont.FromName("Helvetica", 14f); _facebookLoginButton.ImageEdgeInsets = new UIEdgeInsets(0, 0, 0, 40); forgotPasswordButton = ButtonInitializer("Forgot your password?", UIControlState.Normal, null, UIColor.LightGray, UIControlState.Normal, null, UIControlState.Normal); forgotPasswordButton.TitleLabel.Font = UIFont.FromName("Helvetica", 12f); registrationButton = ButtonInitializer("Get Started!", UIControlState.Normal, null, UIColor.Cyan, UIControlState.Normal, null, UIControlState.Normal); registrationButton.TitleLabel.Font = UIFont.FromName("Helvetica", 12f); socialNetworksView.AddIfNotNull(socialNetworkLabel, _facebookLoginButton, _googlePlusLoginButton); socialNetworksView.AddConstraints( socialNetworkLabel.AtTopOf(socialNetworksView), socialNetworkLabel.AtLeftOf(socialNetworksView), socialNetworkLabel.WithSameWidth(socialNetworksView), socialNetworkLabel.WithRelativeHeight(socialNetworksView, 0.2f), socialNetworkLabel.AtBottomOf(socialNetworksView, 10), _facebookLoginButton.Below(socialNetworkLabel), _facebookLoginButton.AtLeftOf(socialNetworksView), _facebookLoginButton.WithRelativeWidth(socialNetworksView, 0.48f), _facebookLoginButton.WithRelativeHeight(socialNetworksView, 0.4f), _googlePlusLoginButton.Below(socialNetworkLabel), _googlePlusLoginButton.WithRelativeWidth(socialNetworksView, 0.48f), _googlePlusLoginButton.WithRelativeHeight(socialNetworksView, 0.4f), _googlePlusLoginButton.AtRightOf(socialNetworksView) ); // Central block with text fields and login buttons centerView.Layer.CornerRadius = 10; centerView.AddIfNotNull(_loginTextField, _passwordTextField, forgotPasswordButton, _loginButton, socialNetworksView, registrationLabel, registrationButton); centerView.BackgroundColor = UIColor.White; centerView.AddConstraints( _loginTextField.AtTopOf(centerView, 10), _loginTextField.WithSameCenterX(centerView), _loginTextField.WithSameWidth(centerView), _loginTextField.WithRelativeHeight(centerView, 0.2f), _passwordTextField.Below(_loginTextField), _passwordTextField.WithSameCenterX(centerView), _passwordTextField.WithSameWidth(centerView), _passwordTextField.WithRelativeHeight(centerView, 0.2f), forgotPasswordButton.Below(_passwordTextField, -10), forgotPasswordButton.AtLeftOf(centerView, 20), forgotPasswordButton.WithRelativeWidth(centerView, 0.5f), forgotPasswordButton.WithRelativeHeight(centerView, 0.07f), _loginButton.Below(forgotPasswordButton, 10), _loginButton.AtLeftOf(centerView, 20), _loginButton.AtRightOf(centerView, 20), // make a fat login button _loginButton.WithRelativeHeight(centerView, 0.15f), socialNetworksView.Below(_loginButton, 20), socialNetworksView.AtLeftOf(centerView, 20), socialNetworksView.AtRightOf(centerView, 20), socialNetworksView.WithRelativeHeight(centerView, 0.2f), registrationLabel.Below(socialNetworksView), registrationLabel.AtLeftOf(centerView, 25), registrationLabel.WithRelativeWidth(centerView, 0.5f), registrationLabel.WithRelativeHeight(centerView, 0.07f), registrationButton.Below(socialNetworksView), registrationButton.AtRightOf(centerView, 10), registrationButton.WithRelativeWidth(centerView, 0.5f), registrationButton.WithRelativeHeight(centerView, 0.07f) ); // Main view View.AddIfNotNull(topView, centerView, bottomView); View.AddConstraints( topView.AtTopOf(View, 10), topView.AtLeftOf(View), topView.AtRightOf(View), topView.WithRelativeHeight(View, 0.15f), centerView.AtLeftOf(View, 30), centerView.AtRightOf(View, 30), centerView.Below(topView), centerView.AtBottomOf(View, 70), bottomView.AtBottomOf(View), bottomView.AtLeftOf(View), bottomView.AtRightOf(View), bottomView.Below(centerView), bottomView.WithRelativeHeight(View, 0f) ); SignIn.SharedInstance.UIDelegate = this; EnableNextKeyForTextFields(_loginTextField.TextFieldWithValidator.TextField, _passwordTextField.TextFieldWithValidator.TextField); }
protected override void InitializeObjects() { base.InitializeObjects(); View.BackgroundColor = UIColor.LightGray; var topView = new UIView(); var profileNavigationBarBackground = new UIImageView(UIImage.FromBundle(@"Images/navigation_bar_background.png")); profileNavigationBarBackground.Frame = new CoreGraphics.CGRect(10, 10, profileNavigationBarBackground.Image.CGImage.Width, profileNavigationBarBackground.Image.CGImage.Height); backToPayHistoryViewButton = UIButton.FromType(UIButtonType.Custom); backToPayHistoryViewButton.SetImage(UIImage.FromFile(@"Images/ic_back.png"), UIControlState.Normal); openInButton = UIButton.FromType(UIButtonType.Custom); openInButton.SetImage(UIImage.FromFile(@"Images/PayHistoryView/ic_openIn.png"), UIControlState.Normal); informationLabel = new UILabel(); informationLabel.TextColor = UIColor.White; informationLabel.Text = "Payment History"; informationLabel.Font = UIFont.BoldSystemFontOfSize(16f); informationLabel.TextAlignment = UITextAlignment.Center; urlLabel = new UILabel(); pdfWebView = new UIWebView(View.Bounds); // Hide navigation bar NavigationController.SetNavigationBarHidden(true, false); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/tab_background.png").Scale(View.Frame.Size)); topView.AddIfNotNull(profileNavigationBarBackground, backToPayHistoryViewButton, informationLabel, openInButton); topView.AddConstraints( profileNavigationBarBackground.WithSameWidth(topView), profileNavigationBarBackground.WithSameHeight(topView), profileNavigationBarBackground.AtTopOf(topView), backToPayHistoryViewButton.WithSameCenterY(topView), backToPayHistoryViewButton.AtLeftOf(topView, 20), backToPayHistoryViewButton.WithRelativeWidth(topView, 0.1f), backToPayHistoryViewButton.WithRelativeHeight(topView, 0.2f), informationLabel.WithSameCenterY(topView), informationLabel.WithSameCenterX(topView), informationLabel.WithSameWidth(topView), informationLabel.WithRelativeHeight(topView, 0.3f), openInButton.WithSameCenterY(topView), openInButton.AtRightOf(topView, 20), openInButton.WithRelativeWidth(topView, 0.1f), openInButton.WithRelativeHeight(topView, 0.2f) ); View.AddIfNotNull(topView, pdfWebView); View.AddConstraints( topView.AtTopOf(View), topView.WithSameWidth(View), topView.WithRelativeHeight(View, 0.2f), pdfWebView.Below(topView, 10), pdfWebView.AtLeftOf(View, 30), pdfWebView.AtRightOf(View, 30), pdfWebView.WithRelativeHeight(View, 0.8f) ); }
protected override void InitializeObjects() { base.InitializeObjects(); // Navigation bar var applicationLogo = new UIImageView(UIImage.FromBundle(@"Images/logo.png")); View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile(@"Images/main_background.png").Scale(View.Frame.Size)); applicationLogo.Frame = new CGRect(10, 10, applicationLogo.Image.CGImage.Width, applicationLogo.Image.CGImage.Height); logoutButton = RoundedButtonManager.ButtonInitiaziler("", UIImage.FromFile(@"Images/HomeView/ic_logout.png")); // Hide navigation bar NavigationController.SetNavigationBarHidden(true, false); var topView = new UIView(); topView.AddIfNotNull(applicationLogo, logoutButton); topView.AddConstraints( applicationLogo.WithRelativeWidth(topView, 0.5f), applicationLogo.WithRelativeHeight(topView, 0.18f), applicationLogo.WithSameCenterX(topView), applicationLogo.WithSameCenterY(topView), logoutButton.AtTopOf(topView, 10), logoutButton.AtRightOf(topView), logoutButton.WithRelativeWidth(topView, 0.2f), logoutButton.WithRelativeHeight(topView, 0.4f) ); // Central Board View boardScrollView = CreateSliderBoard(true); buttonContainerView = new UIView(); roadInformationBoardView = new UIView(); buttonContainerView.Frame = new CGRect(0, 0, (boardScrollView.Bounds.Width * EnvironmentInfo.GetValueForGettingWidthButtonsContainer), (boardScrollView.Bounds.Height * 3)); roadInformationBoardView.Frame = new CGRect((boardScrollView.Bounds.Width * EnvironmentInfo.GetValueForGettingWidthRoadInformationContainer), EnvironmentInfo.GetValueForFirstSliderPositionY, (boardScrollView.Bounds.Width * 0.8), (boardScrollView.Bounds.Height * 2.5)); boardScrollView.ContentSize = new CGSize((buttonContainerView.Bounds.Width + roadInformationBoardView.Bounds.Width), boardScrollView.Frame.Height); // Board View - Button Container profileButton = RoundedButtonManager.ButtonInitiaziler("PROFILE", UIImage.FromFile(@"Images/HomeView/ic_home_profile.png"), UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_pointer.png")); payButton = RoundedButtonManager.ButtonInitiaziler("PAY", UIImage.FromFile(@"Images/HomeView/ic_home_pay.png"), UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_pointer.png")); payHistoryButton = RoundedButtonManager.ButtonInitiaziler("PAY HISTORY", UIImage.FromFile(@"Images/HomeView/ic_home_pay_history.png"), UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_pointer.png")); buttonContainerView.AddIfNotNull(profileButton, payButton, payHistoryButton); buttonContainerView.AddConstraints( profileButton.AtTopOf(buttonContainerView, EnvironmentInfo.GetMarginTopButtonsContainer), profileButton.AtLeftOf(buttonContainerView), profileButton.WithRelativeWidth(buttonContainerView, 0.4f), profileButton.WithRelativeHeight(buttonContainerView, 0.6f), payHistoryButton.AtTopOf(buttonContainerView, EnvironmentInfo.GetMarginTopButtonsContainer), payHistoryButton.WithSameCenterX(buttonContainerView), payHistoryButton.WithRelativeWidth(buttonContainerView, 0.4f), payHistoryButton.WithRelativeHeight(buttonContainerView, 0.6f), payButton.AtTopOf(buttonContainerView, EnvironmentInfo.GetMarginTopButtonsContainer), payButton.AtRightOf(buttonContainerView), payButton.WithRelativeWidth(buttonContainerView, 0.4f), payButton.WithRelativeHeight(buttonContainerView, 0.6f) ); // Board View - Road Information Container nextWaypointString = BoardFieldInitializer(UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_nearest_point.png"), "Nearest point in(ml):", (roadInformationBoardView.Bounds.Width * EnvironmentInfo.GetDistanceBetweenLabelAndTextNearestPoint)); geoLabelData = BoardFieldInitializer(UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_location.png"), "Geolocation:", (roadInformationBoardView.Bounds.Width * EnvironmentInfo.GetDistanceBetweenLabelAndTextGeolocation)); tollRoadString = BoardFieldInitializer(UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_tollroad.png"), "Tollroad:", (roadInformationBoardView.Bounds.Width * EnvironmentInfo.GetDistanceBetweenLabelAndTextTollroad)); statusLabel = BoardFieldInitializer(UIImage.FromFile(@"Images/HomeView/InformationBoard/ic_status.png"), "Status:", (roadInformationBoardView.Bounds.Width * EnvironmentInfo.GetDistanceBetweenLabelAndTextStatus)); roadInformationBoardView.AddIfNotNull(nextWaypointString, geoLabelData, tollRoadString, statusLabel); roadInformationBoardView.AddConstraints( nextWaypointString.AtTopOf(roadInformationBoardView, 10), nextWaypointString.AtLeftOf(roadInformationBoardView, 10), nextWaypointString.WithSameWidth(roadInformationBoardView), nextWaypointString.WithRelativeHeight(roadInformationBoardView, 0.2f), geoLabelData.Below(nextWaypointString), geoLabelData.AtLeftOf(roadInformationBoardView, 10), geoLabelData.WithSameWidth(roadInformationBoardView), geoLabelData.WithRelativeHeight(roadInformationBoardView, 0.2f), tollRoadString.Below(geoLabelData), tollRoadString.AtLeftOf(roadInformationBoardView, 10), tollRoadString.WithSameWidth(roadInformationBoardView), tollRoadString.WithRelativeHeight(roadInformationBoardView, 0.2f), statusLabel.Below(tollRoadString), statusLabel.AtLeftOf(roadInformationBoardView, 10), statusLabel.WithSameWidth(roadInformationBoardView), statusLabel.WithRelativeHeight(roadInformationBoardView, 0.2f) ); boardScrollView.AddSubviews(buttonContainerView, roadInformationBoardView); boardScrollView.Scrolled += (sender, e) => { Debug.WriteLine(((UIScrollView)sender).ContentOffset.X); }; // Slider container var applicationBoard = new UIImageView(UIImage.FromBundle(@"Images/HomeView/home_board.png")); applicationBoard.Frame = new CGRect(10, 10, applicationBoard.Image.CGImage.Width, applicationBoard.Image.CGImage.Height); boardContainerView = new UIView(); boardContainerView.AddIfNotNull(applicationBoard, boardScrollView); boardContainerView.AddConstraints( applicationBoard.WithSameHeight(boardContainerView), applicationBoard.WithSameWidth(boardContainerView), applicationBoard.WithSameCenterX(boardContainerView), applicationBoard.WithSameCenterY(boardContainerView), boardScrollView.AtTopOf(boardContainerView, 10), boardScrollView.AtLeftOf(boardContainerView, 25), boardScrollView.AtRightOf(boardContainerView, 25), boardScrollView.WithRelativeHeight(boardContainerView, 0.55f) ); // Bottom View trackingButton = RoundedButtonManager.ButtonInitiaziler(EnvironmentInfo.GetTrackingButtonDistanceBetweenTextAndImage); this.AddLinqBinding(ViewModel, vm => vm.TrackingCommand, (value) => { trackingButton.BackgroundColor = UIColor.White; trackingButton.Alpha = 0.7f; trackingButton.ButtonTextColor = UIColor.FromRGB(3, 117, 27); }); //var callCenterLabel = new UILabel(); //_callCentergButton = ButtonInitiaziler(null, UIImage.FromFile(@"Images/ic_home_support.png")); //_callCentergButton.ButtonText.TextColor = UIColor.LightGray; //_callCentergButton.ButtonBackgroundColor = null; //callCenterLabel.Text = "+(1)305 335 85 08"; //callCenterLabel.TextColor = UIColor.LightGray; var bottomView = new UIView(); bottomView.AddIfNotNull(trackingButton); bottomView.AddConstraints( trackingButton.AtTopOf(bottomView), trackingButton.AtLeftOf(bottomView, 20), trackingButton.AtRightOf(bottomView, 20), trackingButton.WithRelativeHeight(bottomView, EnvironmentInfo.GetTrackingButtonHeight), trackingButton.WithRelativeWidth(bottomView, EnvironmentInfo.GetTrackingButtonWidth) ); // View Initialising View.AddIfNotNull(topView, boardContainerView, bottomView); View.AddConstraints( topView.AtTopOf(View), topView.AtLeftOf(View), topView.AtRightOf(View), topView.WithRelativeHeight(View, 0.2f), boardContainerView.Below(topView), boardContainerView.AtLeftOf(View, 15), boardContainerView.AtRightOf(View, 15), boardContainerView.WithRelativeHeight(View, 0.43f), bottomView.Below(boardContainerView), bottomView.WithSameCenterX(topView), bottomView.WithRelativeHeight(View, 0.27f), bottomView.AtBottomOf(View, 30) ); }
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 stackView = new UIStackView(); var scrollView = new UIScrollView(); topTextRowView = new UIView(); 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, "Registration", UIFont.BoldSystemFontOfSize(16f)); informationAboutPageLabel = LabelInformationAboutPage(UIColor.FromRGB(29, 157, 189), "", 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 s = UIScreen.MainScreen.Bounds.Width; 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"); passwordTextField = TextFieldInitializer("Password *"); confirmPasswordTextField = TextFieldInitializer("Confirm Password *"); phoneNumberTextField = TextFieldInitializer("(000) 000-0000 *"); registrationButton = ButtonInitializer("Registration", UIControlState.Normal, Theme.BlueDark.ToUIColor(), UIColor.White, UIControlState.Normal, null, UIControlState.Disabled); 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, passwordTextField, confirmPasswordTextField); centerTextRowView.AddConstraints( emailTextField.AtTopOf(centerTextRowView), emailTextField.WithSameCenterX(centerTextRowView), emailTextField.WithSameWidth(centerTextRowView), emailTextField.WithRelativeHeight(centerTextRowView, 0.3f), passwordTextField.Below(emailTextField, 10), passwordTextField.WithSameCenterX(centerTextRowView), passwordTextField.WithSameWidth(centerTextRowView), passwordTextField.WithRelativeHeight(centerTextRowView, 0.3f), confirmPasswordTextField.Below(passwordTextField, 10), confirmPasswordTextField.WithSameCenterX(centerTextRowView), confirmPasswordTextField.WithSameWidth(centerTextRowView), confirmPasswordTextField.WithRelativeHeight(centerTextRowView, 0.3f) ); bottomView.AddIfNotNull(registrationButton, phoneNumberTextField); bottomView.AddConstraints( phoneNumberTextField.AtTopOf(bottomView), phoneNumberTextField.WithSameCenterX(bottomView), phoneNumberTextField.WithSameWidth(bottomView), phoneNumberTextField.WithRelativeHeight(bottomView, 0.4f), registrationButton.Below(phoneNumberTextField, 10), registrationButton.WithSameCenterX(bottomView), registrationButton.WithSameWidth(bottomView), registrationButton.WithRelativeHeight(bottomView, 0.4f) ); stackView.AddIfNotNull(topTextRowView, centerTextRowView, bottomView); stackView.AddConstraints( topTextRowView.AtTopOf(stackView, 30), topTextRowView.WithSameWidth(stackView), topTextRowView.WithSameCenterX(stackView), topTextRowView.WithRelativeHeight(stackView, 0.10f), centerTextRowView.Below(topTextRowView, 10), centerTextRowView.WithSameWidth(stackView), centerTextRowView.AtLeftOf(stackView), centerTextRowView.AtRightOf(stackView), centerTextRowView.WithRelativeHeight(stackView, 0.35f), bottomView.Below(centerTextRowView, 10), bottomView.WithSameWidth(stackView), bottomView.AtLeftOf(stackView), bottomView.AtRightOf(stackView), bottomView.WithRelativeHeight(stackView, 0.25f) ); View.AddIfNotNull(topView, stackView); View.AddConstraints( topView.AtTopOf(View), topView.WithSameWidth(View), topView.WithRelativeHeight(View, 0.2f), stackView.Below(topView, 30), stackView.AtLeftOf(View, 30), stackView.AtRightOf(View, 30), stackView.WithRelativeHeight(View, 0.8f) ); EnableNextKeyForTextFields(firstNameTextField.TextFieldWithValidator.TextField, lastNameTextField.TextFieldWithValidator.TextField, emailTextField.TextFieldWithValidator.TextField, passwordTextField.TextFieldWithValidator.TextField, confirmPasswordTextField.TextFieldWithValidator.TextField, phoneNumberTextField.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) ); }
public static T CreateAndAdd <T>(this UIView container, T view) where T : UIView { container.AddIfNotNull(view); return(view.Normalize()); }
protected override void InitializeObjects() { base.InitializeObjects(); var topView = new UIView(); var scrollView = new UIScrollView(); var topTextRowView = new UIView(); 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")); nameOfPageLabel = LabelInformationAboutPage(UIColor.White, "License Information", UIFont.BoldSystemFontOfSize(16f)); informationAboutPageLabel = LabelInformationAboutPage(UIColor.FromRGB(29, 157, 189), "Please, Enter the License Plate Number and Other Information for Your Vehicle.", 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));//EnvironmentInfo.CheckDevice().Scale(View.Frame.Size)); profileNavigationBarBackground.Frame = new CoreGraphics.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.6f) ); 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) ); licensePlateTextField = TextFieldInitializer("LicensePlate"); stateTextField = TextFieldInitializer("State"); statesPicker = PickerInitializer(); statesPickerViewModel = new MvxPickerViewModel(statesPicker); statesPicker.Model = statesPickerViewModel; vehicleClassTextField = TextFieldInitializer("Vehicle Class"); vehicleClassesPicker = PickerInitializer(); vehicleClassesPickerViewModel = new MvxPickerViewModel(vehicleClassesPicker); vehicleClassesPicker.Model = vehicleClassesPickerViewModel; topTextRowView.AddIfNotNull(licensePlateTextField, stateTextField, vehicleClassTextField); topTextRowView.AddConstraints( licensePlateTextField.AtTopOf(topTextRowView), licensePlateTextField.WithSameCenterX(topTextRowView), licensePlateTextField.WithSameWidth(topTextRowView), licensePlateTextField.WithRelativeHeight(topTextRowView, 0.3f), stateTextField.Below(licensePlateTextField, 10), stateTextField.WithSameCenterX(topTextRowView), stateTextField.WithSameWidth(topTextRowView), stateTextField.WithRelativeHeight(topTextRowView, 0.3f), vehicleClassTextField.Below(stateTextField, 10), vehicleClassTextField.WithSameCenterX(topTextRowView), vehicleClassTextField.WithSameWidth(topTextRowView), vehicleClassTextField.WithRelativeHeight(topTextRowView, 0.3f) ); scrollView.AddIfNotNull(topTextRowView); scrollView.AddConstraints( topTextRowView.AtTopOf(scrollView), topTextRowView.WithSameWidth(scrollView), topTextRowView.AtLeftOf(scrollView), topTextRowView.AtRightOf(scrollView), topTextRowView.WithRelativeHeight(scrollView, 0.4f) ); 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(licensePlateTextField.TextFieldWithValidator.TextField, stateTextField.TextFieldWithValidator.TextField, vehicleClassTextField.TextFieldWithValidator.TextField); }