public List <ExpertUitvoer> MaakCanvasTegelRaport(bool saveneeded, DateTime printDatum)
        {
            page_nr = -1;
            Acumulator.Instance().PrevPrintDatum = printDatum;
            var ctx        = Acumulator.Instance().ctx;
            var PageBreaks = CalculateTegelPages();
            var Pages      = new List <ExpertUitvoer>();
            //Ruimtes
            int ruimteCntr = 0;


            foreach (Ruimte r in Acumulator.Instance().OTracker.offerteRuimte_.Children)
            {
                ruimteCntr++;
                ExpertUitvoer np;
                var           newpage = new ExpertUitvoer();
                newpage.InitNewPage(saveneeded, printDatum);
                Pages.Add(newpage);
                page_nr++;
                newpage.SetPaginaNR(totalPages, page_nr);


                if (newpage != null)
                {
                    if (newpage.InitNewRuimte(ruimteCntr, r))
                    {
                        var custsrt = new UitvoerComparer <IOfferte>();
                        r.GekozenTegels.Sort(custsrt);

                        if (!newpage.AddPaginaBlok(MakeTegelBlok(r, "HC1")))
                        {
                            newpage = new ExpertUitvoer();
                            newpage.InitNewPage(saveneeded, printDatum);
                            Pages.Add(newpage);
                            page_nr++;
                            newpage.SetPaginaNR(totalPages, page_nr);
                        }
                        if (!newpage.AddPaginaBlok(MakeAccentBlok(r, "HC1")))
                        {
                            newpage = new ExpertUitvoer();
                            newpage.InitNewPage(saveneeded, printDatum);
                            Pages.Add(newpage);
                            page_nr++;
                            newpage.SetPaginaNR(totalPages, page_nr);
                        }
                        if (!newpage.AddPaginaBlok(MakeHoekProfielBlok(r)))
                        {
                            newpage = new ExpertUitvoer();
                            newpage.InitNewPage(saveneeded, printDatum);
                            Pages.Add(newpage);
                            page_nr++;
                            newpage.SetPaginaNR(totalPages, page_nr);
                        }
                        if (!newpage.AddPaginaBlok(MakeTegelBlok(r, "HC2")))
                        {
                            newpage = new ExpertUitvoer();
                            newpage.InitNewPage(saveneeded, printDatum);
                            Pages.Add(newpage);
                            page_nr++;
                            newpage.SetPaginaNR(totalPages, page_nr);
                        }
                        if (!newpage.AddPaginaBlok(MakeAccentBlok(r, "HC2")))
                        {
                            newpage = new ExpertUitvoer();
                            newpage.InitNewPage(saveneeded, printDatum);
                            Pages.Add(newpage);
                            page_nr++;
                            newpage.SetPaginaNR(totalPages, page_nr);
                        }
                        if (!newpage.AddPaginaBlok(MakeDorpelBlok(r)))
                        {
                            newpage = new ExpertUitvoer();
                            newpage.InitNewPage(saveneeded, printDatum);
                            Pages.Add(newpage);
                            page_nr++;
                            newpage.SetPaginaNR(totalPages, page_nr);
                        }
                    }
                    else
                    {
                        Pages.Remove(newpage);
                    }
                }
            }
            return(Pages);
        }
        private List <ExpertUitvoer> MaakCanvasPlattegrond(bool saveneeded, DateTime printDatum)
        {
            var Pages = new List <ExpertUitvoer>();
            var ctx   = Acumulator.Instance().ctx;

            foreach (Ruimte R in Acumulator.Instance().OTracker.offerteRuimte_.Children.Where(x => (x as Ruimte).GekozenPakket != null))
            {
                R.SwitchBluePrint();
                byte[] bytes = null;
                //var ruimtesetkey = "";
                //var bpPath = "";
                var waitcntr = 0;
                while (Acumulator.Instance().bluePrintManager.GetBlueprintStatus(R.RuimteID) == BluePrintStatus.Downloading && waitcntr < 150)
                {
                    System.Threading.Thread.Sleep(200);
                    waitcntr++;
                }

                if (Acumulator.Instance().bluePrintManager.GetBlueprintStatus(R.RuimteID) == BluePrintStatus.Complete)
                {
                    bytes = Acumulator.Instance().bluePrintManager.getBlueprintData(R.RuimteID, false);
                    if (bytes != null)
                    {
                        var np = new ExpertUitvoer();
                        np.InitNewPage(saveneeded, printDatum);
                        page_nr++;
                        np.SetPaginaNR(totalPages, page_nr);
                        Pages.Add(np);

                        using (MemoryStream ms = new MemoryStream(bytes, 0, bytes.Length))
                        {
                            BitmapImage im = new BitmapImage();
                            im.SetSource(ms);
                            var BlueprintImg = new Image();
                            BlueprintImg.Source = im;
                            BlueprintImg.Width  = 707;
                            BlueprintImg.Height = 750;
                            //function to add blueprint
                            var roms = R.Omschrijving + (R.spiegel ? "(Gespiegeld)" : "");
                            np.AddBluePrint(BlueprintImg, roms);
                            //  Pages.Last().LayoutRoot.Children.Add(BlueprintImg);

                            //tie into previous function?
                            // Pages.Last().SetTitle("Tekeningen", roms);
                            //Canvas.SetLeft(BlueprintImg, 45);
                            //Canvas.SetTop(BlueprintImg, 218);
                        }
                    }
                }
                else
                {
                    //show no img available
                    var np = new ExpertUitvoer();
                    np.InitNewPage(saveneeded, printDatum);
                    np.SetPaginaNR(totalPages, page_nr);
                    Pages.Add(np);
                    var warningMsg = new TextBlock()
                    {
                        Text       = "Plattegrond is tijdenlijk niet beschikbaar.\nDeze is via email opvraagbaar bij zeebregts.",
                        FontFamily = new FontFamily("Lucida Grande"),
                        FontSize   = 20,
                        Margin     = new Thickness(5),
                    };
                    //Pages.Last().LayoutRoot.Children.Add(warningMsg);
                    var roms = R.Omschrijving + (R.spiegel ? "(Gespiegeld)" : "");
                    //Pages.Last().SetTitle("Tekeningen", roms);
                    //Canvas.SetLeft(warningMsg, 45);
                    //Canvas.SetTop(warningMsg, 218);
                }
            }
            return(Pages);
        }