Пример #1
0
        //functions
        public void BuildPageObjects()
        {
            var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label));
            var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button));

            //Layout
            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    #if __ANDROID__
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
#endif
#if __IOS__
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
#endif
                },
#if __IOS__
                ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
#endif
            };
            outerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            //View objects
            playListNameLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 2,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
                Margin     = -5,
#endif
                Text = "Name:"
            };
            playListNameEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize * .75,
#endif
                Placeholder = "Leg Lasso List"
            };
            playListDescriptionLbl = new Label
            {
                Text = "Description:",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 2,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
                Margin     = -5,
#endif
            };
            playListDescriptionEditor = new Editor
            {
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Editor)),
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily      = "Roboto Bold",
                BackgroundColor = Color.White
#endif
            };
            editorFrame = new Frame
            {
                Content         = playListDescriptionEditor,
                BorderColor     = Color.Black,
                BackgroundColor = Color.Black,
                HasShadow       = false,
                Padding         = 3
            };
            backBtn = new Button
            {
                Style = (Style)Application.Current.Resources["common-red-btn"],
                Image = "back.png"
            };
            createBtn = new Button
            {
                Style = (Style)Application.Current.Resources["common-blue-btn"],
                Text  = "Create",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = btnSize * 2,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = btnSize * 1.25,
#endif
            };

#if __ANDROID__
            var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174));
            pd.SetCornerRadius(100);

            androidPlaylistNameEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidPlaylistNameEntry.Hint     = "Enter Name";
            androidPlaylistNameEntry.Typeface = Constants.COMMONFONT;
            androidPlaylistNameEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
            androidPlaylistNameEntry.SetTextColor(Android.Graphics.Color.Black);
            androidPlaylistNameEntry.Gravity   = Android.Views.GravityFlags.Start;
            androidPlaylistNameEntry.InputType = Android.Text.InputTypes.TextFlagNoSuggestions;

            androidPlaylistDescriptionEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidPlaylistDescriptionEntry.Hint     = "Enter Description";
            androidPlaylistDescriptionEntry.Typeface = Constants.COMMONFONT;
            androidPlaylistDescriptionEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidPlaylistDescriptionEntry.SetTextColor(Android.Graphics.Color.Black);
            androidPlaylistDescriptionEntry.Gravity   = Android.Views.GravityFlags.Start;
            androidPlaylistDescriptionEntry.InputType = Android.Text.InputTypes.TextVariationLongMessage;

            androidCreateBtn          = new Android.Widget.Button(MainApplication.ActivityContext);
            androidCreateBtn.Text     = "Create Playlist";
            androidCreateBtn.Typeface = Constants.COMMONFONT;
            androidCreateBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidCreateBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255));
            androidCreateBtn.SetBackground(pd);
            androidCreateBtn.Gravity = Android.Views.GravityFlags.Center;
            androidCreateBtn.SetAllCaps(false);
            androidCreateBtn.Click += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await CreatePlaylist(sender, e);

                ToggleButtons();
            };


            contentViewAndroidPlaylistNameEntry                = new ContentView();
            contentViewAndroidPlaylistNameEntry.Content        = androidPlaylistNameEntry.ToView();
            contentViewAndroidPlaylistDescriptionEntry         = new ContentView();
            contentViewAndroidPlaylistDescriptionEntry.Content = androidPlaylistDescriptionEntry.ToView();
            contentViewAndroidCreateBtn         = new ContentView();
            contentViewAndroidCreateBtn.Content = androidCreateBtn.ToView();
#endif

            //events
            backBtn.Clicked += async(object sender, EventArgs e) => {
                ToggleButtons();
                await Navigation.PopModalAsync();

                ToggleButtons();
            };
            createBtn.Clicked += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await CreatePlaylist(sender, e);

                ToggleButtons();
            };


#if __IOS__
            //building grid
            innerGrid.Children.Add(playListNameLbl, 0, 0);
            playListNameLbl.VerticalTextAlignment   = TextAlignment.Center;
            playListNameLbl.HorizontalTextAlignment = TextAlignment.Center;
            Grid.SetColumnSpan(playListNameLbl, 2);
            innerGrid.Children.Add(playListNameEntry, 0, 1);
            Grid.SetColumnSpan(playListNameEntry, 2);
            innerGrid.Children.Add(playListDescriptionLbl, 0, 2);
            Grid.SetColumnSpan(playListDescriptionLbl, 2);
            playListDescriptionLbl.VerticalTextAlignment   = TextAlignment.Center;
            playListDescriptionLbl.HorizontalTextAlignment = TextAlignment.Center;
            innerGrid.Children.Add(editorFrame, 0, 3);
            Grid.SetRowSpan(editorFrame, 3);
            Grid.SetColumnSpan(editorFrame, 2);

            innerGrid.Children.Add(backBtn, 0, 7);
            innerGrid.Children.Add(createBtn, 1, 7);
