从wpf中的本地计算机下载PDF文件

时间:2018-03-06 09:55:02

标签: c# wpf

单击按钮,我需要下载/打开存储在WPF c#中本地计算机文件夹中的PDF文件。可以请给我一个代码吗? 在此先感谢。

1 个答案:

答案 0 :(得分:-1)

试试这个我觉得这就是你需要的##

File.Copy("Path to Local File","Path where you want to download file");

E.g。

File.Copy("C://test.txt","D://test.txt");

如果您只想打开文件

OpenFileDialog openFileDialog1 = new OpenFileDialog();

openFileDialog1.InitialDirectory = @"C:\";
openFileDialog1.Title = "Browse Files";
openFileDialog1.CheckFileExists = true;

openFileDialog1.CheckPathExists = true;
openFileDialog1.RestoreDirectory = true;

if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
    //Do you operation here
}