Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Login of the user... (sign-in button)
- /// </summary>
- private void btnSignin_SessionChanged(object sender, LiveConnectSessionChangedEventArgs e)
- {
- if (e.Status == LiveConnectSessionStatus.Connected)
- {
- session = e.Session;
- infoTextBlock.Text = AppResources.sign1;
- client = new LiveConnectClient(e.Session);
- client.GetCompleted += new EventHandler<LiveOperationCompletedEventArgs>(OnGetCompleted);
- client.GetAsync("me", null);
- }
- else
- {
- infoTextBlock.Text = AppResources.sign2;
- client = null;
- }
- }
- void OnGetCompleted(object sender, LiveOperationCompletedEventArgs e)
- {
- // Prints information about logged user, displays button "continue"
- if (e.Error == null)
- {
- string firstName = "";
- string lastName = "";
- if (e.Result.ContainsKey("first_name") || e.Result.ContainsKey("last_name"))
- {
- if (e.Result.ContainsKey("first_name"))
- if (e.Result["first_name"] != null)
- firstName = e.Result["first_name"].ToString();
- if (e.Result.ContainsKey("last_name"))
- if (e.Result["last_name"] != null)
- lastName = e.Result["last_name"].ToString();
- infoTextBlock.Text = AppResources.sign1 + " " + firstName + " " + lastName;
- }
- else
- infoTextBlock.Text = AppResources.sign2;
- }
- else
- infoTextBlock.Text = AppResources.signError + e.Error.ToString();
- // Loads data from the net, displays buttons...
- LoadData();
- }
Advertisement
Add Comment
Please, Sign In to add comment