#endif
#if __ANDROID__
            //building grid
            innerGrid.Children.Add(contentViewAndroidPlaylistNameEntry, 0, 2);
            innerGrid.Children.Add(contentViewAndroidPlaylistDescriptionEntry, 0, 3);
            innerGrid.Children.Add(contentViewAndroidCreateBtn, 0, 6);
#endif

            outerGrid.Children.Add(innerGrid, 0, 0);

            Content = outerGrid;
        }
Пример #2
0
        private void BuildPageObjects()
        {
            var btnSize   = Device.GetNamedSize(NamedSize.Large, typeof(Button));
            var lblSize   = Device.GetNamedSize(NamedSize.Large, typeof(Label));
            var entrySize = Device.GetNamedSize(NamedSize.Large, typeof(Entry));

            stackLayout = new StackLayout();
            entryLayout = new StackLayout();
            buttonGrid  = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

#if __ANDROID__
            var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174));
            pd.SetCornerRadius(100);

            outerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            androidHeaderLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidHeaderLbl.Text     = "Forgot Password";
            androidHeaderLbl.Typeface = Constants.COMMONFONT;
            androidHeaderLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
            androidHeaderLbl.SetTextColor(Android.Graphics.Color.Black);
            androidHeaderLbl.Gravity = Android.Views.GravityFlags.Center;

            androidEmailLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidEmailLbl.Text     = "E-Mail Address";
            androidEmailLbl.Typeface = Constants.COMMONFONT;
            androidEmailLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100);
            androidEmailLbl.SetTextColor(Android.Graphics.Color.Black);
            androidEmailLbl.Gravity = Android.Views.GravityFlags.Center;

            androidEmailEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidEmailEntry.Hint     = "Enter E-Mail";
            androidEmailEntry.Typeface = Constants.COMMONFONT;
            androidEmailEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidEmailEntry.SetTextColor(Android.Graphics.Color.Black);
            androidEmailEntry.Gravity   = Android.Views.GravityFlags.Center;
            androidEmailEntry.InputType = Android.Text.InputTypes.TextVariationEmailAddress;

            androidNextBtn          = new Android.Widget.Button(MainApplication.ActivityContext);
            androidNextBtn.Text     = "Next";
            androidNextBtn.Typeface = Constants.COMMONFONT;
            androidNextBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidNextBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255));
            androidNextBtn.Gravity = Android.Views.GravityFlags.Center;
            androidNextBtn.SetBackground(pd);
            androidNextBtn.Click += async(object sender, EventArgs e) => {
                ToggleButtons();
                await CheckIfUserExists(sender, e);

                ToggleButtons();
            };

            androidNextImgBtn = new Android.Widget.ImageButton(MainApplication.ActivityContext);
            androidNextImgBtn.SetImageResource(2130837802);
            androidNextImgBtn.SetAdjustViewBounds(true);
            androidNextImgBtn.SetBackground(pd);
            androidNextImgBtn.Click += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await CheckIfUserExists(sender, e);

                ToggleButtons();
            };

            contentViewHeaderLbl          = new ContentView();
            contentViewHeaderLbl.Content  = androidHeaderLbl.ToView();
            contentViewEmailLbl           = new ContentView();
            contentViewEmailLbl.Content   = androidEmailLbl.ToView();
            contentViewEmailEntry         = new ContentView();
            contentViewEmailEntry.Content = androidEmailEntry.ToView();
            contentViewNextBtn            = new ContentView();
            contentViewNextBtn.Content    = androidNextImgBtn.ToView();
#endif

            headerLbl = new Label
            {
                Text = "Forgot Password",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
#endif
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.StartAndExpand
            };


            emailLbl = new Label
            {
                Text = "E-Mail Address",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize * .75,
#endif
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };

            emailEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = entrySize * 1.25,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = entrySize * .75,
