コード例 #1
0
        private void btnPrintPDF_OnClick(object sender, RoutedEventArgs e)
        {
            PassFile file = (sender as Button).DataContext as PassFile;

            PrintPDF(file);
            Clear();
        }
コード例 #2
0
        private void grdPDFs_OnSelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            PassFile file = grdPDFs.SelectedItem as PassFile;

            if (file != null)
            {
                PreviewPDF(file);
            }
        }
コード例 #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;
        }
コード例 #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();
            }
        }
コード例 #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();
            }
        }
コード例 #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();
        }
コード例 #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");
            }
        }
コード例 #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();
        }
コード例 #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");
            }
        }