private void ConfigureScreen() { var navBar = BaseContentPage.Instance.ConfigureNavBar("", true, true); Progress progress = new Progress(1, 0, false); ViewModel.Progress = progress; Label instructionLabel = new Label { FontSize = 17, HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.Black, VerticalOptions = LayoutOptions.Start, }; instructionLabel.SetBinding(Label.TextProperty, new Binding(nameof(ViewModel.Instruction), converter: new ValueConverter(value => value.ToString().ToUpper()))); Label directionLabel = new Label { FontSize = 17, HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.Black, FontAttributes = FontAttributes.Bold, Margin = 0 }; directionLabel.SetBinding(Label.TextProperty, new Binding(nameof(ViewModel.DirectionInstruction), converter: new ValueConverter(value => value.ToString().ToUpper()))); RoundedBorderedLabel roundedLabel = new RoundedBorderedLabel(directionLabel, ColorPalette.Pink, 3, Color.White, new Thickness(30, 1)) { VerticalOptions = LayoutOptions.Start, Margin = new Thickness(5, 5, 5, 0) }; GIF InstructionGIF = new GIF() { HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = App.ScreenWidth, MinimumHeightRequest = 50, VerticalOptions = LayoutOptions.FillAndExpand, }; InstructionGIF.SetBinding(GIF.GifSourceProperty, nameof(ViewModel.InstructionGIFSource)); Button measureSpaceButton = new Button { Text = "Medir vaga".ToUpper(), TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontSize = 17, BackgroundColor = ColorPalette.Pink, VerticalOptions = LayoutOptions.EndAndExpand, Margin = new Thickness(20, 0), //Padding = new Thickness(12), BorderRadius = 18, HeightRequest = 55, Command = ViewModel.MeasureSpaceCommand, }; measureSpaceButton.SetBinding(IsVisibleProperty, new Binding(nameof(ViewModel.MeasuringSpace), converter: new ValueConverter((value) => !(bool)value))); Button endMeasurementButton = new Button() { TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontSize = 17, BackgroundColor = ColorPalette.Pink, VerticalOptions = LayoutOptions.EndAndExpand, Margin = new Thickness(20, 0), //Padding = new Thickness(12), BorderRadius = 18, HeightRequest = 55, Command = ViewModel.EndMeasurementCommand, }; endMeasurementButton.SetBinding(IsVisibleProperty, new Binding(nameof(ViewModel.MeasuringSpace))); Button cancelButton = new Button() { BackgroundColor = ColorPalette.LightBlue, TextColor = Color.White, Text = "cancelar".ToUpper(), VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.End, Margin = new Thickness(20, 5), //Padding = new Thickness(12), BorderRadius = 18, HeightRequest = 55, FontSize = 14, FontAttributes = FontAttributes.Bold, Command = ViewModel.CancelMeasurementCommand }; Button jumpButton = new Button() { BackgroundColor = ColorPalette.LightBlue, TextColor = Color.White, Text = "pular medição".ToUpper(), VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.Start, Margin = new Thickness(20, 5), //Padding = new Thickness(12), BorderRadius = 18, HeightRequest = 55, FontSize = 14, FontAttributes = FontAttributes.Bold, Command = ViewModel.JumpMeasurementCommand }; Button teste = new Button() { BackgroundColor = ColorPalette.LightBlue, FontSize = 0, HorizontalOptions = LayoutOptions.End, FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Center, BorderRadius = 50 }; RowDefinitions.Add(new RowDefinition() { Height = 60 }); RowDefinitions.Add(new RowDefinition() { Height = 50 }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, 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) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); ColumnDefinitions.Add(new ColumnDefinition() { Width = App.ScreenWidth }); //Grid.ColumnDefinitions.Add() Children.Add(navBar, 0, 0); Children.Add(progress, 0, 1); Children.Add(instructionLabel, 0, 2); Children.Add(roundedLabel, 0, 3); if (Storage.TrainingMode) { Children.Add(teste, 0, 3); } Children.Add(InstructionGIF, 0, 4); Children.Add(measureSpaceButton, 0, 5); Children.Add(endMeasurementButton, 0, 5); Children.Add(cancelButton, 0, 6); Children.Add(jumpButton, 0, 6); //if (App.IsAndroidSDKBelowMarshmallow) //{ ViewModel.PropertyChanged += (sender, e) => { Device.BeginInvokeOnMainThread(() => { try { if (Storage.TrainingMode) { if (teste.IsVisible && Models.Sensor.StatusChecked) { teste.IsVisible = false; teste.IsEnabled = false; } else if (!teste.IsVisible && Models.Sensor.StatusChecked) { teste.IsVisible = true; teste.IsEnabled = true; } } //sizeTypeInTime = DistanceManager.Instance.CalculateParkingSpaceSizeType(Math.Round(ViewModel.ParkingSpaceSize+0.1)); //ViewModel.CountMetters(Math.Round(ViewModel.ParkingSpaceSize)); //switch (sizeTypeInTime) //{ // case Models.ParkingSpaceSizeType.VeryEasy: // case Models.ParkingSpaceSizeType.Easy: // case Models.ParkingSpaceSizeType.Average: // endMeasurementButton.BackgroundColor = Color.Green; // break; // case Models.ParkingSpaceSizeType.Hard: // endMeasurementButton.BackgroundColor = Color.Orange; // break; // case Models.ParkingSpaceSizeType.VeryHard: // endMeasurementButton.BackgroundColor = Color.Gray; // break; // default: // endMeasurementButton.BackgroundColor = Color.Red; // break; //} measureSpaceButton.IsVisible = measureSpaceButton.IsVisible; endMeasurementButton.IsVisible = endMeasurementButton.IsVisible; if (e.PropertyName == nameof(ViewModel.DirectionInstruction)) { directionLabel.Text = ViewModel.DirectionInstruction.ToUpper(); } else if (e.PropertyName == nameof(ViewModel.InstructionGIFSource)) { InstructionGIF.GIFSource = ViewModel.InstructionGIFSource; } else if (e.PropertyName == nameof(ViewModel.Instruction)) { instructionLabel.Text = ViewModel.Instruction.ToUpper(); } else if (e.PropertyName == nameof(ViewModel.MeasuringSpace)) { endMeasurementButton.IsVisible = ViewModel.MeasuringSpace; measureSpaceButton.IsVisible = !ViewModel.MeasuringSpace; } else if (e.PropertyName == nameof(ViewModel.ParkingSpaceSize)) { endMeasurementButton.Text = $"Concluir medição ({Math.Round(ViewModel.ParkingSpaceSize, 0)} CM)"; //measureSpaceButton.Text = $"Medir Vaga \n({Math.Round(ViewModel.ParkingSpaceSize, 0)} CM)"; } } catch (System.Exception ex) { string title = this.GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name; BalizaFacil.App.Instance.UnhandledException(title, ex); } }); }; //} }
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; }
void ConfigureScreen() { //var navBar = ConfigureNavBar("Adicionar carro", true, true); var navBar = new StackLayout(); SearchEntry = new RoundedBorderedEntry() { CenteredPlaceholder = true, PlaceholderColor = ColorPalette.DarkBlue, Placeholder = "Qual o tipo do seu carro?".ToUpper(), FontAttributes = FontAttributes.Bold, FontSize = 15, TextColor = ColorPalette.DarkBlue, Padding = new Thickness(50, 30), BorderColor = ColorPalette.DarkBlue, BorderWidth = App.ScreenWidth / 72, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand }; this.SearchEntry.SizeChanged += OnSearchSizeChanged; SearchIcon = new Icon() { Color = ColorPalette.DarkBlue, FileName = "search.svg", HeightRequest = 25, WidthRequest = 25, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.StartAndExpand, Margin = new Thickness(15, 0, 0, 0) }; 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() { Height = new GridLength(50, GridUnitType.Absolute) }); SearchGrid.ColumnDefinitions.Add(new ColumnDefinition()); SearchGrid.Children.Add(SearchEntry, 0, 0); SearchGrid.Children.Add(SearchIcon, 0, 0); Label textSubtitleLabel = new Label() { Text = "Tipos 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; CarSelectionList optionsList = new CarSelectionList() { ItemsSource = ViewModel.TypeOptions, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, }; optionsList.SetBinding(ListView.SelectedItemProperty, new Binding(nameof(ViewModel.SelectedType))); RoundedButton confirmatioButton = new RoundedButton() { BackgroundColor = ColorPalette.LightBlue, TextColor = Color.White, FontAttributes = FontAttributes.Bold, Text = "Continuar".ToUpper(), Margin = new Thickness(50, 0, 50, 30), FontSize = 17, VerticalOptions = LayoutOptions.End, Padding = new Thickness(10), Command = ViewModel.SelectOption }; Content = new StackLayout() { Children = { navBar, SearchGrid, SearchEntry, subtitleLabel, optionsList, confirmatioButton } }; }
private void ConfigureScreen() { BackgroundColor = Color.White; Progress generalProgress = new Progress(ViewModel.TotalSteps, ViewModel.Step) { Margin = new Thickness(5, 5, 5, 0) }; Label directionText = new Label() { TextColor = Color.Black, FontSize = 18, FontAttributes = FontAttributes.Bold, Text = DirectionMainInstruction, HorizontalTextAlignment = TextAlignment.Center, }; RoundedBorderedLabel mainDirectionLabel = new RoundedBorderedLabel(directionText, Color.Transparent, 0, ColorMainInstruction, 7) { //BackgroundColor = ColorMainInstruction, HorizontalOptions = LayoutOptions.FillAndExpand, Margin = new Thickness(30, 0), VerticalOptions = LayoutOptions.Start }; mainDirectionLabel.Content.HorizontalOptions = mainDirectionLabel.HorizontalOptions; Label secondDirectionLabel = new Label() { HorizontalTextAlignment = TextAlignment.Center, FontSize = 15, Text = DirectionSecondInstruction, TextColor = Color.Black, }; UI.Animation directionGIF = new UI.Animation(ViewModel.Direction); Label accelerationText = new Label() { TextColor = Color.Black, FontSize = 18, FontAttributes = FontAttributes.Bold, Text = AccelerationInstruction, HorizontalTextAlignment = TextAlignment.Center, }; RoundedBorderedLabel accelerationLabel = new RoundedBorderedLabel(accelerationText, Color.Transparent, 0, ColorPalette.ExtraLightGray, 7) { HorizontalOptions = LayoutOptions.FillAndExpand, WidthRequest = App.ScreenWidth, Margin = new Thickness(30, 0), }; accelerationLabel.Content.HorizontalOptions = accelerationLabel.HorizontalOptions; UI.Animation accelerationGIF = new UI.Animation(ViewModel.Acceleration); int ciclo = 0; if (ViewModel.Direction != SteeringWheel.CentrallyAligned) { accelerationGIF.KeepAnimating = false; accelerationGIF.Completed += () => { ciclo++; if (ciclo <= 1) { directionGIF.StartRedrawing(); } }; directionGIF.Completed += () => { if (ciclo <= 1) { accelerationGIF.StartRedrawing(); } }; } else { accelerationGIF.Completed += () => { ciclo++; if (ciclo <= 1) { accelerationGIF.StartRedrawing(); } }; } Progress = new CurvedProgressBar() { HeightRequest = App.ScreenHeight / 5 * 1.2, WidthRequest = App.ScreenWidth }; Progress.SetBinding(CurvedProgressBar.ProgressProperty, new Binding(nameof(ViewModel.Progress))); Progress.SetBinding(CurvedProgressBar.CmsLeftProperty, new Binding(nameof(ViewModel.DistanceLeft))); RoundedButton closeButton = new RoundedButton() { BackgroundColor = ColorPalette.LightBlue, TextColor = Color.White, Text = "X", FontSize = 20, FontAttributes = FontAttributes.Bold, WidthRequest = 40, HeightRequest = 40, Padding = 0, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.EndAndExpand, Margin = 10, Command = ViewModel.Cancel }; Label ParametrosTest = new Label() { BackgroundColor = ColorPalette.ExtraLightGray, HorizontalOptions = LayoutOptions.CenterAndExpand, FontSize = 18, FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.EndAndExpand, Margin = 10, }; RoundedButton nextRound = new RoundedButton() { BackgroundColor = ColorPalette.LightBlue, TextColor = Color.White, Text = "Proxima Etapa".ToUpper(), VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.CenterAndExpand, Margin = new Thickness(15, 10), Padding = new Thickness(30, 13), FontSize = 16, FontAttributes = FontAttributes.Bold, Command = ViewModel.NextRound }; ColumnDefinitions.Add(new ColumnDefinition() { Width = App.ScreenWidth }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, 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) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(App.ScreenHeight / 5 * 1.2, GridUnitType.Absolute) }); Children.Add(generalProgress, 0, 0); Children.Add(mainDirectionLabel, 0, 1); if (StepViewModel.TrainingMode) { Children.Add(ParametrosTest, 0, 2); Children.Add(nextRound, 0, 7); } else { Children.Add(secondDirectionLabel, 0, 2); } Children.Add(directionGIF, 0, 3); Children.Add(accelerationLabel, 0, 4); Children.Add(accelerationGIF, 0, 5); Children.Add(Progress, 0, 6); Children.Add(closeButton, 0, 6); if (App.IsAndroidSDKBelowMarshmallow) { ViewModel.PropertyChanged += (sender, args) => { if (args.PropertyName == nameof(ViewModel.DistanceLeft)) { Progress.CmsLeft = (int)ViewModel.DistanceLeft; } }; } ViewModel.PropertyChanged += (sender, e) => { Device.BeginInvokeOnMainThread(() => { //accelerationText.Text = $"V = {Math.Round(Convert.ToDecimal(DistanceManager.Instance.CurrentSpeed), 2)} KM/H \n"; //ParametrosTest.Text = $"V = {Math.Round(Convert.ToDecimal(StepViewModel.velocidade), 2)} KM/H \n" + // $"P = {Math.Round(StepViewModel.parou1, 0)} CM"; //directionText.Text = $"V = {Math.Round(Convert.ToDecimal(DistanceManager.Instance.CurrentSpeed * 0 + StepViewModel.FilteredSpeed), 2)}"; directionText.HorizontalTextAlignment = TextAlignment.Center; if ((FlowManager.CurrentStep1 == ApplicationStep.ManeuverIII) && ViewModel.curbTouch) { cabeOuNaoCabe = DistanceManager.Instance.CorrectOnCurbColisionTeste(Direction.Left, ApplicationStep.ManeuverIII); if (cabeOuNaoCabe == 1) { directionText.BackgroundColor = Color.Green; mainDirectionLabel.BackgroundColor = Color.Green; } else if (cabeOuNaoCabe == 2) { directionText.BackgroundColor = Color.Gray; mainDirectionLabel.BackgroundColor = Color.Gray; } else { directionText.BackgroundColor = Color.Red; mainDirectionLabel.BackgroundColor = Color.Red; } } else { directionText.BackgroundColor = Color.Transparent; mainDirectionLabel.BackgroundColor = Color.White; } }); }; }