public CustomNavBar ConfigureNavBar(string title = "", bool showBackButton = false, bool showMenuButton = false)
        {
            var navBar = new CustomNavBar(showBackButton, title, showMenuButton);

            navBar.BackButtonClicked += () => { PopView();
                                                FlowManager.CurrentStep1 -= 1; };
            navBar.MenuButtonClicked += OnMenuButtonClicked;

            return(navBar);
        }
示例#2
0
        private void ConfigureScreen()
        {
            NavBar = BaseContentPage.Instance.ConfigureNavBar("Configurações".ToUpper(), true, true);


            StackLayout StopSteps = GetStepEntries("Pares por etapa",
                                                   $"{nameof(ViewModel.Storage)}.{nameof(ViewModel.Storage.TotalStops)}", 1);
            StackLayout reactionTime = GetStepEntries("Tempo de reação em milisegundos",
                                                      $"{nameof(ViewModel.Storage)}.{nameof(ViewModel.Storage.reactionTime)}", 2);
            StackLayout userName = GetStepEntries("Usuario",
                                                  $"{nameof(ViewModel.Storage)}.{nameof(ViewModel.Storage.Username)}", 3);

            StackLayout training = GetModeEntries("Modo de treinamento",
                                                  $"{ViewModel.Storage.TrainingMode}".ToLower(), 1);
            StackLayout finalStep = GetModeEntries("Ultima etapa livre",
                                                   $"{ViewModel.Storage.FinalStepFree}".ToLower(), 2);


            updateLabel = new CustomLabel()
            {
                Text                    = "Você tem atualizações no modelo do seu carro!",
                FontSize                = 18,
                TextColor               = Color.Black,
                Margin                  = new Thickness(60, 0, 60, 20),
                FontAttributes          = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Center,
            };

            updateCar = new Button()
            {
                Text            = "Atualizar",
                BackgroundColor = ColorPalette.Pink,
                FontAttributes  = FontAttributes.Bold,
                FontSize        = 18,
                Margin          = new Thickness(20, 0),
                //Padding = new Thickness(12),
                BorderRadius    = 18,
                HeightRequest   = 55,
                TextColor       = Color.White,
                VerticalOptions = LayoutOptions.End,
                Command         = ViewModel.UpdateCar,
            };

            description = new Label()
            {
                Text = "Carro: " + Car.Name + " " + Car.Style + ", \nRW: " + Math.Round(Convert.ToDecimal(Car.WheelRadiusExternal), 4),    // + "\n MAC Adress: " + Storage.Address,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                FontSize = 18,
                Margin   = new Thickness(0, 0, 0, 10)
            };

            //new CustomLabel()
            //{
            //    Text = "Carro: " + Car.Name + " " + Car.Style + ", \nRW: " + Math.Round(Convert.ToDecimal(Car.WheelRadiusExternal), 4),// + "\n MAC Adress: " + Storage.Address,
            //    FontSize = 18,
            //    TextColor = Color.Black,
            //    Margin = new Thickness(60, 0, 60, 20),
            //    FontAttributes = FontAttributes.Bold,
            //    HorizontalTextAlignment = TextAlignment.Center,
            //};

            Content = new StackLayout()
            {
                Children =
                {
                    NavBar,
                    userName,
                    StopSteps,
                    reactionTime,
                    finalStep,
                    training,
                    description,
                }
            };
        }
        private void ConfigureScreen()
        {
            //ServicesManager.Instance.SoundPlayer.StopSound();
            //BackgroundColor = Color.White;
            NavBar = BaseContentPage.Instance.ConfigureNavBar("Conectando");

            BoxView whiteBox = new BoxView()
            {
                BackgroundColor = Color.White
            };
            BoxView lightBlueBox = new BoxView()
            {
                Color = ColorPalette.LightBlue
            };

            CustomLabel text = new CustomLabel()
            {
                Margin                  = new Thickness(70, 15),
                BackgroundColor         = Color.White,
                Text                    = "Conectando o sensor ao bluetooth".ToUpper(),
                FontAttributes          = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize                = 15,
                TextColor               = Color.Black,
            };


            //UI.Animation directionGIF = new UI.Animation(AnimationType.Wainting);

            GIF gif = new GIF()
            {
                //Source = ImageSource.FromFile("wainting.gif"),
                GIFSource = "loading",
                Aspect    = Aspect.AspectFill,
                IsOpaque  = true
            };


            Button cancelButton = new Button()
            {
                TextColor       = ColorPalette.Pink,
                Text            = "Cancelar".ToLower(),
                HeightRequest   = 60,
                BackgroundColor = Color.Transparent,
                Command         = new Command(() =>
                {
                    Cancelled?.Invoke();
                })
            };


            RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(60, GridUnitType.Auto)
            });
            RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Star)
            });
            RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            });
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Auto)
            });


            Children.Add(gif, 0, 2);
            //Children.Add(directionGIF, 0, 2);

            Children.Add(whiteBox, 0, 0);
            Children.Add(NavBar, 0, 0);
            Children.Add(text, 0, 1);
            Children.Add(lightBlueBox, 0, 3);
            Children.Add(cancelButton, 1, 3);

            Grid.SetRowSpan(whiteBox, 2);
            Grid.SetColumnSpan(gif, 2);
            Grid.SetColumnSpan(whiteBox, 2);
            Grid.SetColumnSpan(NavBar, 2);
            Grid.SetColumnSpan(text, 2);
            Grid.SetColumnSpan(lightBlueBox, 2);

            NavBar.TitleLabel.HorizontalTextAlignment = TextAlignment.Center;
            NavBar.TitleLabel.VerticalOptions         = LayoutOptions.CenterAndExpand;
            NavBar.TitleLabel.HorizontalOptions       = LayoutOptions.CenterAndExpand;
        }
