Ejemplo n.º 1
0
        private void pdfExportSearchedClick(object sender, RoutedEventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.Filter = "PDF(*.pdf)|*.pdf";
            dialog.ShowDialog();
            string path = dialog.FileName;

            ArrayList bandsToPdf = new ArrayList();
            var       queryBands = bandListView.ItemsSource;

            foreach (var band in queryBands)
            {
                Band bandToProcess = (Band)band;
                bandsToPdf.Add(band);
            }
            try
            {
                PdfExport.processBandsToPdf(bandsToPdf, path, 12);
            }
            catch
            {
                this.NavigationService.Navigate(new BandsAdmin());
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Export data tables to PDF.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void exportPDF(object sender, RoutedEventArgs e)
        {
            try
            {
                SaveFileDialog dialog = new SaveFileDialog();
                dialog.Filter = "PDF(*.pdf)|*.pdf";
                dialog.ShowDialog();
                string path = dialog.FileName;



                List <Band> bands;
                ArrayList   bandsToPdf = new ArrayList();

                using (var db = new LiteDatabase(LiteDbConnection.getDbName()))
                {
                    var dbBands = db.GetCollection <Band>("Bands");
                    bands = dbBands.FindAll().ToList();

                    foreach (Band bandToProcess in bands)
                    {
                        bandsToPdf.Add(bandToProcess);
                    }

                    PdfExport.processBandsToPdf(bandsToPdf, path, 12);
                }
            }
            catch (Exception ex)
            {
                this.NavigationService.Navigate(new BandsAdmin());
            }
        }