I have a winform application that uses some referenced web services to get data. The data returned is an array of objects that I loop through and add to a dataSet.
When I call the service, it can often take 2 or 3 minutes to get all the data.
If the user exits the program and comes back later, I don't want them to have to re-download all the data again.
When I run the app in debug mode, there's no persistence of the downloaded information; which worries me.
I'm still in "development mode", so I haven't really put together an installer yet to test if the information stays with the application.
I'm curious about a couple of things:
- Does the data stored in the dataset remain after the user exits?
- If not, what would you recommend on how to accomplish this?
- I've considered XML for storage; is that the best option when you have 9-10 MB of data?
Edit: Final Outcome: OK - here's the final outcome (thank you everyone for your quick response)
When the application exits, I call a function to save the data. Here's a snippet:
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
FileStream fs;
IFormatter formatter = new BinaryFormatter();
//activities
if (actList.Length > 0)
{
fs = new FileStream("activities.bin", FileMode.Create, FileAccess.Write, FileShare.None);
formatter.Serialize(fs, actList);
fs.Close();
}
//users
if (userList.Length > 0)
{
fs = new FileStream("users.bin", FileMode.Create, FileAccess.Write, FileShare.None);
formatter.Serialize(fs, userList);
fs.Close();
}
The userList and actList parameters are List objects that came from the web services call.
another thing I implemented (slightly off topic) is to create an application setting to save when the user last did a download from the web service. It's saved as
Properties.Settings.Default.last_downloaded
If the user clicks the download button, they are prompted with the date they last performed the download and are given a chance to say "no".
Thanks again for your help!