示例#4
0
        void ConfigureScreen()
        {
            NavBar = BaseContentPage.Instance.ConfigureNavBar("Adicionar carro", true);

            SearchEntry = new RoundedBorderedEntry()
            {
                CenteredPlaceholder = true,
                PlaceholderColor    = ColorPalette.DarkBlue,
                Placeholder         = "Qual a marca do seu carro?".ToUpper(),
                FontAttributes      = FontAttributes.Bold,
                FontSize            = 15,
                TextColor           = ColorPalette.DarkBlue,
                BorderColor         = ColorPalette.DarkBlue,
                BorderWidth         = App.ScreenWidth / 72,
                HorizontalOptions   = LayoutOptions.FillAndExpand,
            };



            SearchIcon = new Icon()
            {
                HeightRequest     = 25,
                WidthRequest      = 25,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.StartAndExpand,
                Margin            = new Thickness(15, 0, 0, 0),
                Color             = ColorPalette.DarkBlue,
                FileName          = "search.svg",
            };
            SearchIcon.SetBinding(VisualElement.IsVisibleProperty, new Binding(nameof(SearchEntry.Text), source: SearchEntry, converter: new ValueConverter((text) => string.IsNullOrWhiteSpace((string)text))));

            SearchGrid = new Grid()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Margin            = new Thickness(20, 30, 20, 30),
            };

            SearchGrid.RowDefinitions.Add(new RowDefinition());
            SearchGrid.ColumnDefinitions.Add(new ColumnDefinition());

            Label textSubtitleLabel = new Label()
            {
                Text              = "Marcas populares",
                FontSize          = 14,
                TextColor         = ColorPalette.Gray,
                Margin            = new Thickness(20, 0, 0, 0),
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            RoundedBorderedLabel subtitleLabel = new RoundedBorderedLabel(textSubtitleLabel, Color.Transparent, 0, ColorPalette.ExtraLightGray, new Thickness(0, 5), 0)
            {
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            subtitleLabel.Content.HorizontalOptions = subtitleLabel.HorizontalOptions;
            int counter = 0;

            optionsList = new CarSelectionList()
            {
                ItemsSource       = ViewModel.BrandOptions,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                ItemTemplate      = new DataTemplate(() =>
                {
                    var option        = ViewModel.BrandOptions[counter];
                    CustomLabel label = new CustomLabel()
                    {
                        VerticalTextAlignment = TextAlignment.Center,
                        CustomPadding         = new Thickness(10, 0, 0, 0),
                        Text            = option.Name,
                        FontSize        = 16,
                        TextColor       = option == ViewModel.SelectedBrand ? ColorPalette.Pink : ColorPalette.Gray,
                        FontAttributes  = FontAttributes.Bold,
                        BackgroundColor = Color.White
                    };
                    CustomViewCell cell = new CustomViewCell(label)
                    {
                        View = label,
                        SelectedTextColor = ColorPalette.Pink,
                        NormalTextColor   = label.TextColor,
                    };

                    counter++;
                    return(cell);
                })
            };
            optionsList.SetBinding(ListView.SelectedItemProperty, new Binding(nameof(ViewModel.SelectedBrand)));
            //optionsList.ItemTapped += ViewModel.OnItemTapped;
            if (App.IsAndroidSDKBelowMarshmallow)
            {
                optionsList.ItemSelected += (sender, args) =>
                {
                    ViewModel.SelectedBrand = args.SelectedItem as CarFilterInfo;
                    optionsList.Layout(optionsList.Bounds);
                }
            }
            ;



            Button confirmatioButton = new Button()
            {
                BackgroundColor = ColorPalette.LightBlue,
                TextColor       = Color.White,
                FontAttributes  = FontAttributes.Bold,
                Text            = "Continuar".ToUpper(),
                //Margin = new Thickness(50, 0, 50, 30),
                FontSize        = 18,
                VerticalOptions = LayoutOptions.End,
                //Padding = new Thickness(10),
                BorderRadius  = 18,
                Margin        = 10,
                HeightRequest = 55,
                Command       = ViewModel.SelectOption
            };

            Children.Clear();
            Children.Add(NavBar);
            Children.Add(SearchEntry);
            Children.Add(SearchGrid);
            Children.Add(subtitleLabel);
            Children.Add(optionsList);
            Children.Add(confirmatioButton);
            SearchEntry.SizeChanged += OnSearchSizeChanged;
            SearchEntry.Completed   += OnTextChanged;
        }
        private void ConfigureScreen()
        {
            BackgroundColor = Color.White;
            float GIFRatio  = 0.78409f;
            float GIFWidth  = App.ScreenWidth * 0.5f;
            float GIFHeight = App.ScreenWidth * 0.5f / GIFRatio;

            RowDefinitions.Add(new RowDefinition()
            {
                Height = 60
            });                                                      // NavBar
            RowDefinitions.Add(new RowDefinition()
            {
                Height = (App.ScreenHeight - 60 - GIFHeight - 50) / 2
            });                                                                                                // Titulo
            //RowDefinitions.Add(new RowDefinition() { Height = 30 }); //
            RowDefinitions.Add(new RowDefinition()
            {
                Height = 50
            });
            RowDefinitions.Add(new RowDefinition()
            {
                Height = GIFHeight
            });
            RowDefinitions.Add(new RowDefinition()
            {
                Height = (App.ScreenHeight - 60 - GIFHeight - 50) / 2
            });
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = App.ScreenWidth / 2
            });
            ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = App.ScreenWidth / 2
            });

            CustomNavBar navBar = BaseContentPage.Instance.ConfigureNavBar("", true, true);

            Label title = new Label()
            {
                Text                    = "Escolha sua vaga".ToUpper(),
                FontAttributes          = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.End,
                Margin                  = new Thickness(70, 40),
                FontSize                = 20,
                TextColor               = Color.Black
            };

            GIF left = new GIF()
            {
                WidthRequest     = GIFWidth,
                HeightRequest    = GIFHeight,
                GIFSource        = "left_choice",
                Margin           = new Thickness(5, 0, 0, 0),
                OnClickParameter = Direction.Left,
                OnClick          = ViewModel.DirectionChoosed
            };

            GIF right = new GIF()
            {
                WidthRequest     = GIFWidth,
                HeightRequest    = GIFHeight,
                GIFSource        = "right_choice",
                Margin           = new Thickness(0, 0, 5, 0),
                OnClickParameter = Direction.Right,
                OnClick          = ViewModel.DirectionChoosed
            };

            Label rightLabel = new Label()
            {
                Text                    = "Direita".ToUpper(),
                TextColor               = Color.Black,
                FontAttributes          = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.End,
                FontSize                = 16,
            };

            Label leftLabel = new Label()
            {
                Text                    = "Esquerda".ToUpper(),
                TextColor               = Color.Black,
                FontAttributes          = FontAttributes.Bold,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.End,
                FontSize                = 16,
            };

            Button checkTest = new Button
            {
                Text = "Modo de treinamento".ToUpper(),
                //Margin = new Thickness(70, 50),
                BackgroundColor   = ColorPalette.LightBlue,
                TextColor         = Color.White,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.End,
                FontSize          = 16,
                //Command = ChooseCarViewModel.checkTest,
            };

            checkTest.Clicked += (sender, e) =>
            {
                if (checkTest.Text == "Modo de treinamento".ToUpper())
                {
                    checkTest.Text             = "Modo padrão".ToUpper();
                    StepViewModel.TrainingMode = true;
                }
                else
                {
                    checkTest.Text             = "Modo de treinamento".ToUpper();
                    StepViewModel.TrainingMode = false;
                }
            };
            Children.Add(navBar, 0, 0);
            Children.Add(title, 0, 1);
            //Children.Add(checkTest);
            Children.Add(leftLabel, 0, 2);
            Children.Add(rightLabel, 1, 2);
            Children.Add(left, 0, 3);
            Children.Add(right, 1, 3);

            Grid.SetColumnSpan(navBar, 2);
            Grid.SetColumnSpan(title, 2);
        }
