public static StackLayout PairingComplete(ContentView titleBar, PairNewVehicleViewModel ViewModel)
        {
            var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout);

            lblTitle.Text = Langs.Const_Screen_Title_Pairing_Completed;

            var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Manage_Vehicle_Step_5, App.ScreenSize.Width * .9,
                                                   new Action(() => ViewModel.MoveToLogin = true));

            return(new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                WidthRequest = App.ScreenSize.Width,
                Children =
                {
                    new StackLayout
                    {
                        Padding = new Thickness(0, 12),
                        HorizontalOptions = LayoutOptions.Center,
                        Children =
                        {
                            new Image
                            {
                                Source = "accept_icon".CorrectedImageSource(),
                                HeightRequest = 64
                            },
                            new BoxView {
                                WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                            },
                            new StackLayout
                            {
                                WidthRequest = App.ScreenSize.Width * .8,
                                Padding = new Thickness(0, 8),
                                Children =
                                {
                                    new Label
                                    {
                                        Text = Langs.Const_Label_Pairing_Completed,
                                        TextColor = Color.White,
                                        FontFamily = Helper.BoldFont,
                                        HorizontalTextAlignment = TextAlignment.Center
                                    },
                                }
                            },
                            new StackLayout
                            {
                                Padding = new Thickness(0, 12),
                                Children ={ arrowButton    }
                            }
                        }
                    }
                }
            });
        }
        public static StackLayout PairToDevice(ContentView titleBar, PairNewVehicleViewModel ViewModel)
        {
            var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout);

            lblTitle.Text = Langs.Const_Label_Pairing;

            var activitySpinner = new ActivityIndicator
            {
                BackgroundColor = Color.White,
                IsRunning       = true
            };

            activitySpinner.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            var stackSpinning = new StackLayout
            {
                WidthRequest      = App.ScreenSize.Width * .6,
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    activitySpinner,
                    new Label
                    {
                        Text = Langs.Const_Label_Pairing,
                        HorizontalTextAlignment = TextAlignment.Center,
                        TextColor  = Color.White,
                        FontFamily = Helper.BoldFont
                    }
                }
            };


            return(new StackLayout
            {
                WidthRequest = App.ScreenSize.Width,
                HeightRequest = App.ScreenSize.Height - 102,
                TranslationX = -6,
                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Children = { stackSpinning }
            });
        }
        public static StackLayout VehicleSummary(ContentView titleBar, PairNewVehicleViewModel ViewModel)
        {
            var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout);

            lblTitle.Text = Langs.Const_Screen_Title_Pairing_Summary;

            var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Manage_Vehicle_Step_4, App.ScreenSize.Width * .9, new Action(() => ViewModel.MoveToComplete = true));

            return(new StackLayout
            {
                WidthRequest = App.ScreenSize.Width,
                HorizontalOptions = LayoutOptions.Center,
                Children =
                {
                    new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.Center,
                        Padding = new Thickness(0, 12),
                        Children =
                        {
                            new Label
                            {
                                FormattedText = FormattedProgress.GenerateProgress(true, true, true),
                                TextColor = Color.White,
                                FontFamily = Helper.BoldFont
                            }
                        }
                    },
                    new BoxView {
                        WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                    },
                    new StackLayout
                    {
                        Padding = new Thickness(16, 8, 0, 16),
                        WidthRequest = App.ScreenSize.Width * .8,
                        Children =
                        {
                            new Label
                            {
                                Text = Langs.Const_Label_Review_Info,
                                FontFamily = Helper.BoldFont,
                                TextColor = Color.White
                            }
                        }
                    },
                    new StackLayout
                    {
                        WidthRequest = App.ScreenSize.Width * .8,
                        Padding = new Thickness(16, 12),
                        Children =
                        {
                            new Label
                            {
                                Text = $"{ViewModel.Nickname}",
                                TextColor = Color.White,
                                FontFamily = Helper.BoldFont
                            },
                            new Label
                            {
                                Text = ViewModel.Registration,
                                FontFamily = Helper.RegFont,
                                TextColor = Color.White
                            },
                            new Label
                            {
                                Text = $"{ViewModel.Make} {ViewModel.Model}",
                                TextColor = Color.White,
                                FontFamily = Helper.RegFont
                            },
                        }
                    },
                    new StackLayout
                    {
                        Padding = new Thickness(0, 16, 0, 8),
                        WidthRequest = App.ScreenSize.Width * .8,
                        IsVisible = ViewModel.Paired,
                        Children =
                        {
                            new Label
                            {
                                Text = Langs.Const_Label_Bluetooth_Registered,
                                TextColor = Color.White,
                                FontFamily = Helper.BoldFont
                            }
                        }
                    },
                    new BoxView {
                        WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                    },
                    new StackLayout
                    {
                        Padding = new Thickness(0, 12),
                        WidthRequest = App.ScreenSize.Width * .8,
                        Children =
                        {
                            new Label
                            {
                                Text = Langs.Const_Label_Confirm_Pairing,
                                TextColor = Color.White,
                                FontFamily = Helper.RegFont
                            }
                        }
                    },
                    arrowButton
                }
            });
        }
        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 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 }
            });
        }
        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 }
            });
        }
