Exemplo n.º 1
0
        private void btnPrintPDF_OnClick(object sender, RoutedEventArgs e)
        {
            PassFile file = (sender as Button).DataContext as PassFile;

            PrintPDF(file);
            Clear();
        }
Exemplo n.º 2
0
        private void grdPDFs_OnSelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            PassFile file = grdPDFs.SelectedItem as PassFile;

            if (file != null)
            {
                PreviewPDF(file);
            }
        }
Exemplo n.º 3
0
        private void PreviewPDF(PassFile file)
        {
            MainWindowStackPanel.IsEnabled = false;
            string fileName = $"{PDFDirectory.FullName}\\{file.FileName}";

            Uri url = new Uri($"file:///{fileName}", UriKind.Absolute);

            PDFPreview.Navigate(url);
            PDFPreview.Visibility = Visibility.Visible;
        }
Exemplo n.º 4
0
        private void btnPrintPDF_OnClick(object sender, RoutedEventArgs e)
        {
            PassFile file = (sender as Button).DataContext as PassFile;

            if (file != null)
            {
                PrintPDF(file);
                lblMessage.Content = $"{file.FullName}, your pass is in the queue to be printed!";
                Clear();
            }
        }
Exemplo n.º 5
0
        private void grdPDFs_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            PassFile file = grdPDFs.SelectedItem as PassFile;

            if (file != null && MessageBox.Show($"Are you sure that you want to print the pass for {file.FullName}?",
                                                "Confirm", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                PrintPDF(file);
                lblMessage.Content = $"{file.FullName}, your pass is in the queue to be printed!";
                Clear();
            }
        }
Exemplo n.º 6
0
        private void OpenPDF(PassFile file)
        {
            string fileName = $"{PDFDirectory.FullName}\\{file.FileName}";

            Process process = new Process
            {
                StartInfo = { FileName = fileName }
            };

            process.Start();
            process.WaitForExit();
            txtInput.Focus();
        }
Exemplo n.º 7
0
        private void PreviewPDF(PassFile file)
        {
            try
            {
                MainWindowStackPanel.IsEnabled = false;
                string fileName = file.GetFullPath(PDFDirectory);

                Uri url = new Uri($"file:///{fileName}", UriKind.Absolute);
                PDFPreview.Navigate(url);
                PDFPreview.Visibility = Visibility.Visible;
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex, "previewing PDF");
            }
        }
Exemplo n.º 8
0
        private static void PrintPDF(PassFile file)
        {
            string fileName = $"{PDFDirectory.FullName}\\{file.FileName}";

            Process process = new Process
            {
                StartInfo = new ProcessStartInfo()
                {
                    CreateNoWindow = true,
                    Verb           = "print",
                    FileName       = fileName
                }
            };

            process.Start();
        }
Exemplo n.º 9
0
        private static void PrintPDF(PassFile file)
        {
            try
            {
                string fileName = file.GetFullPath(PDFDirectory);

                Process process = new Process
                {
                    StartInfo = new ProcessStartInfo()
                    {
                        CreateNoWindow = true,
                        Verb           = "print",
                        FileName       = fileName
                    }
                };

                process.Start();
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex, "printing PDF");
            }
        }