public bool InitNewRuimte(int ruimteCntr, Ruimte r) { var ctx = Acumulator.Instance().ctx; var nabew = r.qryNabewerkingen(ctx); ArticleRowCounter++; ContentGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); var secndlinetext = ""; if (nabew.Count == 0) { return(false); //skip if empty //secndlinetext = "Geen tegelwerk"; //MessageBox.Show("geentegelwerk"); } else { var tbP = new TextBlock // product text { FontFamily = new FontFamily("Lucida Grande"), FontSize = 14, FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new Thickness(45, 15, 0, 15), Text = Acumulator.Instance().MaakStartZin(r.Omschrijving) }; tbP.SetValue(Grid.ColumnProperty, 0); tbP.SetValue(Grid.RowProperty, ArticleRowCounter); ContentGrid.Children.Add(tbP); //tegel hoogte var tegelh = (from h in r.Children where h.GetType() == typeof(Classes.SubCatPerRuimteDeel) && (h as Classes.SubCatPerRuimteDeel).SubCatNR == "SCB4" select(h as Classes.SubCatPerRuimteDeel).Meters).Sum(); if (r.PlafondHoogte == tegelh) { secndlinetext = "Betegelen tot plafond"; } else if (tegelh > 0) { secndlinetext = "Betegelen tot " + tegelh + "mm"; } else { var ruimtenaam = (from br in ctx.Bron_Ruimtes where br.R_NR == r.RuimteID select br.RuimteNaam).FirstOrDefault(); secndlinetext = "Betegelen " + ruimtenaam; } ArticleRowCounter++; ContentGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); var tb0 = new TextBlock { FontFamily = new FontFamily("Lucida Grande"), FontSize = 12, FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new Thickness(0, 0, 45, 0), Text = "Info" }; tb0.SetValue(Grid.ColumnProperty, 1); tb0.SetValue(Grid.RowProperty, ArticleRowCounter); ContentGrid.Children.Add(tb0); } ArticleRowCounter++; ContentGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); var tb1 = new TextBlock // product text { FontFamily = new FontFamily("Lucida Grande"), FontSize = 12, //FontWeight = FontWeights.Bold, TextWrapping = TextWrapping.Wrap, HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new Thickness(0, 0, 45, 0), Text = secndlinetext, }; tb1.SetValue(Grid.ColumnProperty, 1); tb1.SetValue(Grid.RowProperty, ArticleRowCounter); ContentGrid.Children.Add(tb1); ArticleRowCounter++; return(true); }
public bool AddPaginaBlok(PaginaBlok pb) { for (int i = 0; i < pb.TextRegels.Count; i++) { var newRow = new RowDefinition { Height = GridLength.Auto }; var tbO = new TextBlock // kantlijn text { FontFamily = new FontFamily("Lucida Grande"), FontSize = 12, FontWeight = FontWeights.Normal, TextWrapping = TextWrapping.NoWrap, HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new Thickness(45, 0, 0, 0), Text = pb.KantlijnRegels[i] }; tbO.SetValue(Grid.ColumnProperty, 0); tbO.SetValue(Grid.RowProperty, ArticleRowCounter); var tbP = new TextBlock // product text { FontFamily = new FontFamily("Lucida Grande"), FontSize = 12, TextWrapping = TextWrapping.Wrap, FontWeight = pb.BoolRegels[i] == true ? FontWeights.Bold : FontWeights.Normal, HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new Thickness(0, 0, 45, 0), Text = pb.TextRegels[i] }; tbP.SetValue(Grid.ColumnProperty, 1); tbP.SetValue(Grid.RowProperty, ArticleRowCounter); ContentGrid.RowDefinitions.Add(newRow); ContentGrid.Children.Add(tbP); ContentGrid.Children.Add(tbO); ArticleRowCounter++; } var retval = true; if (ArticleRowCounter > 24) { retval = false; //add extra empty row var tbP = new TextBlock // product text { FontFamily = new FontFamily("Lucida Grande"), FontSize = 12, TextWrapping = TextWrapping.Wrap, FontWeight = FontWeights.Normal, HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Top, Margin = new Thickness(0, 0, 45, 0), Text = Environment.NewLine }; var newRow = new RowDefinition { Height = GridLength.Auto }; tbP.SetValue(Grid.ColumnProperty, 1); tbP.SetValue(Grid.RowProperty, ArticleRowCounter); ContentGrid.RowDefinitions.Add(newRow); ContentGrid.Children.Add(tbP); ArticleRowCounter++; } return(retval); }