1

我正在尝试 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 提示用户增加配额需要哪些步骤?

4

1 回答 1

1

也许这看起来有点简单,但您的屏幕截图显示 localhost:54389 使用的当前空间为 0.0MB。因此AvailableFreeSpace将是 1.0 MB(当前配额的大小)。现在您的代码中有这一行:-

 if (store.AvailableFreeSpace >= 1000*1024) return;

在此基础上,我希望您的代码此时返回。

于 2010-04-11T13:03:48.067 回答