Example #7
0
        public static StackLayout FindBluetooth(ContentView titleBar, PairNewVehicleViewModel ViewModel)
        {
            Vm = ViewModel;
            RegisterEvents();

            ViewModel.GetBluetoothDeviceList();

            var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout);

            lblTitle.Text = Langs.Const_Screen_Title_Select_Bluetooth;

            lstDevices = new ListView
            {
                ItemsSource            = ViewModel.BluetoothDeviceList,
                ItemTemplate           = new DataTemplate(typeof(BluetoothViewCell)),
                IsPullToRefreshEnabled = true,
                SeparatorVisibility    = SeparatorVisibility.None
            };
            lstDevices.ItemSelected += (sender, e) =>
            {
                var obj = e.SelectedItem as BluetoothDevice;
                ViewModel.SelectedBluetoothDevice = obj.Id;
                ViewModel.PopulateBasedOnId();
            };
            lstDevices.Refreshing += (sender, e) =>
            {
                ViewModel.GetBluetoothDeviceList();
            };

            var grid = new Grid
            {
                WidthRequest = App.ScreenSize.Width * .9
            };

            grid.RowDefinitions = new RowDefinitionCollection
            {
                new RowDefinition {
                    Height = 80
                },
                new RowDefinition {
                    Height = App.ScreenSize.Height * .6
                },
                new RowDefinition {
                    Height = GridLength.Auto
                },
                new RowDefinition {
                    Height = 200
                }
            };

            var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Manage_Vehicle_Step_3, App.ScreenSize.Width * .8,
                                                   new Action(() => { if (ViewModel.SelectedVehicle.BluetoothId == ViewModel.SelectedBluetoothDevice.ToString())
                                                                      {
                                                                          ViewModel.MoveToSummary = true;
                                                                      }
                                                              }));

            arrowButton.SetBinding(Button.IsEnabledProperty, new Binding("Paired"));

            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_3, App.ScreenSize.Width * .8,
                                                 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 }
                    }
                }
            };

            grid.Children.Add(new StackLayout
            {
                WidthRequest      = App.ScreenSize.Width,
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    new StackLayout
                    {
                        Padding           = new Thickness(0, 12),
                        HorizontalOptions = LayoutOptions.Center,
                        Children          =
                        {
                            new StackLayout
                            {
                                WidthRequest      = App.ScreenSize.Width * .9,
                                HorizontalOptions = LayoutOptions.Center,
                                Children          =
                                {
                                    new Label
                                    {
                                        FormattedText           = FormattedProgress.GenerateProgress(true, true, false),
                                        FontFamily              = Helper.BoldFont,
                                        TextColor               = Color.White,
                                        HorizontalTextAlignment = TextAlignment.Center
                                    },
                                }
                            },
                            new BoxView {
                                WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                            },
                            new StackLayout
                            {
                                WidthRequest      = App.ScreenSize.Width * .9,
                                HorizontalOptions = LayoutOptions.Center,
                                Children          =
                                {
                                    new Label
                                    {
                                        Text              = Langs.Const_Button_Pair_Vehicle,
                                        FontFamily        = Helper.RegFont,
                                        TextColor         = Color.White,
                                        HorizontalOptions = LayoutOptions.Center
                                    },
                                }
                            },
                        }
                    },
                }
            }, 0, 0);

            grid.Children.Add(lstDevices, 0, 1);
            grid.Children.Add(arrowButton, 0, 2);
            grid.Children.Add(helpContainer, 0, 3);

            return(new StackLayout
            {
                WidthRequest = App.ScreenSize.Width,
                HorizontalOptions = LayoutOptions.Center,
                TranslationX = -6,
                Padding = new Thickness(4),
                Children = { grid }
            });
        }