#endif
                Placeholder = "Enter E-Mail"
            };

            backBtn = new Button
            {
                Image = "back.png",
                Style = (Style)Application.Current.Resources["common-red-btn"]
            };

            nextBtn = new Button
            {
                Style             = (Style)Application.Current.Resources["common-blue-btn"],
                Image             = "next.png",
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            //events
            backBtn.Clicked += async(object sender, EventArgs e) => {
                ToggleButtons();
                await Navigation.PopModalAsync();

                ToggleButtons();
            };
            nextBtn.Clicked += async(object sender, EventArgs e) => {
                ToggleButtons();
                await CheckIfUserExists(sender, e);

                ToggleButtons();
            };

            //building layouts
#if __ANDROID__
            innerGrid.Children.Add(contentViewHeaderLbl, 0, 0);
            innerGrid.Children.Add(contentViewEmailLbl, 0, 3);
            innerGrid.Children.Add(contentViewEmailEntry, 0, 4);
            innerGrid.Children.Add(contentViewNextBtn, 0, 7);

            outerGrid.Children.Add(innerGrid, 0, 0);

            Content = outerGrid;
#endif
#if __IOS__
            buttonGrid.Children.Add(backBtn, 0, 0);
            buttonGrid.Children.Add(nextBtn, 1, 0);

            entryLayout.Children.Add(emailLbl);
            entryLayout.Children.Add(emailEntry);
            entryLayout.HorizontalOptions = LayoutOptions.FillAndExpand;
            entryLayout.VerticalOptions   = LayoutOptions.FillAndExpand;
            stackLayout.Children.Add(headerLbl);
            stackLayout.Children.Add(entryLayout);
            stackLayout.Children.Add(buttonGrid);

            Content = stackLayout;
#endif
        }
Пример #3
0
        //functions
        private void SetContent()
        {
            var btnSize   = Device.GetNamedSize(NamedSize.Large, typeof(Button));
            var lblSize   = Device.GetNamedSize(NamedSize.Large, typeof(Label));
            var entrySize = Device.GetNamedSize(NamedSize.Large, typeof(Entry));

            //View objects
            beltLbl = new Label
            {
                Text = "Belt",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
                Margin     = new Thickness(0, -5, 0, -5),
#endif
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };
            beltList = new ObservableCollection <string>();
            beltList.Add("White");
            beltList.Add("Blue");
            beltList.Add("Purple");
            beltList.Add("Brown");
            beltList.Add("Black");
            beltPicker = new Picker
            {
                Title       = "Choose Your Rank",
                ItemsSource = beltList
            };
            nameLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
                Margin     = new Thickness(0, -5, 0, -5),
#endif
                Text = "Name",
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };
            nameEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = entrySize,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = entrySize * .5,
                Margin     = new Thickness(0, -5, 0, -5),
#endif
                Placeholder       = "Brian Mahecha",
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            emailAddressLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
                Margin     = new Thickness(0, -5, 0, -5),
#endif
                Text = "E-Mail Address",
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };
            emailAddressEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = entrySize,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                Margin     = new Thickness(0, -5, 0, -5),
                FontSize   = entrySize * .5,
#endif
                Placeholder       = "*****@*****.**",
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            passWordLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                Margin     = new Thickness(0, -5, 0, -5),
                FontSize   = lblSize,
#endif
                Text = "Password",
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };
            passWordEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = entrySize,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                Margin     = new Thickness(0, -5, 0, -5),
                FontSize   = entrySize * .5,
#endif
                IsPassword        = true,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            secretQuestionLbl = new Label
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                Margin     = new Thickness(0, -5, 0, -5),
                FontSize   = lblSize,
#endif
                Text = "Secret Questions",
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };
            secretQuestionList = new ObservableCollection <String>();
            secretQuestionList.Add("What city were you born in?");
            secretQuestionList.Add("What city was your high school?");
            secretQuestionList.Add("Name of favorite instructor.");
            secretQuestionPicker = new Picker
            {
                Title       = "Select a secret question to answer!",
                ItemsSource = secretQuestionList
            };
            secretQuestionEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = entrySize,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                Margin     = new Thickness(0, -5, 0, -5),
                FontSize   = entrySize * .5,
