public static StackLayout PairingComplete(ContentView titleBar, PairNewVehicleViewModel ViewModel) { var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout); lblTitle.Text = Langs.Const_Screen_Title_Pairing_Completed; var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Manage_Vehicle_Step_5, App.ScreenSize.Width * .9, new Action(() => ViewModel.MoveToLogin = true)); return(new StackLayout { Orientation = StackOrientation.Vertical, WidthRequest = App.ScreenSize.Width, Children = { new StackLayout { Padding = new Thickness(0, 12), HorizontalOptions = LayoutOptions.Center, Children = { new Image { Source = "accept_icon".CorrectedImageSource(), HeightRequest = 64 }, new BoxView { WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White }, new StackLayout { WidthRequest = App.ScreenSize.Width * .8, Padding = new Thickness(0, 8), Children = { new Label { Text = Langs.Const_Label_Pairing_Completed, TextColor = Color.White, FontFamily = Helper.BoldFont, HorizontalTextAlignment = TextAlignment.Center }, } }, new StackLayout { Padding = new Thickness(0, 12), Children ={ arrowButton } } } } } }); }
public static StackLayout PairToDevice(ContentView titleBar, PairNewVehicleViewModel ViewModel) { var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout); lblTitle.Text = Langs.Const_Label_Pairing; var activitySpinner = new ActivityIndicator { BackgroundColor = Color.White, IsRunning = true }; activitySpinner.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); var stackSpinning = new StackLayout { WidthRequest = App.ScreenSize.Width * .6, HorizontalOptions = LayoutOptions.Center, Children = { activitySpinner, new Label { Text = Langs.Const_Label_Pairing, HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.White, FontFamily = Helper.BoldFont } } }; return(new StackLayout { WidthRequest = App.ScreenSize.Width, HeightRequest = App.ScreenSize.Height - 102, TranslationX = -6, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { stackSpinning } }); }
public static StackLayout VehicleSummary(ContentView titleBar, PairNewVehicleViewModel ViewModel) { var lblTitle = GetUIElement.GetFirstElement <Label>(titleBar.Content as StackLayout); lblTitle.Text = Langs.Const_Screen_Title_Pairing_Summary; var arrowButton = ArrowBtn.ArrowButton(Langs.Const_Button_Manage_Vehicle_Step_4, App.ScreenSize.Width * .9, new Action(() => ViewModel.MoveToComplete = true)); return(new StackLayout { WidthRequest = App.ScreenSize.Width, HorizontalOptions = LayoutOptions.Center, Children = { new StackLayout { HorizontalOptions = LayoutOptions.Center, Padding = new Thickness(0, 12), Children = { new Label { FormattedText = FormattedProgress.GenerateProgress(true, true, true), TextColor = Color.White, FontFamily = Helper.BoldFont } } }, new BoxView { WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White }, new StackLayout { Padding = new Thickness(16, 8, 0, 16), WidthRequest = App.ScreenSize.Width * .8, Children = { new Label { Text = Langs.Const_Label_Review_Info, FontFamily = Helper.BoldFont, TextColor = Color.White } } }, new StackLayout { WidthRequest = App.ScreenSize.Width * .8, Padding = new Thickness(16, 12), Children = { new Label { Text = $"{ViewModel.Nickname}", TextColor = Color.White, FontFamily = Helper.BoldFont }, new Label { Text = ViewModel.Registration, FontFamily = Helper.RegFont, TextColor = Color.White }, new Label { Text = $"{ViewModel.Make} {ViewModel.Model}", TextColor = Color.White, FontFamily = Helper.RegFont }, } }, new StackLayout { Padding = new Thickness(0, 16, 0, 8), WidthRequest = App.ScreenSize.Width * .8, IsVisible = ViewModel.Paired, Children = { new Label { Text = Langs.Const_Label_Bluetooth_Registered, TextColor = Color.White, FontFamily = Helper.BoldFont } } }, new BoxView { WidthRequest = App.ScreenSize.Width, HeightRequest = 1, BackgroundColor = Color.White }, new StackLayout { Padding = new Thickness(0, 12), WidthRequest = App.ScreenSize.Width * .8, Children = { new Label { Text = Langs.Const_Label_Confirm_Pairing, TextColor = Color.White, FontFamily = Helper.RegFont } } }, arrowButton } }); }
public static StackLayout 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 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 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 } }); }
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} } } }); }