/// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PDFExport_Click(object sender, RoutedEventArgs e)
        {
            MainGrid.IsHitTestVisible = false;
            MainGrid.Opacity          = 0.5;
            //progress.Visibility = Windows.UI.Xaml.Visibility.Visible;

            //await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, (() =>
            //    {
            //        PdfExport export = new PdfExport();
            //        export.CreatePDF(m_items, m_billInfo, TotalDue);
            //    }));

            if (m_items.Count > 0)
            {
                PdfExport export = new PdfExport();
                export.CreatePDF(m_items, m_billInfo, TotalDue);
            }
            else
            {
                MessageBox.Show("No invoice items found to generate the report!", "Export Cancelled");
            }

            MainGrid.IsHitTestVisible = true;
            MainGrid.Opacity          = 1;
            //progress.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
        }
Beispiel #2
0
        private void btnPdf_Click(object sender, EventArgs e)
        {
            if (dgvItems.Rows.Count > 0)
            {
                PdfExport export = new PdfExport();
                export.CreatePDF(m_items, m_billInfo, TotalDue);

                //Message box confirmation to view the created PDF document.
                if (MessageBox.Show("Do you want to view the PDF file?", "PDF File Created", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    //Launching the PDF file using the default Application.[Acrobat Reader]
#if !NETCORE
                    System.Diagnostics.Process.Start("Invoice.pdf");
#else
                    ProcessStartInfo psi = new ProcessStartInfo
                    {
                        FileName        = "cmd",
                        WindowStyle     = ProcessWindowStyle.Hidden,
                        UseShellExecute = false,
                        CreateNoWindow  = true,
                        Arguments       = "/c start Invoice.pdf"
                    };
                    Process.Start(psi);
#endif
                }
            }
            else
            {
                MessageBox.Show("No invoice items found to generate the report!", "Export Cancelled",
                                MessageBoxButtons.OK);
            }
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void PDFExport_Click(object sender, RoutedEventArgs e)
        {
            MainGrid.IsHitTestVisible = false;
            MainGrid.Opacity          = 0.5;
            progress.Visibility       = Windows.UI.Xaml.Visibility.Visible;

            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, (() =>
            {
                PdfExport export = new PdfExport();
                export.CreatePDF(m_items, m_billInfo, TotalDue);
            }));

            MainGrid.IsHitTestVisible = true;
            MainGrid.Opacity          = 1;
            progress.Visibility       = Windows.UI.Xaml.Visibility.Collapsed;
        }