#endif
                Placeholder       = "Answer for your own security!",
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            nextBtn = new Button
            {
                Style             = (Style)Application.Current.Resources["common-blue-btn"],
                Image             = "next.png",
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            backBtn = new Button
            {
                Style             = (Style)Application.Current.Resources["common-red-btn"],
                Image             = "back.png",
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            clearBtn = new Button
            {
                Style = (Style)Application.Current.Resources["common-red-btn"],
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
#endif
                Text     = "Clear",
                FontSize = btnSize
            };

#if __ANDROID__
            var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174));
            pd.SetCornerRadius(100);

            androidNameEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidNameEntry.Hint     = "Name";
            androidNameEntry.Typeface = Constants.COMMONFONT;
            androidNameEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidNameEntry.SetTextColor(Android.Graphics.Color.Black);
            androidNameEntry.Gravity   = Android.Views.GravityFlags.Start;
            androidNameEntry.InputType = Android.Text.InputTypes.TextVariationPersonName;

            androidBeltLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidBeltLbl.Text     = "Belt";
            androidBeltLbl.Typeface = Constants.COMMONFONT;
            androidBeltLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidBeltLbl.SetTextColor(Android.Graphics.Color.Black);
            androidBeltLbl.Gravity = Android.Views.GravityFlags.Start;

            androidEmailAddressEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidEmailAddressEntry.Hint     = "E-Mail Address";
            androidEmailAddressEntry.Typeface = Constants.COMMONFONT;
            androidEmailAddressEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidEmailAddressEntry.SetTextColor(Android.Graphics.Color.Black);
            androidEmailAddressEntry.Gravity   = Android.Views.GravityFlags.Start;
            androidEmailAddressEntry.InputType = Android.Text.InputTypes.TextVariationEmailAddress;

            androidPassWordEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidPassWordEntry.Hint     = "Password";
            androidPassWordEntry.Typeface = Constants.COMMONFONT;
            androidPassWordEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidPassWordEntry.SetTextColor(Android.Graphics.Color.Black);
            androidPassWordEntry.Gravity              = Android.Views.GravityFlags.Start;
            androidPassWordEntry.InputType            = Android.Text.InputTypes.TextVariationPassword;
            androidPassWordEntry.TransformationMethod = new PasswordTransformationMethod();

            androidSecretQuestionsLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidSecretQuestionsLbl.Text     = "Secret Questions";
            androidSecretQuestionsLbl.Typeface = Constants.COMMONFONT;
            androidSecretQuestionsLbl.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidSecretQuestionsLbl.SetTextColor(Android.Graphics.Color.Black);
            androidSecretQuestionsLbl.Gravity = Android.Views.GravityFlags.Start;

            androidSecretQuestionEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidSecretQuestionEntry.Hint     = "Answer for your own security!";
            androidSecretQuestionEntry.Typeface = Constants.COMMONFONT;
            androidSecretQuestionEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidSecretQuestionEntry.SetTextColor(Android.Graphics.Color.Black);
            androidSecretQuestionEntry.Gravity   = Android.Views.GravityFlags.Start;
            androidSecretQuestionEntry.InputType = Android.Text.InputTypes.TextVariationShortMessage;

            androidNextImgBtn = new Android.Widget.ImageButton(MainApplication.ActivityContext);
            androidNextImgBtn.SetImageResource(2130837802);
            androidNextImgBtn.SetAdjustViewBounds(true);
            androidNextImgBtn.SetBackground(pd);
            androidNextImgBtn.Click += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await Validate();

                ToggleButtons();
            };
#endif

            //Events
            nextBtn.Clicked += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await Validate();

                ToggleButtons();
            };
            backBtn.Clicked += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await Navigation.PopModalAsync();

                ToggleButtons();
            };
            //passWordRepeatEntry.Unfocused += PasswordMatch;
            //TODO add specific validation events to make sure entries are correct.

            tableView = new TableView();
            tableView.BackgroundColor = Color.FromHex("#F1ECCE");
            tableView.Intent          = TableIntent.Form;
            tableView.Root            = new TableRoot()
            {
                new TableSection()
                {
                    new ViewCell {
                        View = nameLbl
                    },
                    new ViewCell {
                        View = nameEntry
                    },
                    new ViewCell {
                        View = emailAddressLbl
                    },
                    new ViewCell {
                        View = emailAddressEntry
                    },
                    new ViewCell {
                        View = beltLbl
                    },
                    new ViewCell {
                        View = beltPicker
                    },
                    new ViewCell {
                        View = passWordLbl
                    },
                    new ViewCell {
                        View = passWordEntry
                    },
                    new ViewCell {
                        View = secretQuestionLbl
                    },
                    new ViewCell {
                        View = secretQuestionPicker
                    },
                    new ViewCell {
                        View = secretQuestionEntry
                    }
                }
            };
