help
Root Question Message
Process
to open the default app for it - in this case Adobe Acrobat Reader. The code looks like thisstring tmpFilePath = File.Exists($"{Path.GetTempPath()}{pdfFile}")
? $"{Path.GetTempPath()}{Environment.TickCount}_{pdfFile}"
: $"{Path.GetTempPath()}{pdfFile}";
Process p = new Process();
p.StartInfo.FileName = tmpFilePath;
p.EnableRaisingEvents = true;
p.Exited += (s, e) =>
{
p.WaitForExit();
if (File.Exists(tmpFilePath))
{
File.Delete(tmpFilePath);
p.Close();
}
};
p.Start();
File.Delete
saying that the file is already in use (presumably by the acrobat reader). Not sure what the "best practice" is to handle Process the right way here WaitForExit()
on that instance