错误的应用程序内购买教程在微软网站

我试图实现应用程序内购买的Metro应用。我在这里按照教程。错误的应用程序内购买教程在微软网站

C# code for in-app purchase

的C#代码是

function AppInit() 

{

// some app initialization functions

// Get the license info

// The next line is commented out for testing.

// licenseInformation = CurrentApp.LicenseInformation;

// The next line is commented out for production/release.

licenseInformation = CurrentAppSimulator.LicenseInformation;

// other app initialization functions

}

但是,也有在C#中没有function关键字。这是错误的?如果是这样,那么正确的代码假设是什么?

回答:

教程似乎被错误地表示代码的JavaScript版本。我有我的许可初始化代码App类的里面,在OnLaunched()函数:

protected override async void OnLaunched(LaunchActivatedEventArgs args) 

{

Frame rootFrame = Window.Current.Content as Frame;

// Do not repeat app initialization when the Window already has content,

// just ensure that the window is active

if (rootFrame == null)

{

#if DEBUG

licenseInformation = CurrentAppSimulator.LicenseInformation;

#else

licenseInformation = CurrentApp.LicenseInformation;

#endif

// other init here...

}

}

以上是 错误的应用程序内购买教程在微软网站 的全部内容, 来源链接: utcz.com/qa/261943.html

回到顶部