示例#6
0
        private void ConfigureScreen()
        {
            NavBar = BaseContentPage.Instance.ConfigureNavBar("Carro personalizado".ToUpper(), true, true);
            NavBar.BackButton.GestureRecognizers.Clear();
            NavBar.BackButton.GestureRecognizers.Add(new TapGestureRecognizer()
            {
                Command = new Command(() =>
                {
                    BaseContentPage.Instance.PopModal();
                })
            });

            RoundedBorderedEntry car = GetEntryText("Marca");

            car.SetBinding(RoundedEntry.TextProperty, new Binding($"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.Name)}"));

            RoundedBorderedEntry style = GetEntryText("Modelo");

            style.SetBinding(RoundedEntry.TextProperty, new Binding($"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.Style)}"));

            RoundedBorderedEntry parkingSpace = GetEntry("Tamanho minimo de vaga (CM)");

            parkingSpace.SetBinding(RoundedEntry.TextProperty, new Binding($"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.ParkingSpace)}", converter: Converter));

            RoundedBorderedEntry wheelRadiusInt = GetEntry("Raio da roda Interno");

            wheelRadiusInt.SetBinding(RoundedEntry.TextProperty, new Binding($"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.WheelRadiusInternal)}"));

            RoundedBorderedEntry wheelRadiusExt = GetEntryText("Raio da roda Externo");

            wheelRadiusExt.SetBinding(RoundedEntry.TextProperty, new Binding($"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.WheelRadiusExternal)}"));



            Label passosDaBaliza = new Label()
            {
                FontSize = 16, Text = "Passos da baliza (em CM, sempre positivo)"
            };

            StackLayout first = GetStepEntries("Primeiro passo - Centralizado/Frente",
                                               $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.FirstLeft)}",
                                               $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.FirstRight)}");
            StackLayout second = GetStepEntries("Segundo passo - Esquerda/Trás",
                                                $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.SecondLeft)}",
                                                $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.SecondRight)}");
            StackLayout third = GetStepEntries("Terceiro passo - Centralizado/Trás",
                                               $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.ThirdLeft)}",
                                               $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.ThirdRight)}");
            StackLayout fourth = GetStepEntries("Quarto passo - Esquerda/Frente",
                                                $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.FourthLeft)}",
                                                $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.FourthRight)}");
            StackLayout fifth = GetStepEntries("Quinto passo - Direita/Frente",
                                               $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.FifthLeft)}",
                                               $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.FifthRight)}");
            StackLayout sixth = GetStepEntries("Sexto passo - Esquerda/Frente",
                                               $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.SixthLeft)}",
                                               $"{nameof(ViewModel.Car)}.{nameof(ViewModel.Car.SixthRight)}");

            var button = new Button()
            {
                Text            = "Concluido",
                BackgroundColor = ColorPalette.LightBlue,
                TextColor       = Color.White,
                BorderRadius    = 18,
                Margin          = 10,
                HeightRequest   = 55,
                FontSize        = 17,
                Command         = ViewModel.Continue,
            };

            Content = new StackLayout()
            {
                Children =
                {
                    NavBar,
                    car,
                    style,
                    parkingSpace,
                    wheelRadiusExt,
                    wheelRadiusInt,
                    first,
                    second,
                    third,
                    fourth,
                    fifth,
                    sixth,
                    button
                }
            };
        }