locked
Display User domain on page Load

    Question

  • Hello,

    I am using the User domain example and trying to display the display name on page load instead of on button click. I want it to load after the extended splash page.

    Here is the code I use:

    async void GetDNSDomain_Click(object sender, RoutedEventArgs e)
    {
       if (!Windows.System.UserProfile.UserInformation.NameAccessAllowed)
       {
          DomainResultText.Text = "Access to user information is disabled by the user or administrator";
       }
       else
       {
          DomainResultText.Text = "Beginning asynchronous operation.";
          String dns = await Windows.System.UserProfile.UserInformation.GetDomainNameAsync();
          if (String.IsNullOrEmpty(dns))
          {
    
             DomainResultText.Text = "No DNS domain name returned for the current user.";
          }
          else
          {
             DomainResultText.Text = dns;
          }
       }
    }

    Any help on how to do this would be great.

    Wednesday, March 26, 2014 2:04 PM

Answers

  • put the code in a event handler for the loaded event of page?

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, March 26, 2014 2:21 PM