Example #8
0
        public static StackLayout SearchSelectAddVehicle(ContentView titleBar, PairNewVehicleViewModel ViewModel)
        {
            Vm = ViewModel;

            RegisterEvents();

            if (ViewModel.VehicleModels == null)
            {
                ViewModel.MoveToAdd = true;
            }
            else
            if (ViewModel.VehicleModels?.Count == 0)
            {
                ViewModel.GetVehiclesFromDb();
                if (ViewModel.VehicleModels.Count == 0)
                {
                    ViewModel.MoveToAdd = true;
                }
            }

            var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout);

            lblTitle.Text = Langs.Const_Screen_Title_Select_Vehicle;

            var srchVehicle = new SearchBar
            {
                WidthRequest = App.ScreenSize.Width * .9,
            };

            srchVehicle.SetBinding(SearchBar.TextProperty, new Binding("VehicleSearch"));

            var lblNoneFound = new Label
            {
                Text       = Langs.Const_Label_No_Search_Result,
                TextColor  = Color.White,
                FontFamily = Helper.BoldFont,
                IsVisible  = false
            };

            srchVehicle.SearchButtonPressed += (sender, e) =>
            {
                var _ = ViewModel.SearchBasedOnVehicle();
                if (!_)
                {
                    lblNoneFound.IsVisible = true;
                }
            };

            var grid = new Grid
            {
                WidthRequest = App.ScreenSize.Width
            };

            grid.ColumnDefinitions = new ColumnDefinitionCollection
            {
                new ColumnDefinition {
                    Width = App.ScreenSize.Width
                }
            };
            grid.RowDefinitions = new RowDefinitionCollection
            {
                new RowDefinition {
                    Height = GridLength.Auto
                },
                new RowDefinition {
                    Height = App.ScreenSize.Height * .5
                },
                new RowDefinition {
                    Height = GridLength.Auto
                }
            };

            var activitySpinner = new ActivityIndicator
            {
                BackgroundColor = Color.Transparent,
                WidthRequest    = 40,
                IsRunning       = true
            };

            activitySpinner.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy"));

            listView = new ListView(ListViewCachingStrategy.RecycleElement)
            {
                IsPullToRefreshEnabled = true,
                ItemsSource            = ViewModel.VehicleModels,
                ItemTemplate           = new DataTemplate(typeof(RegisteredVehicleViewCell)),
                SeparatorVisibility    = SeparatorVisibility.None,
                HasUnevenRows          = true
            };
            listView.ItemSelected += (sender, e) =>
            {
                var obj = e.SelectedItem as VehicleModel;
                ViewModel.SelectedVehicle = obj;
            };
            listView.Refreshing += (sender, e) =>
            {
                listView.IsRefreshing = true;
                ViewModel.CmdGetRegisteredVehicles.Execute(null);
                listView.IsRefreshing = false;
            };

            var dummyCell = new StackLayout
            {
                Padding         = new Thickness(12),
                BackgroundColor = FormsConstants.AppyDarkShade,
                VerticalOptions = LayoutOptions.Center,
                Orientation     = StackOrientation.Horizontal,
                Children        =
                {
                    new Image
                    {
                        Source        = "add_new".CorrectedImageSource(),
                        HeightRequest = 48
                    },
                    new Label
                    {
                        Text                  = Langs.Const_Label_Add_Vehicle,
                        FontFamily            = Helper.RegFont,
                        TextColor             = Color.White,
                        HeightRequest         = 48,
                        VerticalTextAlignment = TextAlignment.Center
                    }
                }
            };
            var dummyListCellRecogniser = new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                Command = new Command(() => ViewModel.MoveToAdd = !ViewModel.MoveToAdd)
            };

            dummyCell.GestureRecognizers.Add(dummyListCellRecogniser);
            var dummyListCell = new StackLayout
            {
                HeightRequest    = 60,
                InputTransparent = true,
                Padding          = new Thickness(8),
                Children         =
                {
                    dummyCell
                }
            };


            var listStack = new StackLayout
            {
                WidthRequest = App.ScreenSize.Width * .9,
                Padding      = new Thickness(4),
                Children     = { lblNoneFound, activitySpinner, listView, dummyListCell }
            };

            grid.Children.Add(new StackLayout
            {
                WidthRequest      = App.ScreenSize.Width,
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    new StackLayout
                    {
                        WidthRequest      = App.ScreenSize.Width * .9,
                        HorizontalOptions = LayoutOptions.Center,
                        Children          =
                        {
                            new Label {
                                FormattedText = FormattedProgress.GenerateProgress(true, false, false), HorizontalTextAlignment = TextAlignment.Center
                            },
                            srchVehicle
                        }
                    },
                    new BoxView       {
                        WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                    },
                }
            }, 0, 0);

            var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Manage_Vehicle_Step_1, App.ScreenSize.Width * .9,
                                                   new Action(() => { if (ViewModel.RegisteredVehicles?.Vehicles.Count != 0)
                                                                      {
                                                                          ViewModel.MoveToPair = true;
                                                                      }
                                                              }));

            grid.Children.Add(new StackLayout
            {
                WidthRequest      = App.ScreenSize.Width,
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    new StackLayout
                    {
                        WidthRequest      = App.ScreenSize.Width * .9,
                        HorizontalOptions = LayoutOptions.Center,
                        Children          = { listStack             }
                    },
                    new BoxView {
                        WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                    },
                    arrowButton
                }
            }, 0, 1);



            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_1, App.ScreenSize.Width * .8, 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,

                HorizontalOptions = LayoutOptions.Start,
                Children          =
                {
                    inStack,
                    new StackLayout
                    {
                        HorizontalOptions = LayoutOptions.End,
                        HeightRequest     = 64,
                        VerticalOptions   = LayoutOptions.Start,
                        Children          = { imgHelp }
                    }
                }
            };

            grid.Children.Add(helpContainer, 0, 2);

            return(new StackLayout
            {
                WidthRequest = App.ScreenSize.Width,
                TranslationX = -6,
                HorizontalOptions = LayoutOptions.Center,
                HeightRequest = App.ScreenSize.Height - 100,
                Children = { grid }
            });
        }
