n Silverlight application Isolated storage space plays vital role to store information at client side.Since silverlight applications are not allowed to access the file system of the client so If you want to store any information in client side like shopping cart items, user related information or any other application related settings that it can call up the next time the application loads then Isolated storage space can play a handy role.
|
By default silverlight 2.0 provides 1mb of storage space so what, if we want to store data that can be more than the 1mb size , In that scenarion we can use the IncreaseQuotaTo() method of IsolatedStorageFile object to increase the Quota limit.It will prompt the user for permission to increase the amount of storage space. In the below example I have used the IncreaseQuotaTo() method of IsolatedStorageFile object to get the user permission to increase the Isolated Storage Quota. |
Imports System.IO.IsolatedStorage Partial Public Class Page Inherits UserControl Public Sub New() InitializeComponent() End Sub Private Sub IncreaseIsolatedStorageSpace(ByVal lngSpaceRequested As Long) Dim isfDemo As IsolatedStorageFile 'Obtain the user scoped isolated storage of the current application isfDemo = IsolatedStorageFile.GetUserStoreForApplication() Using isfDemo 'Calculate the new storage quota limit lngSpaceRequested = isfDemo.Quota + lngSpaceRequested 'Call the function and set the quota increase If (isfDemo.IncreaseQuotaTo(lngSpaceRequested)) Then MessageBox.Show("Isolated storage space quota increased") MessageBox.Show(isfDemo.AvailableFreeSpace.ToString()) Else MessageBox.Show("User cancelled the Quota increase") MessageBox.Show(isfDemo.AvailableFreeSpace.ToString()) End If End Using End Sub Private Sub btnGetQuota_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) 'Call the function to increase the Isolated storage Quota IncreaseIsolatedStorageSpace(1024 * 1024) End Sub