#if __IOS__
            buttonGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
            buttonGrid.Children.Add(backBtn, 0, 0);
            buttonGrid.Children.Add(nextBtn, 1, 0);
#endif
#if __ANDROID__
            buttonGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
            buttonGrid.Children.Add(androidNextImgBtn.ToView(), 0, 0);
#endif

            scrollView = new ScrollView();
#if __IOS__
            stackLayout = new StackLayout
            {
                Children =
                {
                    tableView
                }
            };
#endif
#if __ANDROID__
            stackLayout = new StackLayout
            {
                Children =
                {
                    androidNameEntry.ToView(),
                    androidEmailAddressEntry.ToView(),
                    androidBeltLbl.ToView(),
                    beltPicker,
                    androidPassWordEntry.ToView(),
                    androidSecretQuestionsLbl.ToView(),
                    secretQuestionPicker,
                    androidSecretQuestionEntry.ToView()
                }
            };
#endif
            scrollView.Content = stackLayout;
#if __ANDROID__
            scrollView.IsClippedToBounds = true;
#endif

#if __IOS__
            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(9, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
#endif
#if __ANDROID__
            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(9, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
#endif
            outerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
            innerGrid.Children.Add(scrollView, 0, 0);
            innerGrid.Children.Add(buttonGrid, 0, 1);
            outerGrid.Children.Add(innerGrid);
            Content = outerGrid;
        }
Пример #4
0
        private void BuildPageObjects()
        {
            var btnSize   = Device.GetNamedSize(NamedSize.Large, typeof(Button));
            var lblSize   = Device.GetNamedSize(NamedSize.Large, typeof(Label));
            var entrySize = Device.GetNamedSize(NamedSize.Large, typeof(Entry));

            stackLayout = new StackLayout();
            scrollView  = new ScrollView();
            buttonGrid  = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(3, GridUnitType.Star)
                    }
                }
            };

            headerLbl = new Label
            {
                Text = "Change Password",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 2,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
#endif
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.StartAndExpand,
                HorizontalOptions       = LayoutOptions.CenterAndExpand
            };

            secretQuestionLbl = new Label
            {
                Text = _user.SecretQuestion,
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize * .75,
#endif
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalOptions       = LayoutOptions.FillAndExpand
            };

            secretQuestionEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = entrySize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = entrySize * .75,
#endif
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            newPasswordLbl = new Label
            {
                Text = "New Password",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize * .75,
#endif
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalOptions         = LayoutOptions.CenterAndExpand,
                HorizontalOptions       = LayoutOptions.CenterAndExpand
            };

            newPasswordEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = entrySize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = entrySize * .75,
#endif
                IsPassword        = true,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            backBtn = new Button
            {
                Image = "back.png",
                Style = (Style)Application.Current.Resources["common-red-btn"]
            };

            submitBtn = new Button
            {
                Style = (Style)Application.Current.Resources["common-blue-btn"],

#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = btnSize * 1.5,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = btnSize * .75,
#endif
                Text = "Submit"
            };

