private TableSection CreateOfficeTableSection() { var officeTableSection = new TableSection(LanguageFile.GetString("officeheader")); IEnumerable <Cell> CreateOfficeCells() { foreach (var office in Therapist.Therapist.Offices.Distinct()) { yield return(CreateOfficeCell(office)); } } officeTableSection.Add(CreateOfficeCells()); return(officeTableSection); }
private IEnumerable <TableSection> CreateQualificationTableSections() { var groupedQualifications = Therapist.Therapist.Qualifications.GroupBy(q => q.Category).ToList(); foreach (var groupedQualification in groupedQualifications) { var qualiesInGroup = groupedQualification.SelectMany(g => g.Content).Select(q => new TextCell { Text = LanguageFile.TranslateQualityName(q), TextColor = BlueGray }).ToList(); var title = LanguageFile.TranslateCategory(groupedQualification.Key); title = $"{LanguageFile.GetString("qualifications")} - {title}"; var section = new TableSection(title) { qualiesInGroup }; yield return(section); } }
private TableSection CreateLanguageTableSection() { var tableSection = new TableSection(LanguageFile.GetString("language")); var textCells = Therapist.Therapist.Languages.Select(l => LanguageFile.TranslateLanguage(l)).Select(l => new TextCell { Text = l, TextColor = BlueGray }).ToArray(); if (textCells.Any()) { tableSection.Add(textCells); } else { tableSection.Add(new TextCell { Text = LanguageFile.GetString("nolanguages"), TextColor = FadedBlueGray }); } return(tableSection); }
private TableSection CreateOverallContactTableSection() { var tableSection = new TableSection(LanguageFile.GetString("contactheader")); IEnumerable <TextCell> textCells; if (Therapist.Therapist.TelefoneNumbers.Any()) { textCells = Therapist.Therapist.TelefoneNumbers.Select(GetTextCellFromTelefoneNumber); } else { textCells = Enumerable.Repeat(new TextCell { Text = LanguageFile.GetString("nocontactinformation"), TextColor = FadedBlueGray }, 1); } tableSection.Add(textCells); return(tableSection); }
private Cell CreateOfficeCell(Office office) { var containerCell = new ViewCell(); var containerStack = new StackLayout(); var stackLayout = new StackLayout { Margin = new Thickness(20, 0, 0, 0), BackgroundColor = InnerBGColor }; containerCell.View = containerStack; { Grid grid = new Grid() { BindingContext = ContainerBGColor }; var fontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)); var label = new Label { Text = office.Address.FullAddress.Replace(Environment.NewLine, ""), Margin = new Thickness(10, 0, 0, 0), FontAttributes = FontAttributes.Bold, TextColor = Color.CornflowerBlue, FontSize = fontSize }; var gestureRecognizer = new TapGestureRecognizer(); gestureRecognizer.Tapped += (o, e) => OpenMap(office.Location, Therapist.Therapist.FullName); label.GestureRecognizers.Add(gestureRecognizer); grid.Children.Add(label); containerStack.Children.Add(grid); } containerStack.Children.Add(stackLayout); if (office.TelefoneNumbers.Any()) { var label = new Label { Text = LanguageFile.GetString("contact"), FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) }; stackLayout.Children.Add(label); foreach (var telefoneNumber in office.TelefoneNumbers) { var text = $"{LanguageFile.TranslateContactType(telefoneNumber.Type)}: {telefoneNumber.Number}"; var fontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) + 2; var phoneLabel = new Label { Text = text, TextColor = Blue, FontSize = fontSize }; var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (o, e) => OpenTelefoneNumber(telefoneNumber); phoneLabel.GestureRecognizers.Add(tapGestureRecognizer); stackLayout.Children.Add(phoneLabel); } } if (office.OfficeHours.Any()) { var label = new Label { Text = LanguageFile.GetString("officehours"), FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) }; stackLayout.Children.Add(label); var grid = new Grid { Margin = new Thickness(20, 0, 0, 0) }; grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); for (var i = 0; i < office.OfficeHours.Count; i++) { var officeHour = office.OfficeHours[i]; grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); var translateDayOfWeek = LanguageFile.TranslateDayOfWeek(officeHour.DayOfWeek); var text = $"{officeHour.From:HH:mm} - {officeHour.To:HH:mm}"; var fontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) + 2; var dayLabel = new Label { Text = translateDayOfWeek, TextColor = BlueGray, FontSize = fontSize }; var timeLabel = new Label { Text = text, TextColor = BlueGray, FontSize = fontSize }; grid.Children.Add(dayLabel); grid.Children.Add(timeLabel); Grid.SetRow(dayLabel, i); Grid.SetRow(timeLabel, i); Grid.SetColumn(timeLabel, 1); } stackLayout.Children.Add(grid); } if (office.ContactTimes.Any()) { var label = new Label { Text = LanguageFile.GetString("contacttimes"), FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)) }; stackLayout.Children.Add(label); foreach (var contactTime in office.ContactTimes) { { var text = $"{LanguageFile.TranslateContactType(contactTime.TelefoneNumber.Type)}: {contactTime.TelefoneNumber.Number}"; var fontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) + 2; var phoneLabel = new Label { Text = text, TextColor = Blue, FontSize = fontSize }; var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (o, e) => OpenTelefoneNumber(contactTime.TelefoneNumber); phoneLabel.GestureRecognizers.Add(tapGestureRecognizer); stackLayout.Children.Add(phoneLabel); } var grid = new Grid { Margin = new Thickness(20, 0, 0, 0) }; grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); for (var i = 0; i < contactTime.OfficeHours.Count; i++) { var officeHour = contactTime.OfficeHours[i]; grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); var translateDayOfWeek = LanguageFile.TranslateDayOfWeek(officeHour.DayOfWeek); var text = $"{officeHour.From:HH:mm} - {officeHour.To:HH:mm}"; var fontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)) + 2; var dayLabel = new Label { Text = translateDayOfWeek, TextColor = BlueGray, FontSize = fontSize }; var timeLabel = new Label { Text = text, TextColor = BlueGray, FontSize = fontSize }; grid.Children.Add(dayLabel); grid.Children.Add(timeLabel); Grid.SetColumn(timeLabel, 1); Grid.SetRow(timeLabel, i); Grid.SetRow(dayLabel, i); } stackLayout.Children.Add(grid); } } return(containerCell); }