Setup UWP with Xbox Live sample C# properly
Project setup
- Nuget Package Manager : Microsoft.Xbox.Live.SDK.WinRT.UWP
- Build-Project
- References :
- Universal APP \ Extensions \ Visual C++ 2015 UWP Desktop Runtime for native apps (version 14)
- DEBUG folder : Microsoft.Xbox.Services.winmd
Code samples
User
//ini user - actual system user
private static XboxLiveUser XboxUser = new XboxLiveUser();//or
//specific system user
var allUser = await Windows.System.User.FindAllAsync();
var validSysUser = allUser.Where(u => (u.Type != Windows.System.UserType.LocalGuest || u.Type != Windows.System.UserType.RemoteGuest)).ToList();
XboxLiveUser XboxUser = new XboxLiveUser(validSysUser.FirstOrDefault());
//XBOX for FullHD on TV-SCREENS
bool result = Windows.UI.ViewManagement.ApplicationViewScaling.TrySetDisableLayoutScaling(true);
Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SetDesiredBoundsMode(Windows.UI.ViewManagement.ApplicationViewBoundsMode.UseCoreWindow);
Sign-in
public static async Task<XboxLiveUser> GetXboxLiveUser()
{
//var allUser = await Windows.System.User.FindAllAsync();
//var validSysUser = allUser.Where(u => (u.Type != Windows.System.UserType.LocalGuest || u.Type != Windows.System.UserType.RemoteGuest)).ToList();
//XboxLiveUser XboxUser = new XboxLiveUser(validSysUser.FirstOrDefault());
if (!XboxUser.IsSignedIn)
{
var r = await XboxUser.SignInAsync(Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher);
}
return XboxUser;
}