private void Button_Click(object sender, RoutedEventArgs e) { Button btn = sender as Button; string content = btn.Content as string; PDFReader pdfReader = new PDFReader(); pdfReader.showPdf(content + ".pdf"); }
private void dataGridSearchResult_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (this.dataGridSearchResult.SelectedItem == null) { return; } int i = dataGridSearchResult.SelectedIndex; DataSet_Case.T_CaseRow ThisCase = dataGridSearchResult.SelectedItem as DataSet_Case.T_CaseRow; string strFileName = ThisCase.CasePDF; DirectoryInfo di = new DirectoryInfo(System.Environment.CurrentDirectory); string strPath = di.Parent.Parent.FullName; if (System.IO.File.Exists(strPath + @"/PDF/" + strFileName)) { PDFReader m_PDFReader = new PDFReader(); m_PDFReader.showPdf(strFileName); } else { MessageBox.Show("没有该文件"); } dataGridSearchResult.SelectedIndex = -1; }
private void dataGridSearchResult_Click(object sender, RoutedEventArgs e) { if (this.dataGridSearchResult.SelectedItem == null) { return; } if (e.OriginalSource.GetType() != typeof(System.Windows.Documents.Hyperlink)) return; //todo: int i = dataGridSearchResult.SelectedIndex; DataSet_Case.T_CaseRow ThisCase = dataGridSearchResult.SelectedItem as DataSet_Case.T_CaseRow; string strFileName = ThisCase.CasePDF; DirectoryInfo di = new DirectoryInfo(System.Environment.CurrentDirectory); string strPath = di.Parent.Parent.FullName; if (System.IO.File.Exists(strPath + @"/PDF/" + strFileName)) { PDFReader m_PDFReader = new PDFReader(); m_PDFReader.showPdf(strFileName); } else { MessageBox.Show("没有该文件"); } }