Export (0) Print
Expand All

IsolatedStorageFile.IncreaseQuotaTo Method

Enables an application to explicitly request a larger quota size, in bytes.

Namespace:  System.IO.IsolatedStorage
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
<SecuritySafeCriticalAttribute> _
Public Function IncreaseQuotaTo ( _
	newQuotaSize As Long _
) As Boolean

Parameters

newQuotaSize
Type: System.Int64
The requested size, in bytes.

Return Value

Type: System.Boolean
true if the new quota is accepted by the user, otherwise, false.

ExceptionCondition
IsolatedStorageException

The isolated store has been removed.

-or-

Isolated storage is disabled.

ArgumentOutOfRangeException

newQuotaSize is less than zero

-or-

newQuotaSize is less than or equal to the value of the Quota property.

ObjectDisposedException

The isolated store has been disposed.

ArgumentException

newQuotaSize is invalid.

An application shares its quota with all other applications that are hosted on the same domain (Web site). The initial quota is 1 MB to be shared by all of the domain's applications.

The new quota size must not be less than the current quota. Only quota increases are allowed.

To increase the quota, you must call this method from a user-initiated event, such as in an event handler for a button-click event. When you call the IncreaseQuotaTo method, the common language runtime in Silverlight presents a dialog box for the user to approve the request. If the user declines the request, this method returns false and the quota remains the same size.

The following example requests an increase in the quota size. This example is part of a larger example provided for IsolatedStorageFile class.


' Assumes an event handler for the MouseLeftbuttonUp
' event is defined for a control named 'IncreaseQuota'
' In the control's XAML: MouseLeftButtonUp="IncreaseQuota_OnLeftMouseButtonUp"
Public Sub IncreaseQuota_OnClick(ByVal sender As Object, ByVal e As MouseEventArgs)
    ' Obtain an isolated store for an application.
    Try
        Using store As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
            ' Request 5MB more space in bytes.
            Dim spaceToAdd As Int64 = 5242880
            Dim curAvail As Int64 = store.AvailableFreeSpace
            ' If available space is less than
            ' what is requested, try to increase.
            If (curAvail < spaceToAdd) Then
                ' Request more quota space.
                If Not store.IncreaseQuotaTo((store.Quota + spaceToAdd)) Then
                    ' The user clicked NO to the
                    ' host's prompt to approve the quota increase.
                Else
                    ' The user clicked YES to the
                    ' host's prompt to approve the quota increase.
                End If
            End If
        End Using
    Catch Ex As IsolatedStorageException

        ' TODO: Handle that store could not be accessed.
    End Try
End Sub


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

Show:
© 2014 Microsoft