/// <summary> /// Method that creates the page content /// </summary> public void SetContent() { var header = new Label { Text = "Vælg Takst", TextColor = Color.FromHex(Definitions.TextColor), FontSize = Definitions.HeaderFontSize, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; var backButton = new BackButton(SendBackMessage); // filler to make header is centered var filler = new Filler(); // they need to be the same size. backButton.WidthRequest = backButton.WidthRequest - 40; filler.WidthRequest = backButton.WidthRequest; var headerstack = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.FromHex(Definitions.PrimaryColor), HeightRequest = Definitions.HeaderHeight, Children = { backButton, header, filler } }; var list = new ListView { ItemTemplate = new DataTemplate(typeof(GenericCell)), SeparatorColor = Color.FromHex("#EE2D2D"), SeparatorVisibility = SeparatorVisibility.Default, }; list.SetBinding(ListView.ItemsSourceProperty, TaxViewModel.TaxListProperty, BindingMode.TwoWay); list.ItemSelected += (sender, args) => { var item = (GenericCellModel) args.SelectedItem; if (item == null) return; item.Selected = true; Selected = item; SendSelectedMessage(); }; var layout = new StackLayout { BackgroundColor = Color.FromHex(Definitions.BackgroundColor), }; layout.Children.Add(headerstack); layout.Children.Add(list); this.Content = layout; }
/// <summary> /// Method that creates the page content /// </summary> public void SetContent() { var header = new Label { Text = "Bemærkning", TextColor = Color.FromHex(Definitions.TextColor), FontSize = Definitions.HeaderFontSize, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; var backButton = new BackButton(SendBackMessage); var saveButton = new SaveButton(SendSaveMessage); var headerstack = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.FromHex(Definitions.PrimaryColor), HeightRequest = Definitions.HeaderHeight, Children = { backButton, header, saveButton } }; _editor = new Editor { HeightRequest = Definitions.ScreenHeight - Definitions.HeaderHeight - 2 * Definitions.Padding, WidthRequest = Definitions.ScreenWidth, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; _editor.SetBinding(Editor.TextProperty, RemarkViewModel.RemarkProperty); var editorStack = new StackLayout { BackgroundColor = Color.FromHex(Definitions.BackgroundColor), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = Definitions.Padding, Children = { _editor } }; var layout = new StackLayout { BackgroundColor = Color.FromHex(Definitions.BackgroundColor), Children = { headerstack, editorStack} }; this.Content = layout; }
/// <summary> /// Method used to create the layout of the page /// </summary> private View SetContent() { var header = new Label { Text = "OS2Indberetning", TextColor = Color.FromHex(Definitions.TextColor), FontSize = Definitions.HeaderFontSize - 8, 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, Children = { backButton, header, filler } }; var usernameLabel = new Label { Text = _usernamePlaceholder, TextColor = Color.FromHex(Definitions.DefaultTextColor), }; var username = new Entry { HorizontalOptions = LayoutOptions.FillAndExpand, TextColor = Color.FromHex(Definitions.DefaultTextColor), }; username.SetBinding(Entry.TextProperty, CouplingViewModel.UsernameProperty); var pwLabel = new Label { Text = _pwPlaceholder, TextColor = Color.FromHex(Definitions.DefaultTextColor), }; var pw = new Entry { HorizontalOptions = LayoutOptions.FillAndExpand, TextColor = Color.FromHex(Definitions.DefaultTextColor), IsPassword = true, }; pw.SetBinding(Entry.TextProperty, CouplingViewModel.PasswordProperty); pw.Completed += (sender, args) => { SendCoupleMessage(); }; var informationText = new Label { Text = "Du skal oprette et password for at logge ind på app'en. \n\n" + "Passwordet opretter du i OS2Indberetning under Personlige Indstillinger: Adgangskode til app.\n\n" + "Her finder du også dit brugernavn, som er dine initialer.\n", HorizontalOptions = LayoutOptions.Center, TextColor = Color.FromHex(Definitions.DefaultTextColor), FontSize = Definitions.InformationFontSize, }; var version = new Label { Text = "version " + Definitions.VersionNumber, TextColor = Color.FromHex(Definitions.DefaultTextColor), HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.EndAndExpand, YAlign = TextAlignment.Center, }; var textFrame = new StackLayout { Padding = Definitions.Padding, VerticalOptions = LayoutOptions.StartAndExpand, Children = { informationText } }; var coupleButton = new ButtomButton("Log Ind", SendCoupleMessage); var buttomStack = new StackLayout { VerticalOptions = LayoutOptions.Start, Padding = Definitions.Padding, Spacing = 2, HeightRequest = Definitions.ButtonHeight, Children = { coupleButton } }; var layout = new StackLayout { Children = { headerstack, usernameLabel, username, pwLabel, pw, buttomStack, textFrame, version }, BackgroundColor = Color.FromHex(Definitions.BackgroundColor), }; return layout; }
/// <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 page layout and sets the page content, to that layout /// </summary> public void SetContent() { var header = new Label { Text = "Vælg Formål", TextColor = Color.FromHex(Definitions.TextColor), FontSize = Definitions.HeaderFontSize, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; var addButton = new AddButton(SendAddMessage); var backButton = new BackButton(SendBackMessage); var headerstack = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.FromHex(Definitions.PrimaryColor), HeightRequest = Definitions.HeaderHeight, Children = { backButton, header, addButton } }; var list = new ListView { ItemTemplate = new DataTemplate(typeof(GenericCell)), SeparatorColor = Color.FromHex("#EE2D2D"), SeparatorVisibility = SeparatorVisibility.Default, }; list.SetBinding(ListView.ItemsSourceProperty, PurposeViewModel.PurposeListProperty, BindingMode.TwoWay); list.GestureRecognizers.Add(new TapGestureRecognizer { NumberOfTapsRequired = 2, Command = new Command((o) => { if (list.SelectedItem != null) { SendDeleteMessage(); } }) }); list.ItemSelected += (sender, args) => { var item = (GenericCellModel) args.SelectedItem; if (item == null) return; item.Selected = true; Selected = item; SendSelectedMessage(); }; var layout = new StackLayout { BackgroundColor = Color.FromHex(Definitions.BackgroundColor), }; var entry = new Entry { Placeholder = _placeholder, HorizontalOptions = LayoutOptions.FillAndExpand, TextColor = Color.FromHex(Definitions.DefaultTextColor), }; entry.SetBinding(Entry.TextProperty, PurposeViewModel.PurposeStringProperty); var addPurpose = new Button { Text = "Tilføj", BorderColor = Color.FromHex(Definitions.PrimaryColor), TextColor = Color.FromHex(Definitions.TextColor), BackgroundColor = Color.FromHex(Definitions.PrimaryColor), HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, AnchorY = (double)TextAlignment.Center, FontSize = 20, }; addPurpose.SetBinding(Button.CommandProperty, PurposeViewModel.AddPurposeCommand); var addStack = new StackLayout { Padding = new Thickness(Definitions.Padding, 0, Definitions.Padding, 0), Spacing = Definitions.Padding, Orientation = StackOrientation.Horizontal, Children = { entry, addPurpose } }; addStack.SetBinding(StackLayout.IsVisibleProperty, PurposeViewModel.HideFieldProperty); var textlabel = new Label { Text = "Dobbelt tryk for at slette formål", TextColor = Color.FromHex(Definitions.DefaultTextColor), Opacity = 0.6, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.End, }; layout.Children.Add(headerstack); layout.Children.Add(addStack); layout.Children.Add(list); layout.Children.Add((textlabel)); this.Content = layout; }
/// <summary> /// Method that creates a layout for the page and sets it as the page content /// </summary> public void SetContent() { var header = new Label { // View title Text = "Vælg Organisatorisk Placering", TextColor = Color.FromHex(Definitions.TextColor), FontSize = Definitions.HeaderFontSize - 13, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; // Backbutton var backButton = new BackButton(SendBackMessage); var filler = new Filler(); backButton.WidthRequest = backButton.WidthRequest - 40; filler.WidthRequest = backButton.WidthRequest; // Navigation Bar var headerstack = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.FromHex(Definitions.PrimaryColor), HeightRequest = Definitions.HeaderHeight, Children = { backButton, header, filler } }; // Item List var list = new ListView { ItemTemplate = new DataTemplate(typeof(GenericCell)), SeparatorColor = Color.FromHex("#000000"), SeparatorVisibility = SeparatorVisibility.Default, }; list.SetBinding(ListView.ItemsSourceProperty, OrganizationViewModel.OrganizationListProperty, BindingMode.TwoWay); list.ItemSelected += (sender, args) => { var item = (GenericCellModel) args.SelectedItem; if (item == null) return; item.Selected = true; Selected = item; SendSelectedMessage(); }; var layout = new StackLayout { BackgroundColor = Color.FromHex(Definitions.BackgroundColor), }; layout.Children.Add(headerstack); layout.Children.Add(list); this.Content = layout; }