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 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 }
            });
        }
Exemple #6
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 }
            });
        }
Exemple #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 }
            });
        }
        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 }
            });
        }
Exemple #9
0
        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;
        }
        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,
                MinimumHeightRequest    = 48,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                BackgroundColor         = FormsConstants.AppyBlue,
                TextColor = Color.White,
                Text      = Langs.Const_Menu_EmergencyAdvice
            };

            view1 = CreateView("icon_0", Langs.Const_Msg_SOS_Title_1, Langs.Const_Msg_SOS_Description_1, 1, .55);
            view2 = CreateView("icon_1", Langs.Const_Msg_SOS_Title_2, Langs.Const_Msg_SOS_Description_2, 1, .55);
            view3 = CreateView("icon_2", Langs.Const_Msg_SOS_Title_3, Langs.Const_Msg_SOS_Description_3, 1, .55);
            view4 = CreateView("icon_3", Langs.Const_Msg_SOS_Title_4, Langs.Const_Msg_SOS_Description_4, 1, .55);
            view5 = CreateView("icon_4", Langs.Const_Msg_SOS_Title_5, Langs.Const_Msg_SOS_Description_5, 1, .55);
            view6 = CreateView("icon_5", Langs.Const_Msg_SOS_Title_6, Langs.Const_Msg_SOS_Description_6, 1, .55);
            view7 = CreateView("icon_6", Langs.Const_Msg_SOS_Title_7, Langs.Const_Msg_SOS_Description_7, 1, .4);

            slider = new SliderView(view1, App.ScreenSize.Height * 0.62, App.ScreenSize.Width)
            {
                TransitionLength     = 200,
                MinimumSwipeDistance = 50
            };

            slider.Children.Add(view2);
            slider.Children.Add(view3);
            slider.Children.Add(view4);
            slider.Children.Add(view5);
            slider.Children.Add(view6);
            slider.Children.Add(view7);

            var btnSendSOS = ArrowBtn.ArrowButton(Langs.Const_Button_Send_Incident, App.ScreenSize.Width * .7,
                                                  new Action(() => ViewModel.SendSMS()));

            var dataStack = new StackLayout
            {
                WidthRequest      = App.ScreenSize.Width,
                HeightRequest     = App.ScreenSize.Height - 120,
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    new Label   {
                        Text      = Langs.Const_Label_Guide_Steps, HorizontalTextAlignment = TextAlignment.Center, FontFamily = Helper.RegFont,
                        TextColor = Color.White, FontSize = 14
                    },
                    new BoxView {
                        WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                    },
                    slider,
                    new BoxView {
                        WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White
                    },
                    btnSendSOS
                }
            };

            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 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}
                    }
                }
            });
        }
Exemple #13
0
        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 }
            });
        }