Windows phone 7 如何在Windows Phone 7中获取应用程序最大内存限制
我试图获取应用程序最大分配内存的详细信息,为此我使用了Windows phone 7 如何在Windows Phone 7中获取应用程序最大内存限制,windows-phone-7,Windows Phone 7,我试图获取应用程序最大分配内存的详细信息,为此我使用了DeviceExtendedProperties如下 long maxBytes = (long)DeviceExtendedProperties.GetValue("ApplicationWorkingSetLimit"); 但是它抛出一个异常指定的参数超出了有效值的范围。堆栈跟踪为 at Microsoft.Phone.Info.ExtendedPropertiesHelper.GetValue(String propertyName,
DeviceExtendedProperties
如下
long maxBytes = (long)DeviceExtendedProperties.GetValue("ApplicationWorkingSetLimit");
但是它抛出一个异常指定的参数超出了有效值的范围。
堆栈跟踪为
at Microsoft.Phone.Info.ExtendedPropertiesHelper.GetValue(String propertyName, GetValueImplDelegate getValueImpl)
at Microsoft.Phone.Info.DeviceExtendedProperties.GetValue(String propertyName)
我可以获取long currentBytes=(long)DeviceExtendedProperties.GetValue(“ApplicationCurrentMemoryUsage”)代码>正确,但无法获得应用程序工作设置限制
我浏览了一些博客,在谷歌上搜索一些解决方案,我发现DeviceExtendedProperties已经被弃用了,取而代之的是DeviceStatus类
在DeviceStatus
中有一个名为ApplicationMemoryUsageLimit
的属性,该属性提供应用程序最大内存限制
但是
使用此类应用程序时,在Microsoft.Phone.Info
软件包中显示DeviceStatus
的错误未找到类。我正在使用Windows Phone 7.0 SDK
WP7.0中是否存在DeviceStatus类
请帮助我解决以其他方式获取ApplicationMaxMemoryLit的问题,还是我做错了什么?DeviceStatus
在7.0 SDK中不可用。您必须至少将应用程序更新到目标7.1-所有其他版本都不推荐使用。请记住,Windows Phone Marketplace将不再支持7.0应用程序。为什么您需要它,为什么您仍以7.0为目标?我想要这个最大内存限制,以便在内存不足之前释放一些存储在位图中的内存,针对7.0,因为我们有一些针对7.0的设备。你不应该再针对7.0,所有设备都有7.1升级。关于为什么你应该针对7.1而不是7.0,请参见以下内容:“为新功能铺平道路”:我不能使用WP7.0的DeviceExtendedProperties
获取应用程序最大分配内存吗?