Example #9
0
        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 }
            });
        }
        public static StackLayout SignupDetailsCompleted(ContentView titleBar, SignUpViewModel ViewModel)
        {
            var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout);

            lblTitle.Text = Langs.Const_Screen_Title_Registration_Completed;

            var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Pair_Vehicle, App.ScreenSize.Width * .9, new Action(() => ViewModel.MoveToPairing = true));

            return(new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                WidthRequest = App.ScreenSize.Width,
                Children =
                {
                    new StackLayout
                    {
                        Padding = new Thickness(0, 12),
                        HorizontalOptions = LayoutOptions.Center,
                        WidthRequest = App.ScreenSize.Width * .9,
                        Children =
                        {
                            new StackLayout
                            {
                                HeightRequest = App.ScreenSize.Height * .3,
                                HorizontalOptions = LayoutOptions.Center,
                                VerticalOptions = LayoutOptions.Center,
                                Children =
                                {
                                    new Image
                                    {
                                        Source = "accept_icon".CorrectedImageSource(),
                                        HeightRequest = 64
                                    },
                                }
                            },
                            new BoxView {
                                WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                            },
                            new StackLayout
                            {
                                WidthRequest = App.ScreenSize.Width * .8,
                                Padding = new Thickness(0, 8),
                                Children =
                                {
                                    new Label
                                    {
                                        Text = Langs.Const_Msg_Registration_Completed_Description,
                                        TextColor = Color.White,
                                        FontFamily = Helper.RegFont,
                                        HorizontalTextAlignment = TextAlignment.Center
                                    },
                                    new Label
                                    {
                                        Text = Langs.Const_Msg_Registration_Completed_Pair_Vehicle,
                                        TextColor = Color.White,
                                        FontFamily = Helper.BoldFont,
                                        HorizontalTextAlignment = TextAlignment.Center
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Padding = new Thickness(0, 12),
                        TranslationX = -6,
                        Children =      { arrowButton}
                    }
                }
            });
        }
        public static StackLayout IntroManage(ContentView titleBar, PairNewVehicleViewModel ViewModel)
        {
            var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout);

            lblTitle.Text = Langs.Const_Screen_Title_Manage_Vehicle;

            var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Manage_Vehicle_Step_1, App.ScreenSize.Width * .9,
                                                   new Action(() => ViewModel.MoveToSearch = true));

            return(new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                WidthRequest = App.ScreenSize.Width,
                Children =
                {
                    new StackLayout
                    {
                        Padding = new Thickness(0, 12),
                        HorizontalOptions = LayoutOptions.Center,
                        WidthRequest = App.ScreenSize.Width * .8,
                        Children =
                        {
                            new Label
                            {
                                Text = Langs.Const_Msg_Registration_Completed_Pair_Vehicle,
                                TextColor = Color.White,
                                FontFamily = Helper.BoldFont
                            },
                            new BoxView {
                                WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                            },
                            new StackLayout
                            {
                                WidthRequest = App.ScreenSize.Width * .8,
                                Padding = new Thickness(0, 8),
                                Children =
                                {
                                    new Label
                                    {
                                        Text = Langs.Const_Msg_Pair_Vehicle_Description_1,
                                        TextColor = Color.White,
                                        FontFamily = Helper.RegFont,
                                        HorizontalTextAlignment = TextAlignment.Center
                                    },
                                    new Label
                                    {
                                        Text = Langs.Const_Msg_Pair_Vehicle_Description_2,
                                        TextColor = Color.White,
                                        FontFamily = Helper.BoldFont,
                                        HorizontalTextAlignment = TextAlignment.Center
                                    }
                                }
                            },
                            new BoxView {
                                WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                            },
                            new StackLayout
                            {
                                WidthRequest = App.ScreenSize.Width * .8,
                                Padding = new Thickness(0, 8),
                                HorizontalOptions = LayoutOptions.Center,
                                Children =
                                {
                                    new Label
                                    {
                                        Text = Langs.Const_Label_Manage_Vehicle_Step_1,
                                        TextColor = Color.White,
                                        FontFamily = Helper.RegFont,
                                        HorizontalTextAlignment = TextAlignment.Center
                                    },
                                    new Label
                                    {
                                        Text = Langs.Const_Label_Manage_Vehicle_Step_2,
                                        TextColor = Color.White,
                                        FontFamily = Helper.BoldFont,
                                        HorizontalTextAlignment = TextAlignment.Center
                                    },
                                    new Label
                                    {
                                        Text = Langs.Const_Label_Manage_Vehicle_Step_3,
                                        TextColor = Color.White,
                                        FontFamily = Helper.BoldFont,
                                        HorizontalTextAlignment = TextAlignment.Center
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Padding = new Thickness(0, 12),
                        Children =      { arrowButton}
                    }
                }
            });
        }
        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 }
            });
        }
        public static StackLayout InitialApproval(ContentView titleBar, InitialApprovalViewModel ViewModel)
        {
            ViewModel.OkToGo = false;

            var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout);

            lblTitle.Text = Langs.Const_Screen_Title_Terms;

            var masterGrid = new Grid
            {
                WidthRequest      = App.ScreenSize.Width * .9,
                HeightRequest     = App.ScreenSize.Height - 100,
                HorizontalOptions = LayoutOptions.Center
            };

            masterGrid.ColumnDefinitions = new ColumnDefinitionCollection
            {
                new ColumnDefinition {
                    Width = App.ScreenSize.Width * .9
                }
            };
            masterGrid.RowDefinitions = new RowDefinitionCollection
            {
                new RowDefinition {
                    Height = App.ScreenSize.Height * .2
                },
                new RowDefinition {
                    Height = GridLength.Auto
                },
                new RowDefinition {
                    Height = GridLength.Auto
                },
            };

            var innerGrid = new Grid
            {
                RowSpacing        = 12,
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
            };

            innerGrid.RowDefinitions = new RowDefinitionCollection
            {
                new RowDefinition {
                    Height = 48
                },
                new RowDefinition {
                    Height = 48
                },
                new RowDefinition {
                    Height = 48
                }
            };

            var width = App.ScreenSize.Width * .9;

            var chkTandC = new Image
            {
                WidthRequest  = 32,
                HeightRequest = 32,
            };

            chkTandC.SetBinding(Image.SourceProperty, new Binding("OptOneTicked", converter: new OptToFilename()));
            chkTandC.GestureRecognizers.Add(new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                Command = new Command(() => ViewModel.OptOneTicked = !ViewModel.OptOneTicked)
            });

            var chkPrivacy = new Image
            {
                WidthRequest  = 32,
                HeightRequest = 32,
            };

            chkPrivacy.SetBinding(Image.SourceProperty, new Binding("OptTwoTicked", converter: new OptToFilename()));
            chkPrivacy.GestureRecognizers.Add(new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                Command = new Command(() => ViewModel.OptTwoTicked = !ViewModel.OptTwoTicked)
            });

            var chkSpeed = new Image
            {
                WidthRequest  = 32,
                HeightRequest = 32,
            };

            chkSpeed.SetBinding(Image.SourceProperty, new Binding("OptThreeTicked", converter: new OptToFilename()));
            chkSpeed.GestureRecognizers.Add(new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                Command = new Command(() => ViewModel.OptThreeTicked = !ViewModel.OptThreeTicked)
            });

            var lblTandC = new Label
            {
                Text                  = Langs.Const_Label_Terms_1,
                TextColor             = Color.Blue,
                FontFamily            = Helper.RegFont,
                VerticalTextAlignment = TextAlignment.Center
            };

            lblTandC.GestureRecognizers.Add(new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                Command = new Command(() => Device.OpenUri(new Uri(@"https://www.appyfleet.co.uk/wp-content/uploads/2017/05/Terms-and-Conditions-for-Supply-of-Appy-Fleet_Driver-Terms.pdf")))
            });

            var lblPrivacy = new Label
            {
                Text                  = Langs.Const_Label_Terms_2,
                TextColor             = Color.Blue,
                FontFamily            = Helper.RegFont,
                VerticalTextAlignment = TextAlignment.Center,
            };

            lblPrivacy.GestureRecognizers.Add(new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                Command = new Command(() => Device.OpenUri(new Uri(@"https://www.appyfleet.co.uk/wp-content/uploads/2017/05/Appy-Fleet-Cookie-Privacy-Policies.pdf")))
            });

            var lblSpeed = new Label
            {
                TextColor             = Color.Blue,
                Text                  = Langs.Const_Label_Terms_3,
                FontFamily            = Helper.RegFont,
                VerticalTextAlignment = TextAlignment.Center
            };

            lblSpeed.GestureRecognizers.Add(new TapGestureRecognizer
            {
                NumberOfTapsRequired = 1,
                Command = new Command(() => Device.OpenUri(new Uri(@"https://legal.here.com/terms/general-content-supplier/terms-and-notices/")))
            });

            var frameDriverTC = new Frame
            {
                BackgroundColor = FormsConstants.AppySilverGray,
                WidthRequest    = App.ScreenSize.Width * .9,
                HeightRequest   = 48,
                VerticalOptions = LayoutOptions.Center,
                Padding         = new Thickness(4),
                Content         = new StackLayout
                {
                    Orientation     = StackOrientation.Horizontal,
                    VerticalOptions = LayoutOptions.Center,
                    Padding         = new Thickness(4, 0),
                    Children        =
                    {
                        new StackLayout
                        {
                            WidthRequest      = 60,
                            HorizontalOptions = LayoutOptions.Start,
                            Children          = { chkTandC }
                        }, lblTandC
                    }
                }
            };

            var framePrivacy = new Frame
            {
                BackgroundColor = FormsConstants.AppySilverGray,
                WidthRequest    = App.ScreenSize.Width * .9,
                HeightRequest   = 48,
                Padding         = new Thickness(4),
                Content         = new StackLayout
                {
                    Orientation     = StackOrientation.Horizontal,
                    VerticalOptions = LayoutOptions.Center,
                    Padding         = new Thickness(4, 0),
                    Children        =
                    { new StackLayout
                      {
                          WidthRequest      = 60,
                          HorizontalOptions = LayoutOptions.Start,
                          Children          = { chkPrivacy }
                      }, lblPrivacy }
                }
            };

            var frameSpeed = new Frame
            {
                BackgroundColor = FormsConstants.AppySilverGray,
                WidthRequest    = App.ScreenSize.Width * .9,
                HeightRequest   = 48,
                Padding         = new Thickness(4),
                Content         = new StackLayout
                {
                    Orientation     = StackOrientation.Horizontal,
                    VerticalOptions = LayoutOptions.Center,
                    Padding         = new Thickness(4, 0),
                    Children        =
                    { new StackLayout
                      {
                          WidthRequest      = 60,
                          HorizontalOptions = LayoutOptions.Start,
                          Children          = { chkSpeed }
                      }, lblSpeed }
                }
            };

            innerGrid.Children.Add(frameDriverTC, 0, 0);
            innerGrid.Children.Add(framePrivacy, 0, 1);
            innerGrid.Children.Add(frameSpeed, 0, 2);
            masterGrid.Children.Add(innerGrid, 0, 1);

            var btnAccept = new Button
            {
                WidthRequest    = App.ScreenSize.Width * .9,
                Text            = Langs.Const_Button_Accept,
                BorderRadius    = 6,
                BackgroundColor = FormsConstants.AppyDarkBlue,
                TextColor       = Color.White,
                FontFamily      = Helper.BoldFont,
            };

            btnAccept.SetBinding(Button.IsEnabledProperty, new Binding("OkToGo"));
            btnAccept.Clicked += delegate { ViewModel.OkGo = true; };
            masterGrid.Children.Add(btnAccept, 0, 2);

            masterGrid.Children.Add(new StackLayout
            {
                VerticalOptions   = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
                Padding           = new Thickness(0, 12),
                Children          =
                {
                    /*new Label
                     * {
                     *  Text = Langs.Const_Screen_Title_Terms,
                     *  FontFamily = Helper.BoldFont,
                     *  TextColor = Color.White,
                     *  HorizontalTextAlignment = TextAlignment.Center
                     * },*/
                    new Label
                    {
                        Text       = Langs.Const_Msg_Terms_Description,
                        FontFamily = Helper.RegFont,
                        TextColor  = Color.White,
                        HorizontalTextAlignment = TextAlignment.Center
                    }
                }
            }, 0, 0);

            return(new StackLayout
            {
                TranslationX = -6,
                WidthRequest = App.ScreenSize.Width,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Start,
                Children = { masterGrid }
            });
        }