2010-04-10 91 views
1

我正在嘗試使用Silverlight的隔離存儲功能。 目前通過ASP.NET頁面運行Silverlight。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標籤doeslist如下圖所示託管的Silverlight localhost的ASP.NET頁面。

alt text

根據截圖,http://localhost:54389有可用的存儲區的1.0MB。
localhost網站上是否存在對某個提示被忽略的限制?

Silverlight提示用戶增加配額的步驟是什麼?

+0

在調用增加之前,你的代碼是否可能做了大量的處理?如果太多時間過去了,它不會再提示。 – 2010-04-11 07:20:10

回答

1

也許這看起來可能有些簡單,但是您的屏幕快照顯示localhost:54389使用的當前空間爲0.0MB。因此AvailableFreeSpace將爲1.0 MB(當前配額的大小)。現在你的代碼有這條線: -

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

在此基礎上,我期望你的代碼在這一點上返回。