#if __ANDROID__
            var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174));
            pd.SetCornerRadius(100);

            innerGrid = new Grid();
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(2, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            innerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(2, GridUnitType.Star)
            });

            outerGrid = new Grid();
            outerGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });

            androidSecretQuestionLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidSecretQuestionLbl.Text     = _user.SecretQuestion;
            androidSecretQuestionLbl.Typeface = Constants.COMMONFONT;
            androidSecretQuestionLbl.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidSecretQuestionLbl.SetTextColor(Android.Graphics.Color.Black);
            androidSecretQuestionLbl.Gravity = Android.Views.GravityFlags.Center;

            androidSecretQuestionEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidSecretQuestionEntry.Typeface = Constants.COMMONFONT;
            androidSecretQuestionEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidSecretQuestionEntry.SetTextColor(Android.Graphics.Color.Black);
            androidSecretQuestionEntry.Gravity   = Android.Views.GravityFlags.Start;
            androidSecretQuestionEntry.InputType = Android.Text.InputTypes.TextVariationShortMessage;

            androidNewPasswordLbl          = new Android.Widget.TextView(MainApplication.ActivityContext);
            androidNewPasswordLbl.Text     = "New Password";
            androidNewPasswordLbl.Typeface = Constants.COMMONFONT;
            androidNewPasswordLbl.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidNewPasswordLbl.SetTextColor(Android.Graphics.Color.Black);
            androidNewPasswordLbl.Gravity = Android.Views.GravityFlags.Center;

            androidNewPasswordEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidNewPasswordEntry.Typeface = Constants.COMMONFONT;
            androidNewPasswordEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidNewPasswordEntry.SetTextColor(Android.Graphics.Color.Black);
            androidNewPasswordEntry.Gravity              = Android.Views.GravityFlags.Start;
            androidNewPasswordEntry.InputType            = Android.Text.InputTypes.TextVariationPassword;
            androidNewPasswordEntry.TransformationMethod = new PasswordTransformationMethod();

            androidSubmitBtn          = new Android.Widget.Button(MainApplication.ActivityContext);
            androidSubmitBtn.Text     = "Change Password";
            androidSubmitBtn.Typeface = Constants.COMMONFONT;
            androidSubmitBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidSubmitBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255));
            androidSubmitBtn.SetBackground(pd);
            androidSubmitBtn.SetAllCaps(false);
            androidSubmitBtn.Click += async(object sender, EventArgs e) =>
            {
                ToggleButtons();
                await ChangePassword(sender, e);

                ToggleButtons();
            };

            contentViewAndroidSecretQuestionLbl         = new ContentView();
            contentViewAndroidSecretQuestionLbl.Content = androidSecretQuestionLbl.ToView();

            contentViewAndroidSecretQuestionEntry         = new ContentView();
            contentViewAndroidSecretQuestionEntry.Content = androidSecretQuestionEntry.ToView();

            contentViewAndroidNewPasswordLbl         = new ContentView();
            contentViewAndroidNewPasswordLbl.Content = androidNewPasswordLbl.ToView();

            contentViewAndroidNewPasswordEntry         = new ContentView();
            contentViewAndroidNewPasswordEntry.Content = androidNewPasswordEntry.ToView();

            contentViewAndroidSubmitBtn         = new ContentView();
            contentViewAndroidSubmitBtn.Content = androidSubmitBtn.ToView();
#endif

            //events
            backBtn.Clicked += (sender, e) =>
            {
                backBtn.IsEnabled = false;
                Navigation.PopModalAsync();
                backBtn.IsEnabled = true;
            };
            submitBtn.Clicked += async(object sender, EventArgs e) => {
                ToggleButtons();
                await ChangePassword(sender, e);

                ToggleButtons();
            };

            //layout
#if __ANDROID__
            innerGrid.Children.Add(contentViewAndroidSecretQuestionLbl, 0, 3);
            innerGrid.Children.Add(contentViewAndroidSecretQuestionEntry, 0, 4);
            innerGrid.Children.Add(contentViewAndroidNewPasswordLbl, 0, 6);
            innerGrid.Children.Add(contentViewAndroidNewPasswordEntry, 0, 7);
            innerGrid.Children.Add(contentViewAndroidSubmitBtn, 0, 10);

            outerGrid.Children.Add(innerGrid, 0, 0);

            Content = outerGrid;
#endif
#if __IOS__
            buttonGrid.Children.Add(backBtn, 0, 0);
            buttonGrid.Children.Add(submitBtn, 1, 0);

            stackLayout.Children.Add(headerLbl);
            stackLayout.Children.Add(secretQuestionLbl);
            stackLayout.Children.Add(secretQuestionEntry);
            stackLayout.Children.Add(newPasswordLbl);
            stackLayout.Children.Add(newPasswordEntry);
            stackLayout.Children.Add(buttonGrid);

            scrollView.Content = stackLayout;

            Content = scrollView;
#endif
        }
