我有一个Windows 8商店应用程序,我想添加Azure身份验证.我已经按照MSDN页面中的示例进行操作.但是,以下行给了我一些问题:
MobileServiceUser loginResult = await App.MobileService.LoginAsync(result.Session.AuthenticationToken);
Run Code Online (Sandbox Code Playgroud)
错误是:App不包含MobileService的定义.什么时候将MobileService实例添加到App类?
我添加了对Microsoft.Live和Azure移动服务库的引用.这是整个Authenticate函数:
private async System.Threading.Tasks.Task Authenticate()
{
LiveAuthClient liveIdClient = new LiveAuthClient("<< INSERT REDIRECT DOMAIN HERE >>");
while (session == null)
{
// Force a logout to make it easier to test with multiple Microsoft Accounts
if (liveIdClient.CanLogout)
liveIdClient.Logout();
LiveLoginResult result = await liveIdClient.LoginAsync(new[] { "wl.basic" });
if (result.Status == LiveConnectSessionStatus.Connected)
{
session = result.Session;
LiveConnectClient client = new LiveConnectClient(result.Session);
LiveOperationResult meResult = await client.GetAsync("me");
MobileServiceUser loginResult = await App.MobileService.LoginAsync(result.Session.AuthenticationToken);
string title = …Run Code Online (Sandbox Code Playgroud)