The last time we talked about how to change the default storage quota of isolatedstorage, I will introduce how to view the current usage of isolatedstorage.
First, open the Silverlight configuration page ):
Select ApplicationProgramStorage (Application storage) tab:
The current storage status is clear at a glance ~ Of course, I can also get these attributes in the program.
Using (Isolatedstoragefile ISF = Isolatedstoragefile. getuserstoreforapplication ())
{
ISF. availablefreespace. tostring () + " Bytes " ; // Here is the remaining space
ISF. Quota. tostring () + " Bytes " ; // Here is the current quota
(ISF. Quota - ISF. availablefreespace). tostring () + " Bytes " ; // Here is the space used by the user
}
Okay. Now let's see how to change the default quota ~
Using (Isolatedstoragefile ISF = Isolatedstoragefile. getuserstoreforapplication ())
{
Try
{
If ( True = ISF. increasequotato ( 1048576 * 2 )) // Increase the quota to 2 MB (note: the unit here is bytes)
{
Results. Text= "Quota changed successfully.";
}
Else
{
Results. Text= "Quota change failed.";
}
}
Catch (Exception E)
{
System. Windows. browser. htmlpage. Window. Alert (E. Message );
}
}
Easy ~ Some may ask where we stored the data last time.
This information should be reported in c: \ Users \ sonic \ appdata \ locallow \ Microsoft \ Silverlight \ is \ gsp5lhdk. hho \ ulgnbrmt. oex \ 1 \ s \ Users \ f \ sonic.txt
Source code: isolatedstoragedemo2