隔离存储配额增加和异常处理 [英] Isolated Storage Quota Increase and Exception Handling

查看:64
本文介绍了隔离存储配额增加和异常处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我是Silverlight开发的新手。我对此几乎没有疑问。


1)如何在页面加载时增加隔离存储(IS)配额大小。根据我的理解,需要用户启动的事件来弹出标准配额增加对话框。但我想在页面加载时弹出该对话框,而不是按下单击按钮
。换句话说,当应用程序加载时,我想检查IS大小。如果它小于50 MB我想向用户显示对话框以批准IS的50 MB大小。我该怎么办?


 


2)当我要使用以下代码行在IS中保存一些数据时/ p>

 IsolatedStorageSettings.ApplicationSettings.Remove(" MyCache"); 
IsolatedStorageSettings.ApplicationSettings.Add(" MyCache",Data);
IsolatedStorageSettings.ApplicationSettings.Save();


如果IS中剩余的空间较少且数据大小很大,则抛出异常。我不希望这种情况发生。什么时候抛出异常,我想从IS中清除旧数据,或者我想将IS的大小增加50MB。请告诉
我该怎么办?


如果您有任何其他问题,请不要犹豫。等待你的回复。


 


问候,


Sulaman


 

解决方案

1)向用户显示一个对话框,说明需要更多存储空间,并且会询问他单击确定后批准配额增加。当用户单击"确定"时,它是用户启动的事件,可用于启动配额增加。


2)对大数据使用IsolatedStorageFile。它还有
AvailableFreeSpace
属性,用于检查可用存储空间。


Hi All,

I am new to silverlight development. I have few question regarding this.

1) How can I increase the isolated storage (IS) quota size on page load. According to my understanding, a user initiated event is required to pop up the standard quota increase dialogue box. But i want to pop up that dialogue box on page load rather then on a button click. In other words, when application loads, i want to check the IS size. If its less then 50 MB i want to show dialogue box to user to approve the 50 MB size for IS. How can i do it?

 

2) When i am going to save some data in IS by using the following lines of code

IsolatedStorageSettings.ApplicationSettings.Remove("MyCache");
IsolatedStorageSettings.ApplicationSettings.Add("MyCache", Data);
IsolatedStorageSettings.ApplicationSettings.Save();

if there is less space left in IS and size of data is large, then an exception is thrown. I don't want this to happen. When ever exception is going to be thrown, i want to clear the old data from IS or i want to increase the size of IS by 50MB. Kindly tell me how can i do it?

If you have any other question, plz don't hesitate to ask. Waiting for your reply.

 

Regards,

Sulaman

 

解决方案

1) Show a dialog box to user explaining that more storage is needed and that he will be asked to approve the quota increase after clicking OK. When the user clicks OK, it is a user initiated event which can be used for starting quota increase.

2) Use IsolatedStorageFile for large data. It also has AvailableFreeSpace property for checking the available storage space.


这篇关于隔离存储配额增加和异常处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