public void ShowPrint(Date date, List <Work> works, List <Attendance> attendances, List <Changeover> changeovers) { PrintDialog print = new PrintDialog(); FixedDocument document = CreateDocument.Create(date, works, attendances, changeovers); print.UserPageRangeEnabled = true; if (print.ShowDialog() == true) { print.PrintDocument(document.DocumentPaginator, "Výkaz práce"); } }
public void ShowPreview(Date date, List <Work> works, List <Attendance> attendances, List <Changeover> changeovers) { PrintPrewiev prewiev = new PrintPrewiev() { Document = CreateDocument.Create(date, works, attendances, changeovers) }; prewiev.Description = "Výkaz práce"; (prewiev.Template.FindName("PART_FindToolBarHost", prewiev) as ContentControl).Visibility = Visibility.Collapsed; var window = new Window(); window.Owner = Parent.View; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; window.Content = prewiev; window.Icon = new BitmapImage(new Uri("pack://application:,,,/Images/preview.png", UriKind.RelativeOrAbsolute)); window.Show(); }