本文整理匯總了C#中System.Platform.ConvertToRegion方法的典型用法代碼示例。如果您正苦於以下問題:C# Platform.ConvertToRegion方法的具體用法?C# Platform.ConvertToRegion怎麽用?C# Platform.ConvertToRegion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Platform
的用法示例。
在下文中一共展示了Platform.ConvertToRegion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetCurrentGameAsync
/// <summary>
/// Gets the current game by summoner ID asynchronously.
/// </summary>
/// <param name="region">Region where to retrieve the data.</param>
/// <param name="summonerId">ID of the summoner for which to retrieve current game.</param>
/// <returns>Current game of the summoner.</returns>
public async Task<CurrentGame> GetCurrentGameAsync(Platform platform, long summonerId)
{
var json = await requester.CreateRequestAsync(
string.Format(CurrentGameRootUrl, platform.ToString()) + string.Format(IdUrl, summonerId),
platform.ConvertToRegion());
return (await Task.Factory.StartNew(() => JsonConvert.DeserializeObject<CurrentGame>(json)));
}
示例2: GetCurrentGame
/// <summary>
/// Gets the current game by summoner ID synchronously.
/// </summary>
/// <param name="platform">Region where to retrieve the data.</param>
/// <param name="summonerId">ID of the summoner for which to retrieve current game.</param>
/// <returns>Current game of the summoner.</returns>
public CurrentGame GetCurrentGame(Platform platform, long summonerId)
{
var json = requester.CreateRequest(
string.Format(CurrentGameRootUrl, platform.ToString()) + string.Format(IdUrl, summonerId),
platform.ConvertToRegion());
return JsonConvert.DeserializeObject<CurrentGame>(json);
}