private View DC2Audio(EbMobileDataColumn dc, object value) { EbPlayButton audioButton = new EbPlayButton(dc) { Style = (Style)HelperFunctions.GetResourceValue("ListViewAudioButton"), IsEnabled = !(value == null) }; audioButton.SetDimensions(dc); if (value != null) { audioButton.SetValue(value); audioButton.Clicked += (sender, e) => { Page current = App.Navigation.GetCurrentPage(); if (current is IListRenderer ls) { ls.ShowAudioFiles((EbPlayButton)sender); } }; } return(audioButton); }
public EbPlayButton(EbMobileDataColumn dc) { BackgroundColor = Color.FromHex(dc.BackgroundColor ?? "#ffffff00"); BorderColor = Color.FromHex(dc.BorderColor ?? "#ffffff00"); CornerRadius = dc.BorderRadius; BorderWidth = dc.BorderThickness; if (dc.Font == null) { FontSize = 14; TextColor = Color.Green; } else { FontSize = dc.Font.Size <= 0 ? 14 : dc.Font.Size; TextColor = Color.FromHex(dc.Font.Color); } Padding = dc.Padding == null ? 0 : dc.Padding.ConvertToXValue(); if (dc.Width > 0) { this.WidthRequest = dc.Width; } if (dc.Height > 0) { this.HeightRequest = dc.Height; } }
public EbListViewButton(EbMobileDataColumn dc) { if (!string.IsNullOrEmpty(dc.BackgroundColor)) { BackgroundColor = Color.FromHex(dc.BackgroundColor); } if (!string.IsNullOrEmpty(dc.BorderColor)) { BorderColor = Color.FromHex(dc.BorderColor); } CornerRadius = dc.BorderRadius; BorderWidth = dc.BorderThickness; Padding = dc.Padding == null ? 0 : dc.Padding.ConvertToXValue(); if (dc.Width > 0) { this.WidthRequest = dc.Width; } if (dc.Height > 0) { this.HeightRequest = dc.Height; } SetText(dc); if (dc.Font != null) { this.FontSize = dc.Font.Size; this.TextColor = Color.FromHex(dc.Font.Color ?? "#333333"); } }
private void SetText(EbMobileDataColumn dc) { this.TextTransform = TextTransform.None; if (string.IsNullOrEmpty(dc.TextFormat)) { this.FontFamily = (OnPlatform <string>)HelperFunctions.GetResourceValue("FontAwesome"); this.Text = "\uf041"; } else { this.Text = dc.TextFormat; } }
private View DC2Map(EbMobileDataColumn dc, object value) { EbListViewButton mapbtn = new EbListViewButton(dc); mapbtn.Clicked += async(sender, args) => { if (value == null) { Utils.Toast("location info empty"); return; } await NativeLauncher.OpenMapAsync(value?.ToString()); }; return(mapbtn); }
public void SetDimensions(EbMobileDataColumn dc) { if (dc.VerticalAlign == MobileVerticalAlign.Fill) { this.CalcHeight = true; } else { this.HeightRequest = dc.Height; } if (dc.HorrizontalAlign != MobileHorrizontalAlign.Fill) { this.WidthRequest = dc.Width; } }
private View DC2PhoneNumber(EbMobileDataColumn dc, object value) { EbXLabel label = new EbXLabel(dc) { Text = dc.GetContent(value) }; label.SetFont(dc.Font, this.IsHeader); label.SetTextWrap(dc.TextWrap); TapGestureRecognizer gesture = new TapGestureRecognizer(); gesture.Tapped += (sender, args) => NativeLauncher.OpenDialerAsync(label.Text); label.GestureRecognizers.Add(gesture); return(label); }
private View DC2Email(EbMobileDataColumn dc, object value) { EbXLabel label = new EbXLabel(dc) { Text = dc.GetContent(value) }; label.SetFont(dc.Font, this.IsHeader); label.SetTextWrap(dc.TextWrap); TapGestureRecognizer gesture = new TapGestureRecognizer(); gesture.Tapped += async(sender, args) => await NativeLauncher.OpenEmailAsync(value?.ToString()); label.GestureRecognizers.Add(gesture); return(label); }
private View DC2Image(EbMobileDataColumn dc, object value) { EbListViewImage image = new EbListViewImage(dc) { Style = (Style)HelperFunctions.GetResourceValue("ListViewImage") }; image.SetValue(value); image.Clicked += (sender, args) => { if (App.Navigation.GetCurrentPage() is IListRenderer rendrer) { rendrer.ShowFullScreenImage(image.Source); } }; return(image); }
public EbListViewImage(EbMobileDataColumn dc) { this.CornerRadius = dc.BorderRadius; this.BorderColor = Color.FromHex(dc.BorderColor ?? "#ffffff00"); this.BorderWidth = dc.BorderThickness; this.Padding = 0; if (dc.Width > 0) { this.WidthRequest = dc.Width; } if (dc.Height > 0) { this.HeightRequest = dc.Height; } if (dc.VerticalAlign == MobileVerticalAlign.Fill) { this.CalcHeight = true; } }
private void FillTableColums(MobileTableRow row, List <EbMobileTableCell> CellCollection) { foreach (EbMobileTableCell cell in CellCollection) { if (cell.ControlCollection.Count > 0) { EbMobileDataColumn column = (EbMobileDataColumn)cell.ControlCollection[0]; MobileTableColumn tableColumn = row[column.ColumnName]; if (tableColumn != null) { var value = tableColumn.DisplayValue ?? tableColumn.Value; EbXLabel label = new EbXLabel(column) { Text = value?.ToString(), VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, XBackgroundColor = Color.Transparent }; XViewExtensions.SetTextAlignment(label, column.HorrizontalTextAlign, column.VerticalTextAlign); if (IsHeader) { label.FontFamily = (OnPlatform <string>)HelperFunctions.GetResourceValue("Roboto-Medium"); label.LineBreakMode = LineBreakMode.WordWrap; } else { label.SetFont(column.Font, this.IsHeader); label.SetTextWrap(column.TextWrap); } DynamicGrid.SetPosition(label, cell.RowIndex, cell.ColIndex, column.RowSpan, column.ColumnSpan); } } } }
private View ResolveRenderType(EbMobileDataColumn dc, object value) { View view; switch (dc.RenderAs) { case DataColumnRenderType.Image: view = this.DC2Image(dc, value); break; case DataColumnRenderType.MobileNumber: view = this.DC2PhoneNumber(dc, value); break; case DataColumnRenderType.Map: view = this.DC2Map(dc, value); break; case DataColumnRenderType.Email: view = this.DC2Email(dc, value); break; case DataColumnRenderType.Audio: view = this.DC2Audio(dc, value); break; default: EbXLabel label = new EbXLabel(dc) { Text = dc.GetContent(value) }; label.SetFont(dc.Font, this.IsHeader); label.SetTextWrap(dc.TextWrap); view = label; break; } return(view); }