private void ShowCardView() { PhotoCardInformation info = new PhotoCardInformation() { TopLeftImage = this.image1.Source, TopRightImage = this.image2.Source, BottomLeftImage = this.image3.Source, BottomRightImage = this.image4.Source, BottomVerticalText = this.CardBottomVerticalText, TopVerticalText = this.CardTopVerticalText, BannerText = this.CardBannerText }; CardView cardView = new CardView(); cardView.SizeToContent = SizeToContent.Manual; cardView.DataContext = info; cardView.ShowDialog(); }
private CardView CreateCardView() { PhotoCardInformation info = new PhotoCardInformation() { TopLeftImage = this.image1.Source, TopRightImage = this.image2.Source, BottomLeftImage = this.image3.Source, BottomRightImage = this.image4.Source, BottomVerticalText = this.BottomVerticalText, TopVerticalText = this.TopVerticalText, BannerText = this.BannerText }; CardView cardView = new CardView(); cardView.DataContext = info; return(cardView); }
private void PrintCard() { this.StatusText = PrintingPrompt; PrintDialog printDlg = new PrintDialog(); if (this.PrinterSetupTicket != null) { printDlg.PrintTicket = this.PrinterSetupTicket; } double width = printDlg.PrintableAreaWidth; double height = printDlg.PrintableAreaHeight; CardView cardView = this.CreateCardView();; cardView.Width = width; cardView.Height = height; cardView.Show(); if (this.SaveCards && this.SaveFileLocation.Exists) { string fileName = GetNextCardFileName(); Byte[] jpeg = cardView.GetJpgImage(2.0, 95, Constants.ScreenDPI); System.IO.File.WriteAllBytes(fileName, jpeg); } UIElement content = cardView.RootVisual; FixedDocument document = DocumentUtility.CreateFixedDocument(width, height, content); printDlg.PrintDocument(document.DocumentPaginator, "Photo Booth"); cardView.Close(); // Wait so photo capture doesn't get too far ahead of the printer. System.Threading.Thread.Sleep(PrintingDelay); this.SetStartPrompt(); }