此主题尚未评级 - 评价此主题

ApplicationData Class

提供对应用程序数据存储区的访问。 应用程序数据包含本地、漫游或临时性的文件和设置。

语法


public sealed class ApplicationData : Object

特性

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类 具有以下属性。

属性访问类型描述

Current

只读Provides access to the app data store associated with the app's app package.

LocalFolder

只读Gets the root folder in the local app data store.

LocalSettings

只读Gets the application settings container in the local app data store.

RoamingFolder

只读Gets the root folder in the roaming app data store.

RoamingSettings

只读Gets the application settings container in the roaming app data store.

RoamingStorageQuota

只读Gets the maximum size of the data that can be synchronized to the cloud from the roaming app data store.

TemporaryFolder

只读Gets the root folder in the temporary app data store.

Version

只读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

命名空间

Windows.Storage
Windows::Storage [C++]

元数据

Windows.winmd

DLL

Windows.Storage.ApplicationData.dll

另请参阅

任务
快速入门:本地应用程序数据 (JavaScript)
快速入门:本地应用程序数据 (C#/VB/C++)
快速入门:漫游应用程序数据 (JavaScript)
快速入门:漫游应用程序数据 (C#/VB/C++)
快速入门:临时应用程序数据 (JavaScript)
快速入门:临时应用程序数据 (C#/VB/C++)
概念
应用程序数据概述
准则
漫游应用程序数据的准则
应用程序设置的准则
引用
ApplicationDataCompositeValue
ApplicationDataContainer
ApplicationDataContainerSettings
示例
应用程序设置示例
应用程序数据示例

 

 

本文是否对您有所帮助?
(1500 个剩余字符)
© 2013 Microsoft. 版权所有。