Silverlight 不提示增加配额

发布于 2024-08-28 13:44:17 字数 1114 浏览 2 评论 0原文

我正在尝试 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 的本地主机 ASP.NET 页面,如下所示。

alt text

根据截图,http://localhost:54389 有1.0MB 可用存储空间。
localhost 网站上是否设置了忽略提示的限制?

Silverlight 提示用户增加配额所需的步骤是什么?

I am trying out Silverlight's Isolated Storage feature.
Currently running Silverlight thru ASP.NET page.

I have written some code to request an additional storage but I am not being prompted to add more.

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's Application Storage tab doeslist the localhost ASP.NET page hosting Silverlight as shown below.

alt text

According to the screenshot, http://localhost:54389 has 1.0MB of available storage area.
Is there a restriction set on localhost websites that a prompt is ignored?

What are the required steps for Silverlight to prompt users to increase quota?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼眸印温柔 2024-09-04 13:44:17

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

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

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

Perhaps this might seem a bit simplistic but your screen shot shows that the current space used by localhost:54389 is 0.0MB. Hence the AvailableFreeSpace will be 1.0 MB (the size of the current quota). Now your code has this line in it:-

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

On that basis I would expect your code return at this point.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文