Пример #5
0
        //functions
        private void BuildPageObjects()
        {
            var btnSize   = Device.GetNamedSize(NamedSize.Large, typeof(Button));
            var lblSize   = Device.GetNamedSize(NamedSize.Large, typeof(Label));
            var entrySize = Device.GetNamedSize(NamedSize.Large, typeof(Entry));

            scrollView               = new ScrollView();
            stackLayout              = new StackLayout();
            buttonLayout             = new StackLayout();
            emailLayout              = new StackLayout();
            passwordLayout           = new StackLayout();
            innerStackLayout         = new StackLayout();
            innerStackLayout.Spacing = 50;
            //View objects
            innerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(7, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(2, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(2, GridUnitType.Star)
                    },
                    new RowDefinition {
                        Height = new GridLength(2, GridUnitType.Star)
                    }
                }
            };
            outerGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
            buttonGrid = new Grid
            {
                ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition {
                        Width = new GridLength(3, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };
            emailGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(3, GridUnitType.Star)
                    }
                }
            };
            passwordGrid = new Grid
            {
                RowDefinitions = new RowDefinitionCollection
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions = new ColumnDefinitionCollection
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(3, GridUnitType.Star)
                    }
                }
            };
            mahechaLogo = new Image
            {
                Source = ImageSource.FromResource("mahechabjjlogo.png"),
                Aspect = Aspect.AspectFit
            };
            emailImg = new Image
            {
                Source = "mail.png",
                Aspect = Aspect.AspectFit
            };
            emailLbl = new Label
            {
                Text = "E-Mail Address",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 2,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
                Margin     = -5,
#endif
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };
            emailEntry = new Entry
            {
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily  = "Roboto Bold",
                Placeholder = "E-Mail Address",
#endif
                FontSize          = entrySize,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            passwordImg = new Image
            {
                Source = "password.png",
                Aspect = Aspect.AspectFit
            };
            passwordLbl = new Label
            {
                Text = "Password",
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
                FontSize   = lblSize * 2,
#endif
#if __ANDROID__
                FontFamily = "Roboto Bold",
                FontSize   = lblSize,
                Margin     = -5,
#endif
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };
            passwordEntry = new Entry
            {
                IsPassword = true,
#if __IOS__
                FontFamily = "AmericanTypewriter-Bold",
#endif
#if __ANDROID__
                FontFamily  = "Roboto Bold",
                Placeholder = "Password",
#endif
                FontSize          = entrySize,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            loginBtn = new Button
            {
                Text              = "Login",
                FontFamily        = "AmericanTypewriter-Bold",
                FontSize          = btnSize * 2,
                Style             = (Style)Application.Current.Resources["common-blue-btn"],
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            backBtn = new Button
            {
                Image             = "back.png",
                Style             = (Style)Application.Current.Resources["common-red-btn"],
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            forgotPasswordBtn = new Button
            {
                Image             = "forgotpassword.png",
                Style             = (Style)Application.Current.Resources["common-blue-btn"],
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

#if __ANDROID__
            var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174));
            pd.SetCornerRadius(100);

            var pdTwo = new PaintDrawable(Android.Graphics.Color.Rgb(124, 37, 41));
            pdTwo.SetCornerRadius(100);

            androidLoginBtn          = new Android.Widget.Button(MainApplication.ActivityContext);
            androidLoginBtn.Text     = "Login";
            androidLoginBtn.Typeface = Constants.COMMONFONT;
            androidLoginBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidLoginBtn.SetBackground(pd);
            androidLoginBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255));
            androidLoginBtn.Gravity = Android.Views.GravityFlags.Center;
            androidLoginBtn.SetAllCaps(false);

            androidForgotPasswordBtn          = new Android.Widget.Button(MainApplication.ActivityContext);
            androidForgotPasswordBtn.Text     = "?";
            androidForgotPasswordBtn.Typeface = Constants.COMMONFONT;
            androidForgotPasswordBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform);
            androidForgotPasswordBtn.SetBackground(pdTwo);
            androidForgotPasswordBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255));
            androidForgotPasswordBtn.Gravity = Android.Views.GravityFlags.Center;
            androidForgotPasswordBtn.SetAllCaps(false);

            androidForgetPasswordImgBtn = new Android.Widget.ImageButton(MainApplication.ActivityContext);
            androidForgetPasswordImgBtn.SetImageResource(2130837598);
            androidForgetPasswordImgBtn.SetAdjustViewBounds(true);
            androidForgetPasswordImgBtn.SetBackground(pdTwo);

            androidEmailEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidEmailEntry.Typeface = Constants.COMMONFONT;
            androidEmailEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidEmailEntry.SetPadding(0, 10, 0, 10);
            androidEmailEntry.SetTextColor(Android.Graphics.Color.Black);
            androidEmailEntry.InputType = Android.Text.InputTypes.TextVariationEmailAddress;

            androidImageEmail = new Android.Widget.ImageView(MainApplication.ActivityContext);
            androidImageEmail.SetImageResource(2130837780);
            androidImageEmail.SetAdjustViewBounds(true);

            androidPasswordEntry          = new Android.Widget.EditText(MainApplication.ActivityContext);
            androidPasswordEntry.Typeface = Constants.COMMONFONT;
            androidPasswordEntry.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75);
            androidPasswordEntry.SetPadding(0, 0, 0, 0);
            androidPasswordEntry.SetTextColor(Android.Graphics.Color.Black);
            androidPasswordEntry.SetHighlightColor(Android.Graphics.Color.Transparent);
            androidPasswordEntry.InputType            = Android.Text.InputTypes.TextVariationWebPassword;
            androidPasswordEntry.TransformationMethod = new PasswordTransformationMethod();

            androidImagePassword = new Android.Widget.ImageView(MainApplication.ActivityContext);
            androidImagePassword.SetImageResource(2130837816);
            androidImagePassword.SetAdjustViewBounds(true);
