views:

87

answers:

1

It is about WPF application which generates reports.

Reports have simple structure: byte[] m_Data, string m_Mime.

Data array is created, mime type is set, now what I need is to display the dialog with same functionality we find in web browsers' - Open/Save/Cancel dialog that opens file in appropriate application depending on response's MIME type.

+1  A: 

WPF doesn't have such a dialog because it's not a web application, it's an application running locally and using the operating system's native facilities not HTTP.

It should be easy to write to write the Open/Save/Cancel dialog itself, in order to implement the open functionality you should save the file to disk (maybe to the temporary directory returned by System.IO.Path.GetTempPath or to the file name returned by System.IO.Path.GetTempFileName).

Make sure the file has the right extension because Windows uses file extensions and not mime types (because mime types didn't exist when they wrote Windows).

To open the file you just created use System.Diagnostic.Process.Start, for example this will open the file MyPdfFile.pfd in Acrobat reader if its installed (from the current directory, don't forget to include the full path in your code):

System.Diagnostics.Process.Start("MyPdfFile.pdf");
Nir