How to Download the a Video,Audio, PDF, etc into a Local Storage

Posted by Vuyiswamb under Mobile Development on 11/9/2013 | Points: 10 | Views : 2564 | Status : [Member] [MVP] [Administrator] | Replies : 0
Good Day All

i have some video and Audio Files that i would like the user to download to the Local Storage and after being downloaded it must be viewed.i tried the following code.

  string m_Url = "http://media.lakewood.org.edgesuite.net/JOM/podcast/mp3_audio/596_Podcast.mp3";//string.Empty;

private void btnDownload_Click(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
if (button.Tag.ToString() != string.Empty)
{

// m_Url = button.Tag.ToString();

//Obtain a virtual store for application
IsolatedStorageFile fileStorage = IsolatedStorageFile.GetUserStoreForApplication();

if (!fileStorage.DirectoryExists("BOOKS"))
{
//Create new subdirectory
fileStorage.CreateDirectory("BOOKS");
}

//Create a new StreamWriter, to write the file to the specified location.
StreamWriter fileWriter = new StreamWriter(new IsolatedStorageFileStream("BOOKS\\" + GenericFunctions.GetFileNameinURL(m_Url), FileMode.OpenOrCreate, fileStorage));

fileWriter.Close();

if (fileStorage.FileExists("BOOKS\\" + GenericFunctions.GetFileNameinURL(m_Url)))
{
MessageBox.Show("Download Complete");

GenericFunctions.PlaySound("BOOKS\\" + GenericFunctions.GetFileNameinURL(m_Url));
}
}

}


Thanks

Thank you for posting at Dotnetfunda
[Administrator]



Responses

(No response found.)

Login to post response