#endif
            //Events
            loginBtn.Clicked += async(object sender, EventArgs e) => {
                ToggleButtons();
                await Validate(sender, e);

                ToggleButtons();
            };
            backBtn.Clicked += async(object sender, EventArgs e) => {
                ToggleButtons();
                await Navigation.PopModalAsync();

                ToggleButtons();
            };
            forgotPasswordBtn.Clicked += async(object sender, EventArgs e) => {
                ToggleButtons();
                await Navigation.PushModalAsync(new ForgotPasswordPage());

                ToggleButtons();
            };

#if __ANDROID__
            androidLoginBtn.Click += async(object sender, EventArgs e) => {
                ToggleButtons();
                await Validate(sender, e);

                ToggleButtons();
            };
            androidForgetPasswordImgBtn.Click += async(object sender, EventArgs e) => {
                ToggleButtons();
                await Navigation.PushModalAsync(new ForgotPasswordPage());

                ToggleButtons();
            };
#endif

#if __IOS__
            buttonLayout.Children.Add(backBtn);
            buttonLayout.Children.Add(loginBtn);
            buttonLayout.Children.Add(forgotPasswordBtn);
            buttonLayout.Orientation = StackOrientation.Horizontal;
            emailLayout.Children.Add(emailImg);
            emailLayout.Children.Add(emailEntry);
            emailLayout.Orientation = StackOrientation.Horizontal;
            passwordLayout.Children.Add(passwordImg);
            passwordLayout.Children.Add(passwordEntry);
            passwordLayout.Orientation = StackOrientation.Horizontal;
            innerStackLayout.Children.Add(emailLayout);
            innerStackLayout.Children.Add(passwordLayout);
            //innerStackLayout.Children.Add(emailImg);
            //innerStackLayout.Children.Add(emailEntry);

            //innerStackLayout.Children.Add(passwordImg);
            //innerStackLayout.Children.Add(passwordEntry);
            innerStackLayout.Children.Add(buttonLayout);
            stackLayout.Children.Add(mahechaLogo);
            stackLayout.Children.Add(innerStackLayout);
            stackLayout.Orientation       = StackOrientation.Vertical;
            stackLayout.VerticalOptions   = LayoutOptions.CenterAndExpand;
            stackLayout.HorizontalOptions = LayoutOptions.CenterAndExpand;

            scrollView.Content = stackLayout;
            Content            = scrollView;
#endif
#if __ANDROID__
            buttonGrid.Children.Add(androidLoginBtn.ToView(), 0, 0);
            buttonGrid.Children.Add(androidForgetPasswordImgBtn.ToView(), 1, 0);
            emailGrid.Children.Add(androidImageEmail.ToView(), 0, 0);
            emailGrid.Children.Add(androidEmailEntry.ToView(), 1, 0);
            emailGrid.Padding = new Thickness(10, 0);
            passwordGrid.Children.Add(androidImagePassword.ToView(), 0, 0);
            passwordGrid.Children.Add(androidPasswordEntry.ToView(), 1, 0);
            passwordGrid.Padding = new Thickness(10, 0);
            innerGrid.Children.Add(mahechaLogo, 0, 0);
            innerGrid.Children.Add(emailGrid, 0, 2);
            innerGrid.Children.Add(passwordGrid, 0, 4);
            innerGrid.Children.Add(buttonGrid, 0, 6);

            outerGrid.Children.Add(innerGrid, 0, 0);

            Content = outerGrid;
#endif
        }