UWP SDK分享

简介

本文介绍了如何对接Miracle Games SDK的分享接口,打开分享面板,将游戏通过多种渠道进行分享。

打开分享面板

C#CPP

public async void ShowShareChannel()
{
	if (!MiracleGames.ApplicationManager.SetupCompletedSuccessfully)
		return;

	var sharingCommand = new MiracleGames.Models.SharingCommand
	{
		Title = "我的MyTitle",
		Content = "我的MyContent",
		LinkUrl = "http://www.mguwp.com"
	};
	var result = await MiracleGames.SharingManager.OpenSharingChannelAsync(sharingCommand);
	if (result.ReturnValue)
	{
		//分享完成
	}
}

Platform::String^ MainPage::ShowShareChannel()
{
	auto sharingCommand = ref new MiracleGames::Models::SharingCommand;
	sharingCommand->Title = "我的MyTitle";
	sharingCommand->Content = "我的MyContent";
	sharingCommand->LinkUrl = "http://www.mguwp.com";

	concurrency::create_task(MiracleGames::SharingManager::OpenSharingChannelAsync(sharingCommand))
		.then([](MiracleGames::Services::Core::Common::AsyncProcessResult^ result)
	{
		if (result->ReturnValue)
		{
			 "分享完成"
		}
		else
		{
			"取消分享"
		}

	});
}