我想使用以下代码打开任何文件类型:
System.Diagnostics.Process.Start(pathFile);
有没有办法检查系统应用程序是否存在?
例如:pdf,本机没有acrobat reader。
我创建了一个try catch,但我对它不满意,我想模仿windows打开文件的行为。它有一个搜索网络/手动搜索的选项。
try
{
System.Diagnostics.Process.Start(pathFile);
}
catch (System.ComponentModel.Win32Exception ex)
{
composite.ReadingError = ex.Message;
Console.WriteLine("error");
}