private void btnPrintPDF_OnClick(object sender, RoutedEventArgs e) { PassFile file = (sender as Button).DataContext as PassFile; PrintPDF(file); Clear(); }
private void grdPDFs_OnSelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e) { PassFile file = grdPDFs.SelectedItem as PassFile; if (file != null) { PreviewPDF(file); } }
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; }
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(); } }
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(); } }
private void OpenPDF(PassFile file) { string fileName = $"{PDFDirectory.FullName}\\{file.FileName}"; Process process = new Process { StartInfo = { FileName = fileName } }; process.Start(); process.WaitForExit(); txtInput.Focus(); }
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"); } }
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(); }
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"); } }