我正在尝试使用Silverlight的隔离存储功能。 目前通过ASP.NET页面运行Silverlight。
我已经编写了一些代码来请求额外的存储空间,但我没有被提示添加更多内容。
private void requestButton_Click(object sender, RoutedEventArgs e)
{
using (IsolatedStorageFile store =
IsolatedStorageFile.GetUserStoreForApplication())
{
if (store.AvailableFreeSpace >= 1000*1024) return;
long usedSpace = store.Quota - store.AvailableFreeSpace;
if (store.IncreaseQuotaTo(usedSpace + 1000*1024))
statusTextBlock.Text =
string.Format("Quota has been increased to {0}", store.Quota);
else
statusTextBlock.Text =
"You have denied quota increase... you Inglorious Basterd...";
}
}
Silverlight的Application Storage
选项卡会列出托管Silverlight的localhost ASP.NET页面,如下所示。
根据截图,http://localhost:54389
有1.0MB的可用存储空间
localhost
网站是否设置了限制提示被忽略的内容?
Silverlight提示用户增加配额的必要步骤是什么?
答案 0 :(得分:1)
也许这看起来有点简单,但是你的屏幕截图显示localhost:54389使用的当前空间是0.0MB。因此AvailableFreeSpace
将是1.0 MB(当前配额的大小)。现在你的代码中有这一行: -
if (store.AvailableFreeSpace >= 1000*1024) return;
在此基础上,我希望您的代码在此时返回。