// Assumes an event handler for the MouseLeftbuttonUp
// event is defined for a control named 'IncreaseQuota'
// In the control's XAML: MouseLeftButtonUp="IncreaseQuota_OnLeftMouseButtonUp"
// User first selects UI to increase the quota.
public void IncreaseQuota_OnClick(object sender, MouseEventArgs e)
{
// Obtain an isolated store for an application.
try
{
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
// Request 5MB more space in bytes.
Int64 spaceToAdd = 5242880;
Int64 curAvail = store.AvailableFreeSpace;
// If available space is less than
// what is requested, try to increase.
if (curAvail < spaceToAdd)
{
// Request more quota space.
if (!store.TryIncreaseQuotaTo(store.Quota + spaceToAdd))
{
// 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.
}
}
}
}
catch (IsolatedStorageException)
{
// TODO: Handle that store could not be accessed.
}
}