public static StackLayout GenerateAccountDetails(ContentView titleBar, SignUpViewModel ViewModel) { var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout); lblTitle.Text = Langs.Const_Screen_Title_Registration_2; var masterGrid = new Grid { RowSpacing = 12, }; masterGrid.ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = App.ScreenSize.Width * .9 } }; masterGrid.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, }; var width = App.ScreenSize.Width * .9; var entryWidth = width * .8 - 20; var companyNameEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Default, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Next, .6, true); companyNameEntry.SetBinding(Entry.TextProperty, new Binding("CompanyName")); var positionEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Default, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Next, .6, true); positionEntry.SetBinding(Entry.TextProperty, new Binding("Position")); ViewModel.EmailAddress = string.Empty; var emailEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Email, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Done, .6, true); emailEntry.SetBinding(Entry.TextProperty, new Binding("EmailAddress")); var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Registration_2_Next, width, new Action(() => { ViewModel.CmdCheckDriver.Execute(null); })); var inStack = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, HeightRequest = 100, Children = { new Label { Text = " " } } }; var imgHelp = new Image { Source = "help".CorrectedImageSource(), HeightRequest = 32 }; var imgHelpGesture = new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(() => { var src = imgHelp.Source as FileImageSource; if (src.File == "help".CorrectedImageSource()) { var _ = new SpeechBubble(Langs.Const_Msg_Registration_Step_2_Help_Description, width, FormsConstants.AppySilverGray); if (inStack.Children.Count > 0) { inStack.Children.RemoveAt(0); } inStack.Children.Add(_); imgHelp.Source = "help_close".CorrectedImageSource(); } else { imgHelp.Source = "help".CorrectedImageSource(); inStack.Children.RemoveAt(0); } }) }; imgHelp.GestureRecognizers.Add(imgHelpGesture); var helpContainer = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = 100, HorizontalOptions = LayoutOptions.Start, Children = { inStack, new StackLayout { HorizontalOptions = LayoutOptions.End, HeightRequest = 64, VerticalOptions = LayoutOptions.Start, Children = { imgHelp } } } }; masterGrid.SizeChanged += (sender, e) => { helpContainer.HeightRequest = App.ScreenSize.Height - 100 - masterGrid.Height; inStack.HeightRequest = (App.ScreenSize.Height - 100 - masterGrid.Height) * .7; }; masterGrid.Children.Add(new EntryCell(Langs.Const_Label_Company_Name, companyNameEntry, width), 0, 0); masterGrid.Children.Add(new EntryCell(Langs.Const_Placeholder_Position, positionEntry, width), 0, 1); masterGrid.Children.Add(new EntryCell(Langs.Const_Label_Email_1, emailEntry, width), 0, 2); masterGrid.Children.Add(arrowButton, 0, 3); var spinner = new ActivityIndicator { HeightRequest = 40, WidthRequest = 40, IsRunning = true }; spinner.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); return(new StackLayout { TranslationX = -6, Padding = new Thickness(0, 12, 0, 0), Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 100, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, Children = { masterGrid, spinner, helpContainer } }); }
public static StackLayout GeneratePasswordDetails(ContentView titleBar, SignUpViewModel ViewModel) { var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout); lblTitle.Text = Langs.Const_Screen_Title_Registration_3; var masterGrid = new Grid { RowSpacing = 12, }; masterGrid.ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = App.ScreenSize.Width * .9 } }; masterGrid.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, }; var width = App.ScreenSize.Width * .9; var entryWidth = width * .8 - 20; var passwordOneEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Default, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Next, .6, true); passwordOneEntry.SetBinding(Entry.TextProperty, new Binding("PasswordOne")); passwordOneEntry.SetBinding(Entry.IsPasswordProperty, new Binding("ShowPasswords", converter: new ReverseBoolConverter())); var passwordTwoEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Default, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Done, .6, true); passwordTwoEntry.SetBinding(Entry.TextProperty, new Binding("PasswordTwo")); passwordTwoEntry.SetBinding(Entry.IsPasswordProperty, new Binding("ShowPasswords", converter: new ReverseBoolConverter())); var swchShowPassword = new Switch(); swchShowPassword.SetBinding(Switch.IsToggledProperty, new Binding("ShowPasswords")); var lblShowPassword = new Label { Text = Langs.Const_Label_Show_Password, TextColor = Color.White, FontFamily = Helper.RegFont }; var swtchStack = new StackLayout { Orientation = StackOrientation.Horizontal, WidthRequest = App.ScreenSize.Width * .6, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(0, 12), Children = { swchShowPassword, lblShowPassword } }; var lblEmail = new Label { Text = Langs.Const_Msg_Marketing, TextColor = Color.White, FontFamily = Helper.RegFont, }; var swchMarketting = new Switch(); swchMarketting.SetBinding(Switch.IsToggledProperty, new Binding("EmailPrefs")); var mrktStack = new StackLayout { Orientation = StackOrientation.Horizontal, WidthRequest = App.ScreenSize.Width * .85, MinimumHeightRequest = 100, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(0, 8), Children = { lblEmail, swchMarketting } }; var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Screen_Title_Registration_4, width, new Action(() => ViewModel.CanMoveToFour())); var midStack = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.Center, Children = { swtchStack, new BoxView { HeightRequest = 1,BackgroundColor = Color.White }, mrktStack, arrowButton } }; var inStack = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, HeightRequest = 100, Children = { new Label { Text = " " } } }; var imgHelp = new Image { Source = "help".CorrectedImageSource(), HeightRequest = 32 }; var imgHelpGesture = new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(() => { var src = imgHelp.Source as FileImageSource; if (src.File == "help".CorrectedImageSource()) { var _ = new SpeechBubble(Langs.Const_Msg_Registration_Step_3_Help_Description, width, FormsConstants.AppySilverGray); if (inStack.Children.Count > 0) { inStack.Children.RemoveAt(0); } inStack.Children.Add(_); imgHelp.Source = "help_close".CorrectedImageSource(); } else { imgHelp.Source = "help".CorrectedImageSource(); inStack.Children.RemoveAt(0); } }) }; imgHelp.GestureRecognizers.Add(imgHelpGesture); var helpContainer = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = 100, HorizontalOptions = LayoutOptions.Start, Children = { midStack, inStack, new StackLayout { HorizontalOptions = LayoutOptions.End, HeightRequest = 64, VerticalOptions = LayoutOptions.Start, Children = { imgHelp } } } }; masterGrid.SizeChanged += (sender, e) => { helpContainer.HeightRequest = App.ScreenSize.Height - 100 - masterGrid.Height; inStack.HeightRequest = (App.ScreenSize.Height - 200 - masterGrid.Height) * .4; }; masterGrid.Children.Add(new EntryCell(Langs.Const_Placeholder_Password, passwordOneEntry, width), 0, 0); masterGrid.Children.Add(new EntryCell(Langs.Const_Label_ReEnter, passwordTwoEntry, width), 0, 1); return(new StackLayout { TranslationX = -6, Padding = new Thickness(0, 12, 0, 0), Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 100, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, Children = { masterGrid, helpContainer } }); }
public static StackLayout AddVehicle(ContentView titleBar, PairNewVehicleViewModel ViewModel) { var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout); lblTitle.Text = Langs.Const_Label_Add_Vehicle; var masterGrid = new Grid { RowSpacing = 12, }; masterGrid.ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = App.ScreenSize.Width * .9 } }; masterGrid.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 } }; var width = App.ScreenSize.Width * .9; var entryWidth = width * .8 - 20; var vehicleRegEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Default, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Next, .6, true); vehicleRegEntry.SetBinding(Entry.TextProperty, new Binding("Registration")); var vehicleMakeEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Default, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Next, .6, true); vehicleMakeEntry.SetBinding(Entry.TextProperty, new Binding("Make")); var vehicleModelEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Default, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Next, .6, true); vehicleModelEntry.SetBinding(Entry.TextProperty, new Binding("Model")); var vehicleNicknameEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Default, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Next, .6, true); vehicleNicknameEntry.SetBinding(Entry.TextProperty, new Binding("Nickname")); var vehicleOdoEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Numeric, "XXXXX", ReturnKeyTypes.Done, .6, true); vehicleOdoEntry.SetBinding(Entry.TextProperty, new Binding("Odometer")); var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Create_Vehicle, width, new Action(() => ViewModel.CanMoveToPairing())); var inStack = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, HeightRequest = 100, Children = { new Label { Text = " " } } }; var imgHelp = new Image { Source = "help".CorrectedImageSource(), HeightRequest = 32 }; var imgHelpGesture = new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(() => { var src = imgHelp.Source as FileImageSource; if (src.File == "help".CorrectedImageSource()) { var _ = new SpeechBubble(Langs.Const_Msg_Pair_Vehicle_Help_Description_2, width, FormsConstants.AppySilverGray); if (inStack.Children.Count > 0) { inStack.Children.RemoveAt(0); } inStack.Children.Add(_); imgHelp.Source = "help_close".CorrectedImageSource(); } else { imgHelp.Source = "help".CorrectedImageSource(); inStack.Children.RemoveAt(0); } }) }; imgHelp.GestureRecognizers.Add(imgHelpGesture); var helpContainer = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = 100, HorizontalOptions = LayoutOptions.Start, Children = { inStack, new StackLayout { HorizontalOptions = LayoutOptions.End, HeightRequest = 64, VerticalOptions = LayoutOptions.Start, Children = { imgHelp } } } }; masterGrid.SizeChanged += (sender, e) => { helpContainer.HeightRequest = App.ScreenSize.Height - 100 - masterGrid.Height; inStack.HeightRequest = (App.ScreenSize.Height - 100 - masterGrid.Height) * .7; }; masterGrid.Children.Add(new EntryCell(Langs.Const_Label_Registration, vehicleRegEntry, width), 0, 0); masterGrid.Children.Add(new EntryCell(Langs.Const_Label_Make, vehicleMakeEntry, width), 0, 1); masterGrid.Children.Add(new EntryCell(Langs.Const_Label_Model, vehicleModelEntry, width), 0, 2); masterGrid.Children.Add(new EntryCell(Langs.Const_Label_Vehicle_Nickname, vehicleNicknameEntry, width), 0, 3); masterGrid.Children.Add(new EntryCell(Langs.Const_Label_Odometer, vehicleOdoEntry, width), 0, 4); masterGrid.Children.Add(arrowButton, 0, 5); var spinner = new ActivityIndicator { BackgroundColor = Color.White, HeightRequest = 40, IsRunning = true }; spinner.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); return(new StackLayout { TranslationX = -6, Padding = new Thickness(0, 12, 0, 0), Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 100, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, Children = { masterGrid, spinner, helpContainer } }); }
void CreateUI() { var masterGrid = new Grid { WidthRequest = App.ScreenSize.Width * .8, VerticalOptions = LayoutOptions.Center, }; masterGrid.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = App.ScreenSize.Height * .3 }, new RowDefinition { Height = App.ScreenSize.Height * .5 }, new RowDefinition { Height = App.ScreenSize.Height * .2 }, }; masterGrid.Children.Add(new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Image { Source = "app_icon1".CorrectedImageSource(), HeightRequest = 72, VerticalOptions = LayoutOptions.Center } } }, 0, 0); var imgRegister = new Image { Source = "register".CorrectedImageSource(), HeightRequest = 52 }; imgRegister.GestureRecognizers.Add(new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(async() => await Navigation.PushAsync(new InitialApprovalPage())) }); masterGrid.Children.Add(new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, HeightRequest = App.ScreenSize.Height * .2, Padding = new Thickness(0, 4), Children = { imgRegister, new Label { Text = Langs.Const_Label_Register, TextColor = Color.White, FontFamily = Helper.RegFont, HorizontalTextAlignment = TextAlignment.Center } } }, 0, 2); var usernameEntry = UniversalEntry.GeneralEntryCell("", App.ScreenSize.Width * .8, Keyboard.Email, Langs.Const_Placeholder_UserName, ReturnKeyTypes.Next, .9); usernameEntry.SetBinding(Entry.TextProperty, new Binding("Username")); var passwordEntry = UniversalEntry.GeneralEntryCell("", App.ScreenSize.Width * .8, Keyboard.Default, Langs.Const_Placeholder_Password, ReturnKeyTypes.Done, .9); passwordEntry.SetBinding(Entry.TextProperty, new Binding("Password")); passwordEntry.SetBinding(Entry.IsPasswordProperty, new Binding("ShowPassword", converter: new ReverseBoolConverter())); var usernameGrid = new ImageEntryCell("icon_user", usernameEntry, App.ScreenSize.Width * .9); var passwordGrid = new ImageEntryCell("icon_password", passwordEntry, App.ScreenSize.Width * .9); var btnSignIn = new Button { BorderRadius = 8, BackgroundColor = FormsConstants.AppyDarkShade, TextColor = Color.White, Text = Langs.Const_Button_SignIn, FontFamily = Helper.RegFont, WidthRequest = App.ScreenSize.Width * .8, HeightRequest = 40, }; btnSignIn.Clicked += delegate { ViewModel.CmdLoginUser.Execute(null); }; btnSignIn.SetBinding(Button.IsEnabledProperty, new Binding("CanLogin")); var swchShowPassword = new Switch(); swchShowPassword.Toggled += (sender, e) => { //passwordEntry.IsPassword = !e.Value; ViewModel.ShowPassword = e.Value; }; swchShowPassword.SetBinding(Switch.IsToggledProperty, new Binding("ShowPassword")); var lblForgottenPassword = new Label { Text = Langs.Const_Label_Forgot_Password, TextColor = Color.Wheat, FontFamily = Helper.RegFont, HorizontalTextAlignment = TextAlignment.End }; var lblForgottenPasswordTap = new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(async() => await Navigation.PushAsync(new ForgottenPassword())) }; lblForgottenPassword.GestureRecognizers.Add(lblForgottenPasswordTap); var spinner = new ActivityIndicator { HeightRequest = 40, WidthRequest = 40, IsRunning = true }; spinner.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); var detailsStack = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(0, 12), WidthRequest = App.ScreenSize.Width * .9, TranslationX = -6, Children = { usernameGrid, passwordGrid, new StackLayout { WidthRequest = App.ScreenSize.Width * .9, HorizontalOptions = LayoutOptions.Center, TranslationX = 6, Children = { btnSignIn } }, spinner, new StackLayout { WidthRequest = App.ScreenSize.Width * .9, HorizontalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, Children = { new StackLayout { Orientation = StackOrientation.Horizontal, WidthRequest = App.ScreenSize.Width * .45, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, Children = { swchShowPassword, new Label { Text = Langs.Const_Label_Show_Password, FontFamily = Helper.BoldFont, TextColor = Color.White } } }, new StackLayout { WidthRequest = App.ScreenSize.Width * .45, HorizontalOptions = LayoutOptions.EndAndExpand, Children = { lblForgottenPassword } } } } } }; masterGrid.Children.Add(detailsStack, 0, 1); Content = new StackLayout { WidthRequest = App.ScreenSize.Width, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, Children = { masterGrid } }; }
void CreateUI() { stack = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 48, VerticalOptions = LayoutOptions.StartAndExpand }; innerStack = new StackLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, Orientation = StackOrientation.Horizontal, MinimumWidthRequest = App.ScreenSize.Width, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 48, }; var topbar = new TopBar(true, "", this, 1, "back_arrow", "", innerStack, true).CreateTopBar(); stack.HeightRequest = App.ScreenSize.Height - topbar.HeightRequest; var titleBar = new Label { WidthRequest = App.ScreenSize.Width, HeightRequest = 48, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, BackgroundColor = FormsConstants.AppyLightBlue, TextColor = Color.White, Text = Langs.Const_Label_Fleet_Code }; var spinner = new ActivityIndicator { HeightRequest = 40, WidthRequest = 40, IsRunning = true }; spinner.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); var enterFleet = UniversalEntry.GeneralEntryCell("", App.ScreenSize.Width * .8, Keyboard.Default, Langs.Const_Label_Enter_Fleet_Code, ReturnKeyTypes.Done); enterFleet.SetBinding(Entry.TextProperty, new Binding("NewFleetCode")); var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Confirm_3, App.ScreenSize.Width * .8, new Action(() => ViewModel.BtnFleetCode.Execute(null))); arrowButton.SetBinding(Button.IsEnabledProperty, new Binding("CanSubmit")); var width = App.ScreenSize.Width * .9; var grid = new Grid { WidthRequest = width, HeightRequest = 52, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = width }, }, RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = 40 } } }; grid.Children.Add(new EntryCell(Langs.Const_Label_Fleet_Code, enterFleet, width), 0, 0); var dataStack = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HorizontalOptions = LayoutOptions.Center, Padding = new Thickness(0, 12), Children = { grid, arrowButton, spinner } }; stack.Children.Add(dataStack); innerStack.Children.Add(stack); var masterStack = new StackLayout { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start, Children = { new StackLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, WidthRequest = App.ScreenSize.Width, Children = { topbar } }, new StackLayout { TranslationY = -6, Children = { titleBar } }, innerStack } }; Content = masterStack; }
public static StackLayout GenerateFleetDetails(ContentView titleBar, SignUpViewModel ViewModel) { var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout); lblTitle.Text = Langs.Const_Screen_Title_Registration_4; var entryFleetCode = UniversalEntry.GeneralEntryCell(string.Empty, App.ScreenSize.Width * .9, Keyboard.Default, Langs.Const_Placeholder_Fleet_Code, ReturnKeyTypes.Done, .6, true); entryFleetCode.SetBinding(Entry.TextProperty, new Binding("FleetCode")); entryFleetCode.SetBinding(Entry.IsEnabledProperty, new Binding("HasFleetCode")); var swtchHasFleetCode = new Switch(); swtchHasFleetCode.SetBinding(Switch.IsToggledProperty, new Binding("HasFleetCode")); var width = App.ScreenSize.Width * .9; var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Registration_4_Next, width, new Action(() => ViewModel.CmdRegisterUser.Execute(null))); var topStack = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HorizontalOptions = LayoutOptions.Center, Padding = new Thickness(0, 12), Children = { new StackLayout { WidthRequest = App.ScreenSize.Width * .8, Padding = new Thickness(8, 0), Children = { new Label { Text = Langs.Const_Label_Fleet_Code_Question, TextColor = Color.White, FontFamily = Helper.RegFont, HorizontalTextAlignment = TextAlignment.Center } } }, new BoxView { HeightRequest = 1, WidthRequest = App.ScreenSize.Width, BackgroundColor = Color.White }, new StackLayout { WidthRequest = App.ScreenSize.Width * .8, Children = { new Label { Text = Langs.Const_Label_Skip_Fleet_Code, TextColor = Color.White, FontFamily = Helper.RegFont, HorizontalTextAlignment = TextAlignment.Center }, entryFleetCode } }, new BoxView { HeightRequest = 1, WidthRequest = App.ScreenSize.Width, BackgroundColor = Color.White }, new StackLayout { WidthRequest = App.ScreenSize.Width * .8, Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, Children = { swtchHasFleetCode, new Label { Text = Langs.Const_Label_Disable_Fleet_Code, TextColor = Color.White, FontFamily = Helper.RegFont } } }, new BoxView { HeightRequest = 1, WidthRequest = App.ScreenSize.Width, BackgroundColor = Color.White }, arrowButton } }; var inStack = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, HeightRequest = 100, Children = { new Label { Text = " " } } }; var imgHelp = new Image { Source = "help".CorrectedImageSource(), HeightRequest = 32 }; var imgHelpGesture = new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(() => { var src = imgHelp.Source as FileImageSource; if (src.File == "help".CorrectedImageSource()) { var _ = new SpeechBubble(Langs.Const_Msg_Registration_Step_4_Help_Description, width, FormsConstants.AppySilverGray); if (inStack.Children.Count > 0) { inStack.Children.RemoveAt(0); } inStack.Children.Add(_); imgHelp.Source = "help_close".CorrectedImageSource(); } else { imgHelp.Source = "help".CorrectedImageSource(); inStack.Children.RemoveAt(0); } }) }; imgHelp.GestureRecognizers.Add(imgHelpGesture); var helpContainer = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = 100, HorizontalOptions = LayoutOptions.Start, Children = { inStack, new StackLayout { HorizontalOptions = LayoutOptions.End, HeightRequest = 64, VerticalOptions = LayoutOptions.Start, Children = { imgHelp } } } }; var spinner = new ActivityIndicator { BackgroundColor = Color.Transparent, HeightRequest = 40, IsRunning = true }; spinner.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); return(new StackLayout { TranslationX = -6, Padding = new Thickness(0, 12, 0, 0), Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 100, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, Children = { topStack, spinner, helpContainer } }); }
void CreateUI() { var masterGrid = new Grid { WidthRequest = App.ScreenSize.Width * .8, VerticalOptions = LayoutOptions.Center, }; masterGrid.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = App.ScreenSize.Height * .3 }, new RowDefinition { Height = App.ScreenSize.Height * .5 }, new RowDefinition { Height = App.ScreenSize.Height * .2 }, }; masterGrid.Children.Add(new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { new Image { Source = "app_icon1".CorrectedImageSource(), HeightRequest = 72, VerticalOptions = LayoutOptions.Center } } }, 0, 0); var usernameEntry = UniversalEntry.GeneralEntryCell("", App.ScreenSize.Width * .8, Keyboard.Email, Langs.Const_Label_Email_2, ReturnKeyTypes.Next, .9); usernameEntry.SetBinding(Entry.TextProperty, new Binding("Username")); var passwordEntry = UniversalEntry.GeneralEntryCell("", App.ScreenSize.Width * .8, Keyboard.Numeric, Langs.Const_Placeholder_DOB, ReturnKeyTypes.Done, .9); passwordEntry.SetBinding(Entry.TextProperty, new Binding("YOB")); var usernameGrid = new ImageEntryCell("icon_user", usernameEntry, App.ScreenSize.Width * .9); var passwordGrid = new ImageEntryCell("icon_password", passwordEntry, App.ScreenSize.Width * .9); var btnSubmit = new Button { BorderRadius = 6, BackgroundColor = FormsConstants.AppyBlue, TextColor = Color.White, WidthRequest = App.ScreenSize.Width * .9, Text = Langs.Const_Label_Forgot_Password }; btnSubmit.SetBinding(Button.IsEnabledProperty, new Binding("CanSubmit")); btnSubmit.Clicked += delegate { ViewModel.ResetPasswordCommand.Execute(null); }; var detailsStack = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(0, 12), WidthRequest = App.ScreenSize.Width * .9, TranslationX = -6, Children = { new StackLayout { Padding = new Thickness(0, 12), WidthRequest = App.ScreenSize.Width * .8, HorizontalOptions = LayoutOptions.Center, Children = { new Label { Text = Langs.Const_Msg_Forgot_Password_Desc, TextColor = Color.White, FontFamily = Helper.RegFont, FontSize = 14, HorizontalTextAlignment = TextAlignment.Center } } }, usernameGrid, passwordGrid, new StackLayout { HorizontalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, TranslationX = 0, Children = { btnSubmit } } } }; masterGrid.Children.Add(detailsStack, 0, 1); Content = new StackLayout { WidthRequest = App.ScreenSize.Width, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, Children = { masterGrid } }; }
void CreateUI() { stack = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 48, VerticalOptions = LayoutOptions.StartAndExpand }; innerStack = new StackLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, Orientation = StackOrientation.Horizontal, MinimumWidthRequest = App.ScreenSize.Width, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 48, }; var topbar = new TopBar(true, "", this, 1, "back_arrow", "", innerStack, true).CreateTopBar(); stack.HeightRequest = App.ScreenSize.Height - topbar.HeightRequest; var titleBar = new Label { WidthRequest = App.ScreenSize.Width, HeightRequest = 48, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, BackgroundColor = FormsConstants.AppyLightBlue, TextColor = Color.White, Text = Langs.Const_Button_Add_Odometer_Reading }; var height = App.ScreenSize.Height - (48 * 2); var grid = new Grid { WidthRequest = App.ScreenSize.Width * .9, RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = height * .4 }, new RowDefinition { Height = 1 }, new RowDefinition { Height = GridLength.Star }, } }; var addGrid = new Grid { WidthRequest = App.ScreenSize.Width * .8, HeightRequest = 48, BackgroundColor = FormsConstants.AppyDarkBlue, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = (App.ScreenSize.Width * .8) * .4 }, new ColumnDefinition { Width = 1 }, new ColumnDefinition { Width = GridLength.Star } } }; var enterOdo = UniversalEntry.GeneralEntryCell("", App.ScreenSize.Width * .8, Keyboard.Numeric, "XXXXX", ReturnKeyTypes.Done); enterOdo.SetBinding(Entry.TextProperty, new Binding("Reading")); addGrid.Children.Add(new Label { VerticalTextAlignment = TextAlignment.Center, FontSize = 16, TextColor = Color.White, FontFamily = Helper.RegFont, Text = Langs.Const_Label_Odometer }, 0, 0); addGrid.Children.Add(new BoxView { WidthRequest = 1, HeightRequest = 40, VerticalOptions = LayoutOptions.Center, BackgroundColor = Color.White }, 1, 0); addGrid.Children.Add(enterOdo, 2, 0); odoListView = new ListView { SeparatorVisibility = SeparatorVisibility.None, ItemsSource = ViewModel.Readings, ItemTemplate = new DataTemplate(typeof(OdoViewCell)), HasUnevenRows = true }; var datePicker = new DatePicker(); datePicker.SetBinding(DatePicker.DateProperty, new Binding("DateAdded")); datePicker.SetBinding(DatePicker.IsVisibleProperty, new Binding("ShowDate")); datePicker.DateSelected += (s, e) => { ViewModel.DateAdded = e.NewDate; }; var timePicker = new TimePicker(); timePicker.SetBinding(TimePicker.TimeProperty, new Binding("TimeAdded")); timePicker.SetBinding(TimePicker.IsVisibleProperty, new Binding("ShowTime")); var btnDate = new Button { WidthRequest = (App.ScreenSize.Width * .8) * .5, BackgroundColor = FormsConstants.AppyDarkShade, BorderRadius = 6, Text = Langs.Const_Label_Date, TextColor = Color.White }; btnDate.Clicked += delegate { datePicker.Focus(); }; var btnTime = new Button { WidthRequest = (App.ScreenSize.Width * .8) * .5, BackgroundColor = FormsConstants.AppyDarkShade, BorderRadius = 6, Text = Langs.Const_Button_Set_Time, TextColor = Color.White }; btnTime.Clicked += delegate { timePicker.Focus(); }; var btnConfirm = new Button { WidthRequest = App.ScreenSize.Width * .8, BorderRadius = 8, TextColor = Color.White, Text = Langs.Const_Button_Add_Odometer_Reading }; btnConfirm.Clicked += delegate { ViewModel.BtnAddOdometer.Execute(null); }; grid.Children.Add( new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Padding = new Thickness(0, 8), Children = { addGrid, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { btnDate, btnTime } }, btnConfirm } }, 0, 0); grid.Children.Add(new BoxView { HeightRequest = 1, WidthRequest = App.ScreenSize.Width, BackgroundColor = Color.White }, 0, 1); grid.Children.Add(odoListView, 0, 2); stack.Children.Add(grid); stack.Children.Add(odoListView); innerStack.Children.Add(stack); var masterStack = new StackLayout { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start, Children = { new StackLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, WidthRequest = App.ScreenSize.Width, Children = { topbar } }, new StackLayout { TranslationY = -6, Children = { titleBar } }, innerStack } }; Content = masterStack; }
void CreateUI() { stack = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 48, VerticalOptions = LayoutOptions.StartAndExpand }; innerStack = new StackLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, Orientation = StackOrientation.Horizontal, MinimumWidthRequest = App.ScreenSize.Width, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 48, }; var topbar = new TopBar(true, "", this, 1, "back_arrow", "", innerStack, true).CreateTopBar(); stack.HeightRequest = App.ScreenSize.Height - topbar.HeightRequest; var titleBar = new Label { WidthRequest = App.ScreenSize.Width, HeightRequest = 48, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, BackgroundColor = FormsConstants.AppyLightBlue, TextColor = Color.White, Text = Langs.Const_Label_Change_Password }; var height = App.ScreenSize.Height - (48 * 2); var grid = new Grid { WidthRequest = App.ScreenSize.Width * .9, RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = height * .25 }, new RowDefinition { Height = 1 }, new RowDefinition { Height = GridLength.Star }, new RowDefinition { Height = 1 }, new RowDefinition { Height = height * .25 } } }; var spinner = new ActivityIndicator { HeightRequest = 40, WidthRequest = 40, IsRunning = true }; spinner.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); var enterCurrentPassword = UniversalEntry.GeneralEntryCell("", App.ScreenSize.Width * .8, Keyboard.Default, Langs.Const_Placeholder_Company_Name, ReturnKeyTypes.Done); enterCurrentPassword.SetBinding(Entry.TextProperty, new Binding("CurrentPassword")); enterCurrentPassword.SetBinding(Entry.IsPasswordProperty, new Binding("HidePassword", converter: new ReverseBoolConverter())); var enterNewPassword = UniversalEntry.GeneralEntryCell("", App.ScreenSize.Width * .8, Keyboard.Default, Langs.Const_Placeholder_New_Password, ReturnKeyTypes.Done); enterNewPassword.SetBinding(Entry.TextProperty, new Binding("NewPasswordOne")); enterNewPassword.SetBinding(Entry.IsEnabledProperty, new Binding("PasswordEnabled")); enterNewPassword.SetBinding(Entry.IsPasswordProperty, new Binding("HidePassword", converter: new ReverseBoolConverter())); var enterNewPassword2 = UniversalEntry.GeneralEntryCell("", App.ScreenSize.Width * .8, Keyboard.Default, Langs.Const_Placeholder_ReType_Password, ReturnKeyTypes.Done); enterNewPassword2.SetBinding(Entry.TextProperty, new Binding("NewPasswordTwo")); enterNewPassword2.SetBinding(Entry.IsEnabledProperty, new Binding("PasswordEnabled")); enterNewPassword2.SetBinding(Entry.IsPasswordProperty, new Binding("HidePassword", converter: new ReverseBoolConverter())); var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Confirm_1, App.ScreenSize.Width * .8, new Action(() => ViewModel.BtnChangePassword.Execute(null))); arrowButton.SetBinding(Button.IsEnabledProperty, new Binding("EnableButton")); var swtchPassword = new Switch(); swtchPassword.SetBinding(Switch.IsToggledProperty, new Binding("HidePassword")); swtchPassword.Toggled += (s, e) => ViewModel.HidePassword = e.Value; var imgRegister = new Image { Source = "cancel".CorrectedImageSource(), HeightRequest = 52 }; imgRegister.GestureRecognizers.Add(new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(async() => await Navigation.PopAsync()) }); var width = App.ScreenSize.Width * .9; var oldPWGrid = new Grid { InputTransparent = true, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = App.ScreenSize.Width * .9 } }, RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = 40 }, } }; var newPWGrid = new Grid { RowSpacing = 12, InputTransparent = true, ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = App.ScreenSize.Width * .9 } }, RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 } } }; oldPWGrid.Children.Add(new EntryCell(Langs.Const_Label_Current_Password, enterCurrentPassword, width), 0, 0); newPWGrid.Children.Add(new EntryCell(Langs.Const_Label_New_Password, enterNewPassword, App.ScreenSize.Width * .9), 0, 0); newPWGrid.Children.Add(new EntryCell(Langs.Const_Label_ReEnter, enterNewPassword2, App.ScreenSize.Width * .9), 0, 1); var midStack = new StackLayout { Orientation = StackOrientation.Vertical, Padding = new Thickness(0, 8), Children = { newPWGrid, arrowButton, new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Center, Children = { swtchPassword, new Label { Text = Langs.Const_Label_Hide_Password,FontFamily = Helper.RegFont, FontSize = 14, TextColor = Color.White } } } } }; grid.Children.Add(oldPWGrid, 0, 0); grid.Children.Add(new BoxView { HeightRequest = 1, WidthRequest = App.ScreenSize.Width, BackgroundColor = Color.White }, 0, 1); grid.Children.Add(midStack, 0, 2); grid.Children.Add(new BoxView { HeightRequest = 1, WidthRequest = App.ScreenSize.Width, BackgroundColor = Color.White }, 0, 3); grid.Children.Add(new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, HeightRequest = App.ScreenSize.Height * .2, Padding = new Thickness(0, 4), Children = { imgRegister, new Label { Text = Langs.Const_Label_Cancel, TextColor = Color.White, FontFamily = Helper.RegFont, HorizontalTextAlignment = TextAlignment.Center } } }, 0, 4); stack.Children.Add(grid); innerStack.Children.Add(stack); var masterStack = new StackLayout { HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Start, Children = { new StackLayout { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start, WidthRequest = App.ScreenSize.Width, Children = { topbar } }, new StackLayout { TranslationY = -6, Children = { titleBar } }, innerStack } }; Content = masterStack; }
public static StackLayout GeneratePersonalDetails(ContentView titleBar, SignUpViewModel ViewModel) { var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout); lblTitle.Text = Langs.Const_Screen_Title_Registration_1; var masterGrid = new Grid { RowSpacing = 12, InputTransparent = true }; masterGrid.ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = App.ScreenSize.Width * .9 } }; masterGrid.RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, new RowDefinition { Height = 40 }, }; var width = App.ScreenSize.Width * .9; var entryWidth = width * .8 - 20; var firstNameEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Default, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Next, .6, true); firstNameEntry.SetBinding(Entry.TextProperty, new Binding("FirstName")); var lastNameEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Default, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Next, .6, true); lastNameEntry.SetBinding(Entry.TextProperty, new Binding("LastName")); var yearOfBirthEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Numeric, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Next, .6, true); yearOfBirthEntry.SetBinding(Entry.TextProperty, new Binding("YOB")); var mobileEntry = UniversalEntry.GeneralEntryCell(string.Empty, width, Keyboard.Telephone, Langs.Const_Placeholder_Enter, ReturnKeyTypes.Done, .6, true); mobileEntry.SetBinding(Entry.TextProperty, new Binding("MobNumber")); var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Registration_1_Next, width, new Action(() => ViewModel.CanMoveToTwo())); /*var arrowGestureRecogniser = new TapGestureRecognizer * { * NumberOfTapsRequired = 1, * Command = new Command(() => ViewModel.CanMoveToTwo()) * }; * arrowButton.GestureRecognizers.Add(arrowGestureRecogniser);*/ var inStack = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, HeightRequest = 100, Children = { new Label { Text = " " } } }; var imgHelp = new Image { Source = "help".CorrectedImageSource(), HeightRequest = 32 }; var imgHelpGesture = new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(() => { var src = imgHelp.Source as FileImageSource; if (src.File == "help".CorrectedImageSource()) { var _ = new SpeechBubble(Langs.Const_Msg_Registration_Step_1_Help_Description, width, FormsConstants.AppySilverGray); if (inStack.Children.Count > 0) { inStack.Children.RemoveAt(0); } inStack.Children.Add(_); imgHelp.Source = "help_close".CorrectedImageSource(); } else { imgHelp.Source = "help".CorrectedImageSource(); inStack.Children.RemoveAt(0); } }) }; imgHelp.GestureRecognizers.Add(imgHelpGesture); var helpContainer = new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = 100, HorizontalOptions = LayoutOptions.Start, Children = { inStack, new StackLayout { HorizontalOptions = LayoutOptions.End, HeightRequest = 64, VerticalOptions = LayoutOptions.Start, Children = { imgHelp } } } }; masterGrid.SizeChanged += (sender, e) => { helpContainer.HeightRequest = App.ScreenSize.Height - 100 - masterGrid.Height; inStack.HeightRequest = (App.ScreenSize.Height - 100 - masterGrid.Height) * .7; }; masterGrid.Children.Add(new EntryCell(Langs.Const_Label_First_Name, firstNameEntry, width), 0, 0); masterGrid.Children.Add(new EntryCell(Langs.Const_Label_Last_Name, lastNameEntry, width), 0, 1); masterGrid.Children.Add(new EntryCell(Langs.Const_Placeholder_DOB, yearOfBirthEntry, width), 0, 2); masterGrid.Children.Add(new EntryCell(Langs.Const_Label_Mobile_Number, mobileEntry, width), 0, 3); masterGrid.Children.Add(arrowButton, 0, 4); return(new StackLayout { TranslationX = -6, Padding = new Thickness(0, 12, 0, 0), Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 100, HorizontalOptions = LayoutOptions.Center, InputTransparent = true, VerticalOptions = LayoutOptions.Start, Children = { masterGrid, helpContainer } }); }