ApplicationData Class
提供对应用程序数据存储区的访问。 应用程序数据包含本地、漫游或临时性的文件和设置。
语法
特性
- DualApiPartitionAttribute()
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.Storage.IApplicationDataStatics, NTDDI_WIN8)
- ThreadingAttribute(MTA)
- VersionAttribute(NTDDI_WIN8)
成员
ApplicationData类 具有以下类型的成员:
事件
ApplicationData类 具有以下事件。
| 事件 | 描述 |
|---|---|
| DataChanged | Occurs when roaming application data is synchronized. |
方法
The ApplicationData 类 具有以下方法。 使用 C#、Visual Basic 和 C++,它还可以继承以下内容中的方法 Object 类.
| 方法 | 描述 |
|---|---|
| ClearAsync() | Removes all application data from the local, roaming, and temporary app data stores. |
| ClearAsync(ApplicationDataLocality) | Removes all application data from the specified app data store. |
| SetVersionAsync | Sets the version number of the application data in the app data store. |
| SignalDataChanged | Sends a DataChanged | datachanged event to all registered event handlers. |
属性
该 ApplicationData类 具有以下属性。
| 属性 | 访问类型 | 描述 |
|---|---|---|
| 只读 | Provides access to the app data store associated with the app's app package. | |
| 只读 | Gets the root folder in the local app data store. | |
| 只读 | Gets the application settings container in the local app data store. | |
| 只读 | Gets the root folder in the roaming app data store. | |
| 只读 | Gets the application settings container in the roaming app data store. | |
| 只读 | Gets the maximum size of the data that can be synchronized to the cloud from the roaming app data store. | |
| 只读 | Gets the root folder in the temporary app data store. | |
| 只读 | Gets the version number of the application data in the app data store. |
备注
应用程序还可在其应用包中包含文件。要访问应用程序包中的文件,请使用 Windows.ApplicationModel.Package.Current.InstalledLocation。
示例
下面的代码示例演示如何获取应用程序的本地设置容器。
using Windows.Storage;
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
要求
|
最低受支持的客户端 | Windows 8 [Windows 应用商店应用, 桌面应用] |
|---|---|
|
最低受支持的服务器 | Windows Server 2012 [Windows 应用商店应用, 桌面应用] |
|
最低受支持的电话 | Windows Phone 8 |
|
命名空间 |
|
|
元数据 |
|
|
DLL |
|
另请参阅
- 任务
- 快速入门:本地应用程序数据 (JavaScript)
- 快速入门:本地应用程序数据 (C#/VB/C++)
- 快速入门:漫游应用程序数据 (JavaScript)
- 快速入门:漫游应用程序数据 (C#/VB/C++)
- 快速入门:临时应用程序数据 (JavaScript)
- 快速入门:临时应用程序数据 (C#/VB/C++)
- 概念
- 应用程序数据概述
- 准则
- 漫游应用程序数据的准则
- 应用程序设置的准则
- 引用
- ApplicationDataCompositeValue
- ApplicationDataContainer
- ApplicationDataContainerSettings
- 示例
- 应用程序设置示例
- 应用程序数据示例