/// <summary> /// Method that creates the page content /// </summary> /// <returns>View of the content to be displayed</returns> public View SetContent() { var header = new Label { Text = "Ny Kørsel", TextColor = Color.FromHex(Definitions.TextColor), FontSize = Definitions.HeaderFontSize, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; var vertButton = new VertsButton(SendViewStoredMessage, Definitions.storedReportsCount.ToString()); var exitButton = new LogoutButton(ShowLogoutPopup); vertButton.WidthRequest = 100; vertButton.HeightRequest = 60; exitButton.WidthRequest = 100; exitButton.HeightRequest = 60; _header = new StackLayout { Orientation = StackOrientation.Horizontal, HeightRequest = Definitions.HeaderHeight, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = 5, Children = { exitButton, header, vertButton, } }; _header.SetBinding(StackLayout.BackgroundColorProperty, MainViewModel.PrimaryHexProperty); Definitions.DateToView = DateTime.Now.ToString("d/M/yyyy"); Definitions.DateToApi = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); var date = new Label { Text = Definitions.DateToView, TextColor = Color.FromHex(Definitions.DefaultTextColor), BackgroundColor = Color.FromHex(Definitions.BackgroundColor), HorizontalOptions = LayoutOptions.CenterAndExpand, FontSize = Definitions.LoginLabelText, HeightRequest = 40, }; List = new ListView { ItemTemplate = new DataTemplate(typeof(DriveReportCell)), SeparatorColor = Color.FromHex("#EE2D2D"), SeparatorVisibility = SeparatorVisibility.Default, VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; List.SetBinding(ListView.ItemsSourceProperty, MainViewModel.DriveProperty); List.ItemSelected += async (sender, e) => { if (e.SelectedItem == null) return; var selectedItem = (DriveReportCellModel)e.SelectedItem; SendSelectedMessage(); }; var startButton = new ButtomButton("Start Kørsel", StartDrive); var buttomStack = new StackLayout { VerticalOptions = LayoutOptions.End, Padding = Definitions.Padding, HeightRequest = Definitions.ButtonHeight, Children = {startButton} }; var layout = new StackLayout { Spacing = 2, Children = { _header, date, List, CheckStack(), buttomStack }, BackgroundColor = Color.FromHex(Definitions.BackgroundColor), }; _popUpLayout = new PopupLayout(); _popUpLayout.Content = layout; return _popUpLayout; }
/// <summary> /// Method that creates the page content /// </summary> public View SetContent() { var signalStatus = new Label { TextColor = Color.Red, FontSize = Definitions.AccuracyTextSize, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, Text = "Intet GPS signal", }; signalStatus.SetBinding(Label.IsVisibleProperty, GpsViewModel.SignalProperty); var signalStack = new StackLayout { HeightRequest = 45, Children = { signalStatus} }; var gpsStatus = new Label { TextColor = Color.FromHex(Definitions.DefaultTextColor), FontSize = Definitions.AccuracyTextSize, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; gpsStatus.SetBinding(Label.TextProperty, GpsViewModel.AccuracyProperty); var gpsDriven = new Label { TextColor = Color.FromHex(Definitions.DefaultTextColor), FontSize = Definitions.DrivenTextSize, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, XAlign = TextAlignment.Center, WidthRequest = _popupWidth - 80 }; gpsDriven.SetBinding(Label.TextProperty, GpsViewModel.DrivenProperty); var gpsUpdate = new Label { TextColor = Color.FromHex(Definitions.DefaultTextColor), FontSize = Definitions.LastupdateTextSize, FontAttributes = FontAttributes.Italic, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; gpsUpdate.SetBinding(Label.TextProperty, GpsViewModel.LastUpdateProperty); var gpsTextStack = new StackLayout { Orientation = StackOrientation.Vertical, BackgroundColor = Color.FromHex(Definitions.BackgroundColor), VerticalOptions = LayoutOptions.Center, Padding = new Thickness(0, 80, 0, 100), Children = { signalStack, gpsStatus, gpsDriven, gpsUpdate, } }; _pauseButton = new ToggleButton(_startDrive, _pauseDrive, _driveAgain, SendToggleMessage); var finishButton = new ButtomButton("Afslut Kørsel", OpenPopup); _pauseButton.Height = Definitions.GpsButtonHeight; finishButton.Height = Definitions.GpsButtonHeight; var buttomStack = new StackLayout { VerticalOptions = LayoutOptions.Center, Padding = new Thickness(50, 0, 50, 0), Spacing = 30, Children = { _pauseButton, finishButton } }; var gpsStack = new StackLayout { Orientation = StackOrientation.Vertical, BackgroundColor = Color.FromHex(Definitions.BackgroundColor), VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10, 50, 10, 50), Children = { gpsTextStack, buttomStack } }; _popUpLayout = new PopupLayout(); _popUpLayout.Content = gpsStack; return _popUpLayout; }
/// <summary> /// Method that creates the page content /// </summary> public View SetContent() { var header = new Label { Text = "Gemte Rapporter", TextColor = Color.FromHex(Definitions.TextColor), FontSize = Definitions.HeaderFontSize - 4, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; var backButton = new BackButton(SendBackMessage); var filler = new Filler(); var headerstack = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.FromHex(Definitions.PrimaryColor), HeightRequest = Definitions.HeaderHeight, Padding = 5, Children = { backButton, header, filler, } }; var topText = new Label { Text = "Klik på rapporten for enten at sende eller slette den", TextColor = Color.FromHex(Definitions.DefaultTextColor), FontSize = Definitions.LoginLabelText, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, XAlign = TextAlignment.Center, }; List = new ListView { ItemTemplate = new DataTemplate(typeof(StoredReportCell)), SeparatorColor = Color.FromHex("#EE2D2D"), SeparatorVisibility = SeparatorVisibility.Default, VerticalOptions = LayoutOptions.StartAndExpand, }; List.SetBinding(ListView.ItemsSourceProperty, StoredReportsViewModel.ListProperty); List.ItemSelected += async (sender, e) => { if (e.SelectedItem == null) return; var selectedItem = (StoredReportCellModel)e.SelectedItem; var d = Convert.ToDateTime(selectedItem.report.Date); var t = d.ToString("d/M/yyyy"); PopUpLayout.ShowPopup(CreatePopup("Send rapport fra d. "+ t + " ?")); }; var layout = new StackLayout { Spacing = 8, Children = { headerstack, topText, List, }, BackgroundColor = Color.FromHex(Definitions.BackgroundColor), }; PopUpLayout = new PopupLayout(); PopUpLayout.Content = layout; return PopUpLayout; }
/// <summary> /// Method that creates the view content /// </summary> /// <returns>the view to be displayed</returns> public View SetContent() { // View Title var header = new Label { Text = "Afslut Kørsel", TextColor = Color.FromHex(Definitions.TextColor), FontSize = Definitions.HeaderFontSize, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; var headerstack = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.FromHex(Definitions.PrimaryColor), HeightRequest = Definitions.HeaderHeight, Padding = 5, Children = { header, } }; // Date View var date = new Label { TextColor = Color.FromHex(Definitions.DefaultTextColor), BackgroundColor = Color.FromHex(Definitions.BackgroundColor), HorizontalOptions = LayoutOptions.CenterAndExpand, FontSize = Definitions.LoginLabelText, HeightRequest = 35, }; date.SetBinding(Label.TextProperty, FinishDriveViewModel.DateProperty); var user = new Label { TextColor = Color.FromHex(Definitions.DefaultTextColor), BackgroundColor = Color.FromHex(Definitions.BackgroundColor), HorizontalOptions = LayoutOptions.CenterAndExpand, FontSize = Definitions.LoginLabelText, HeightRequest = 35, }; user.SetBinding(Label.TextProperty, FinishDriveViewModel.UsernameProperty); // Purpose View var purpose = new DriveFinishedCommonCell(SendPurposeMessage); purpose.Title = PurposeText; purpose.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.PurposeProperty); // Organization View var organization = new DriveFinishedCommonCell(SendOrganizationMessage); organization.Title = OrganizationText; organization.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.OrganizationProperty); // Rate View var rate = new DriveFinishedCommonCell(SendRateMessage); rate.Title = RateText; rate.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.RateProperty); // Remark View var remark = new DriveFinishedCommonCell(SendRemarkMessage); remark.Title = RemarkText; remark.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.RemarkProperty); // Total Km View var totalKm = new DriveFinishedCommonCell(SendSelectNewKmMessage); totalKm.Title = NewKmText; totalKm.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.NewKmProperty); // Home to Border Distance View /* var homeToBorderDistance = new DriveFinishedCommonCell(SendSelectHomeToBorderDistanceMessage); homeToBorderDistance.Title = HomeToBorderDistanceText; homeToBorderDistance.SetBinding(DriveFinishedCommonCell.DetailsProperty, FinishDriveViewModel.HomeToBorderDistanceProperty); homeToBorderDistance.SetBinding(DriveFinishedCommonCell.IsVisibleProperty, FinishDriveViewModel.FourKmRuleCheckProperty); */ // Cancel and send buttons var startButton = new ButtomButton("Indsend Kørsel", SendUploadMessage); var cancelButton = new ButtomButton("Annuller og Slet", OpenPopup); startButton.FontSize = 24; cancelButton.FontSize = 24; var width = Resolver.Resolve<IDevice>().Display.Width; startButton.Width = width / 2; cancelButton.Width = width / 2; var buttomStack = new StackLayout { Orientation = StackOrientation.Horizontal, VerticalOptions = LayoutOptions.End, Padding = Definitions.Padding, Spacing = Definitions.Padding, HeightRequest = Definitions.ButtonHeight + 20, HorizontalOptions = LayoutOptions.Fill, Children = { cancelButton, startButton } }; // Header View Container var headerLayout = new StackLayout { Spacing = 2, Children = { headerstack, date, user }, BackgroundColor = Color.FromHex(Definitions.BackgroundColor) }; // Content View Container var contentLayout = new StackLayout { Spacing = 2, Children = { purpose, organization, rate, remark, totalKm, StartCheck(), EndCheck(), //FourKmRuleCheck(), //homeToBorderDistance, buttomStack }, BackgroundColor = Color.FromHex(Definitions.BackgroundColor), }; // Add content view to a scrollview var scrollView = new ScrollView { Content = contentLayout, }; // Add Header and Content View Containers to a container var layout = new StackLayout { Spacing = 2, Children = { headerLayout, scrollView }, BackgroundColor = Color.FromHex(Definitions.BackgroundColor) }; // Add layout to a PopUpLayout PopUpLayout = new PopupLayout(); PopUpLayout.Content = layout; return PopUpLayout; }