I am currently reading a stream from a URL. And saving this as a file on the client.
I know that Silverlight 4 does not support the Default File Name on the SaveFileDialog.
Has anyone out there found a workaround or some way to inject the FileName into the Stream?
Any workaround would be great to set the file name.
Code:
public void ClientOpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
using (var file = Save.OpenFile())
{
CopyStream(e.Result, file);
}
}
public static void CopyStream(Stream input, Stream output)
{
var buffer = new byte[8 * 1024];
int length;
while ((length = input.Read(buffer, 0, buffer.Length)) > 0)
{
output.Write(buffer, 0, length);
}
}
Works for me