CurrentAppSimulator Class
테스트 중 시뮬레이션된 라이선스를 가져오는 데 사용할 수 있는 개체를 인스턴스화하는 데 사용하는 메서드와 속성을 정의합니다.
참고 Windows 스토어에 응용 프로그램을 제출하려면 CurrentAppSimulator 클래스를 CurrentApp 클래스로 교체해야 합니다. CurrentAppSimulator를 사용하는 응용 프로그램은 인증에 실패합니다.
구문
var currentAppSimulator = Windows.ApplicationModel.Store.CurrentAppSimulator;
특성
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.ApplicationModel.Store.ICurrentAppSimulator, NTDDI_WIN8)
- ThreadingAttribute(Both)
- VersionAttribute(NTDDI_WIN8)
구성원
CurrentAppSimulator클래스에는 다음과 같은 유형의 구성원이 있습니다.
메서드
The CurrentAppSimulator 클래스 다음 메서드가 있습니다. C#, Visual Basic 및 C++에서는 다음에서 메서드를 상속합니다. Object 클래스.
| 메서드 | 설명 |
|---|---|
| GetAppReceiptAsync | Creates the async operation that the user can use to simulate requesting all receipts for this app and any in-app purchases. |
| GetProductReceiptAsync | Creates the async operation that the user can use to simulate requesting the receipt for the productId specified. |
| LoadListingInformationAsync | Loads the simulated app listing information asynchronously. Implements the IAsyncInfo interface. |
| ReloadSimulatorAsync | Reloads the simulator using a StorageFile containing the WindowsStoreProxy.xml file. |
| RequestAppPurchaseAsync | Creates the async operation that enables the user to simulate the purchase of a full license for the current app. |
| RequestProductPurchaseAsync | Creates the async operation that displays the UI that is used to simulate the purchase of a product or feature from the Windows Store. |
속성
CurrentAppSimulator클래스 다음 속성이 있습니다.
| 속성 | 액세스 유형 | 설명 |
|---|---|---|
| 읽기 전용 | Gets a simulated app ID. | |
| 읽기 전용 | Gets the simulated license metadata for the current app as provided by the simulation. | |
| 읽기 전용 | Gets the simulated Uniform Resource Identifier (URI) that represents a Windows Store listing page for the current app. |
설명
Windows 저장소에 앱이 나열될 때까지 CurrentApp 개체는 앱에서 작동하지 않습니다. CurrentAppSimulator를 사용하여 앱 개발 도중 앱의 라이선싱과 프로그램 내 구입을 테스트합니다. 앱을 테스트한 후 Windows 스토어에 제출하기 전 CurrentAppSimulator의 인스턴스를 CurrentApp으로 대체합니다. 앱에서 CurrentAppSimulator를 사용하면 앱은 인증에 실패합니다.
참고 시뮬레이션을 사용할 때 앱의 초기 라이선스 상태는 WindowsStoreProxy.xml에 설명되어 있습니다. 라이선스 구매, 앱 내 구매와 같이 라이선스 상태를 변경하는 CurrentAppSimulator 메서드는 메모리에 있는 개체의 라이선스 상태만 업데이트합니다. WindowsStoreProxy.xml의 내용은 변경되지 않습니다. 앱을 다시 시작하면 라이선스 상태가 WindowsStoreProxy.xml에 설명되어 있는 상태로 되돌아갑니다.
CurrentAppSimulator 개체는 %userprofile%\appdata\local\packages\<package-moniker>\localstate\microsoft\Windows Store\Apidata 폴더의 WindowsStoreProxy.xml 파일에서 데이터를 가져옵니다. CurrentAppSimulator 속성에서 시뮬레이션하려는 시나리오에 맞게 이 파일을 구성해야 합니다.
이 파일의 내용은 이 항목의 뒷부분에 예제로 포함된 SimulatedCurrentApp.xsd 파일을 통해 정의되며 개체의 구성과 Windows.ApplicationModel.Store 네임스페이스의 속성을 반영합니다.
이 파일의 요소가 CurrentApp 루트 노드에 포함되며 다음과 같습니다.
-
ListingInformation
일반적으로 앱의 목록에 있는 데이터를 나타내고 다음 요소를 포함합니다.
-
App
앱에 대한 데이터를 나타내고 다음 요소를 포함합니다.
-
AppId
스토어에서 앱을 식별하는 GUID입니다. 이는 테스트를 위해 모든 GUID가 될 수 있습니다.
-
LinkUri
스토어에 있는 목록 페이지의 URI입니다. 이는 테스트를 위해 모든 유효한 URI가 될 수 있습니다.
-
AgeRating
앱의 최소 연령 등급을 나타내는 정수입니다. 이는 앱을 제출할 때 대시보드에 지정하는 것과 같은 값입니다. Windows 스토어에서 사용하는 값은 3, 7, 12 및 16입니다.
-
CurrentMarket
이는 고객의 국가/지역입니다.
앱이 나열되는 각 국가/지역의 경우 MarketData 요소가 있어야 합니다.
-
MarketData
이 국가/지역의 앱에 대한 정보입니다.
xml:lang 특성이 필요합니다. 이 특성은 이 정보가 적용되는 국가/지역을 지정합니다.
-
Name
이 국가/지역용 앱의 이름입니다.
-
Description
이 국가/지역용 앱에 대한 설명입니다.
-
Price
이 국가/지역용 앱의 가격입니다.
-
CurrencySymbol
이 국가/지역에서 사용되는 통화 기호입니다.
-
-
-
Product
고객이 앱 내 구입을 할 경우 이 앱에서 활성화되는 제품 또는 기능을 설명합니다.
ProductId 특성이 필요합니다. 이 특성에는 앱에서 제품이나 기능을 식별하는 데 사용되는 문자열이 들어 있습니다.
LicenseDuration 특성이 필요합니다. 이 특성에는 구매 후 라이선스의 유효 기간(일)이 들어 있습니다. 제품 구매 시 생성된 새 라이선스 만료 날짜는 구매 날짜 + 라이선스 기간입니다.
-
MarketData
이 국가/지역의 제품 또는 기능에 대한 정보입니다.
xml:lang 특성이 필요합니다. 이 특성은 이 정보가 적용되는 국가/지역을 지정합니다.
-
Name
이 국가/지역의 제품 또는 기능의 이름입니다.
-
Price
이 국가/지역의 제품 또는 기능의 가격입니다.
-
CurrencySymbol
이 국가/지역에서 사용되는 통화 기호입니다.
-
CurrencyCode
이 국가/지역에서 사용되는 통화 코드입니다.
-
-
-
LicenseInformation
이 앱에 사용할 수 있는 라이선스를 설명하는 데이터를 나타내고 다음 요소를 포함합니다.
-
App
앱의 라이선스를 설명합니다.
-
IsActive
이 앱의 현재 라이선스 상태에 대해 설명합니다.
true는 라이선스가 유효하다는 것을 나타냅니다. 앱에 평가 모드가 있는지 여부에 상관없이 일반적으로 이 값은 true입니다.
false는 잘못 된 라이선스를 나타냅니다. 잘못된 라이선스가 있을 때 앱의 작동을 테스트하려면 이 값을 false로 설정합니다.
-
IsTrial
이 앱의 현재 평가 상태에 대해 설명합니다.
true는 앱이 평가 기간 동안 사용 중임을 나타냅니다.
false는 앱을 구입했거나 평가 기간이 만료되어 앱이 평가판이 아님을 나타냅니다.
-
ExpirationDate
이 앱에 대한 평가 기간이 만료되는 날짜입니다. 날짜는 yyyy-mm-ddThh:mm:ss.ssZ로 표현해야 합니다. 예를 들어 2012년 1월 19일 05:00시는 2012-01-19T05:00:00.00Z로 지정됩니다.
이 요소는 IsTrial이 true인 경우 필요합니다. 그렇지 않으면 필요하지 않습니다.
-
DefaultResponse
지정된 메서드에서 반환한 기본 오류 코드에 대해 설명합니다. MethodName 특성을 사용하면 다음 방법 중 하나를 지정할 수 있습니다.
- RequestAppPurchaseAsync_GetResult
- RequestProductPurchaseAsync_GetResult
- LoadListingInformationAsync_GetResult
-
-
Product
이 응용 프로그램에 있는 제품 또는 기능의 현재 라이선스 상태에 대해 설명합니다.
-
IsActive
이 응용 제품 또는 기능의 현재 라이선스 상태에 대해 설명합니다.
true는 제품 또는 기능을 사용할 수 있음을 나타냅니다.
false는 제품 또는 기능을 사용할 수 없거나 구입하지 않았음을 나타냅니다.
-
ExpirationDate
제품이나 기능이 만료되는 날짜입니다. 날짜는 yyyy-mm-ddThh:mm:ss.ssZ로 표현해야 합니다. 예를 들어 2012년 1월 19일 05:00시는 2012-01-19T05:00:00.00Z로 지정됩니다.
이 요소가 있을 경우 제품 또는 기능에 만료 날짜가 있습니다.
이 요소가 없을 경우 제품 또는 기능이 만료되지 않습니다.
-
-
-
Simulation
다양한 메서드 호출의 작동 방식을 설명합니다. SimulationMode 특성을 Automatic으로 설정하면 메서드에서 지정된 HRESULT 오류 코드를 자동으로 반환합니다. 이는 자동화된 테스트 사례를 실행할 때 사용할 수 있습니다.
예제
이 예제는 2012년 1월 19일 05:00(Z)에 만료되는 평가 모드로 앱을 설명하는 WindowsStoreProxy.xml 파일입니다.
<?xml version="1.0" encoding="UTF-16"?> <CurrentApp> <ListingInformation> <App> <AppId>2B14D306-D8F8-4066-A45B-0FB3464C67F2</AppId> <LinkUri>http://apps.windows.microsoft.com/app/2B14D306-D8F8-4066-A45B-0FB3464C67F2</LinkUri> <CurrentMarket>en-US</CurrentMarket> <AgeRating>3</AgeRating> <MarketData xml:lang="en-us"> <Name>Trial management full license</Name> <Description>Sample app for demonstrating trial license management</Description> <Price>4.99</Price> <CurrencySymbol>$</CurrencySymbol> </MarketData> </App> </ListingInformation> <LicenseInformation> <App> <IsActive>true</IsActive> <IsTrial>true</IsTrial> <ExpirationDate>2012-01-19T05:00:00.00Z</ExpirationDate> </App> </LicenseInformation> <Simulation SimulationMode="Automatic"> <DefaultResponse MethodName="LoadListingInformationAsync_GetResult" HResult="E_FAIL"/> </Simulation> </CurrentApp>
다음 예제는 구입한 앱을 설명하고 2012년 1월 19일 05:00 (Z)에 만료되는 기능이 있는 WindowsStoreProxy.xml 파일입니다.
<?xml version="1.0" encoding="utf-16" ?> <CurrentApp> <ListingInformation> <App> <AppId>988b90e4-5d4d-4dea-99d0-e423e414ffbc</AppId> <LinkUri>http://apps.windows.microsoft.com/app/988b90e4-5d4d-4dea-99d0-e423e414ffbc</LinkUri> <CurrentMarket>en-us</CurrentMarket> <AgeRating>3</AgeRating> <MarketData xml:lang="en-us"> <Name>Expiring in-app feature</Name> <Description>App description text goes here.</Description> <Price>5.99</Price> <CurrencySymbol>$</CurrencySymbol> </MarketData> </App> <Product ProductId="feature1" LicenseDuration="10"> <MarketData xml:lang="en-us"> <Name>Feature 1</Name> <Price>1.99</Price> <CurrencySymbol>$</CurrencySymbol> </MarketData> </Product> </ListingInformation> <LicenseInformation> <App> <IsActive>true</IsActive> <IsTrial>false</IsTrial> </App> <Product ProductId="feature1"> <IsActive>true</IsActive> <ExpirationDate>2012-01-19T00:00:00.00Z</ExpirationDate> </Product> </LicenseInformation> </CurrentApp>
SimulatedCurrentApp.xsd
다음 예제는 CurrentAppSimulator를 사용하여 앱을 테스트하는 데 사용되는 임시 파일의 구조를 정의하는 XSD 파일입니다.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" />
<xs:element name="CurrentApp" type="CurrentAppDefinition"></xs:element>
<xs:complexType name="CurrentAppDefinition">
<xs:sequence>
<xs:element name="ListingInformation" type="ListingDefinition" minOccurs="1" maxOccurs="1"/>
<xs:element name="LicenseInformation" type="LicenseDefinition" minOccurs="1" maxOccurs="1"/>
<xs:element name="Simulation" type="SimulationDefinition" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="ResponseCodes">
<xs:restriction base="xs:string">
<xs:enumeration value="S_OK">
<xs:annotation>
<xs:documentation>0x00000000</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="E_INVALIDARG">
<xs:annotation>
<xs:documentation>0x80070057</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="E_CANCELLED">
<xs:annotation>
<xs:documentation>0x800704C7</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="E_FAIL">
<xs:annotation>
<xs:documentation>0x80004005</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="E_OUTOFMEMORY">
<xs:annotation>
<xs:documentation>0x8007000E</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="ERROR_ALREADY_EXISTS">
<xs:annotation>
<xs:documentation>0x800700B7</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="StoreMethodName">
<xs:restriction base="xs:string">
<xs:enumeration value="RequestAppPurchaseAsync_GetResult" id="RPPA" />
<xs:enumeration value="RequestProductPurchaseAsync_GetResult" id="RFPA" />
<xs:enumeration value="LoadListingInformationAsync_GetResult" id="LLIA" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SimulationMode">
<xs:restriction base="xs:string">
<xs:enumeration value="Interactive" />
<xs:enumeration value="Automatic" />
</xs:restriction>
</xs:simpleType>
<xs:complexType name="ListingDefinition">
<xs:sequence>
<xs:element name="App" type="AppListingDefinition" />
<xs:element name="Product" type="ProductListingDefinition" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="AppListingDefinition">
<xs:sequence>
<xs:element name="AppId" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="LinkUri" type="xs:anyURI" minOccurs="1" maxOccurs="1" />
<xs:element name="CurrentMarket" type="xs:language" minOccurs="1" maxOccurs="1" />
<xs:element name="AgeRating" type="xs:unsignedInt" minOccurs="1" maxOccurs="1" />
<xs:element name="MarketData" type="MarketSpecificAppData" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="MarketSpecificAppData">
<xs:sequence>
<xs:element name="Name" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="Description" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="Price" type="xs:float" minOccurs="1" maxOccurs="1" />
<xs:element name="CurrencySymbol" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="CurrencyCode" type="xs:string" minOccurs="0" maxOccurs="1" />
</xs:sequence>
<xs:attribute ref="xml:lang" use="required" />
</xs:complexType>
<xs:complexType name="MarketSpecificProductData">
<xs:sequence>
<xs:element name="Name" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="Price" type="xs:float" minOccurs="1" maxOccurs="1" />
<xs:element name="CurrencySymbol" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="CurrencyCode" type="xs:string" minOccurs="0" maxOccurs="1" />
</xs:sequence>
<xs:attribute ref="xml:lang" use="required" />
</xs:complexType>
<xs:complexType name="ProductListingDefinition">
<xs:sequence>
<xs:element name="MarketData" type="MarketSpecificProductData" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="ProductId" use="required">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="100"/>
<xs:pattern value="[^,]*"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="LicenseDuration" type="xs:integer" use="optional" />
</xs:complexType>
<xs:complexType name="LicenseDefinition">
<xs:sequence>
<xs:element name="App" type="AppLicenseDefinition" />
<xs:element name="Product" type="ProductLicenseDefinition" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="AppLicenseDefinition">
<xs:sequence>
<xs:element name="IsActive" type="xs:boolean" minOccurs="1" maxOccurs="1" />
<xs:element name="IsTrial" type="xs:boolean" minOccurs="1" maxOccurs="1" />
<xs:element name="ExpirationDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProductLicenseDefinition">
<xs:sequence>
<xs:element name="IsActive" type="xs:boolean" minOccurs="1" maxOccurs="1" />
<xs:element name="ExpirationDate" type="xs:dateTime" minOccurs="0" maxOccurs="1" />
</xs:sequence>
<xs:attribute name="ProductId" type="xs:string" use="required" />
</xs:complexType>
<xs:complexType name="SimulationDefinition" >
<xs:sequence>
<xs:element name="DefaultResponse" type="DefaultResponseDefinition" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="SimulationMode" type="SimulationMode" use="optional" />
</xs:complexType>
<xs:complexType name="DefaultResponseDefinition">
<xs:attribute name="MethodName" type="StoreMethodName" use="required" />
<xs:attribute name="HResult" type="ResponseCodes" use="required" />
</xs:complexType>
</xs:schema>
요구 사항
|
지원되는 최소 클라이언트 | Windows 8 [Windows 스토어 앱 전용] |
|---|---|
|
지원되는 최소 서버 | Windows Server 2012 [Windows 스토어 앱 전용] |
|
네임스페이스 |
|
|
메타데이터 |
|
