public async Task <GameSaveErrorStatus> Initialize(XboxLiveContext context) { if (context == null) { throw new ArgumentNullException("context"); } // Getting a GameSaveProvider requires the Windows user object. It will automatically get the correct // provider for the current Xbox Live user. var users = await Windows.System.User.FindAllAsync(); if (users.Count > 0) { GameSaveProviderGetResult result = await GameSaveProvider.GetForUserAsync( users[0], context.AppConfig.ServiceConfigurationId); if (result.Status == GameSaveErrorStatus.Ok) { m_context = context; m_saveProvider = result.Value; } return(result.Status); } else { throw new Exception("No Windows users found when creating save provider."); } }
private static async Task <GameSaveProvider> GetGameSaveProvider() { if (XboxLiveObject.CurrentContext == null || XboxLiveObject.CurrentUser == null) { return(null); } var users = await Windows.System.User.FindAllAsync(); GameSaveProviderGetResult gameSaveTask = await GameSaveProvider.GetForUserAsync(users[0], XboxLiveObject.CurrentContext.AppConfig.ServiceConfigurationId); if (gameSaveTask.Status == GameSaveErrorStatus.Ok) { return(gameSaveTask.Value); } else { return(null); } }