//
// Copyright (c) 2015, MindFusion LLC - Bulgaria.
//

using System;
using System.Windows;
using System.Windows.Controls;


namespace MindFusion.Reporting.Wpf.Samples.CS.Portfolio
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
		public MainWindow()
		{
			InitializeComponent();

			nwindDataSet dataSet = new nwindDataSet();
			nwindDataSetTableAdapters.EmployeesTableAdapter employeesAdapter =
				new nwindDataSetTableAdapters.EmployeesTableAdapter();
			employeesAdapter.Fill(dataSet.Employees);

			Report report = Report.FromDictionary(new Uri("PortfolioReport.xaml", UriKind.Relative), "portfolio");
			report.DataContext = dataSet;
			report.Run();

			ReportLayout layout = report.Layout(new Size(8.5 * 96, 11 * 96),
				new Thickness(0.5 * 96), PageOrientation.Landscape);

			FixedDocumentRenderTarget renderTarget = new FixedDocumentRenderTarget();
			layout.RenderAllPages(renderTarget);

			viewer.Document = renderTarget.Document;
		}
	}
}
