Exemple #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (tenant == "contoso.onmicrosoft.com" || clientId == "{...}")
            {
                // The user has not configured the sample for Azure Authentication.
                UseAzureAuthenticationCheckBox.IsEnabled = false;
                UseAzureAuthenticationCheckBox.IsChecked = false;
                rootPage.NotifyUser("This sample has not been configured for Azure Authentication.", NotifyType.ErrorMessage);
            }

            try
            {
                // If the current role is Guid.Empty, then the user is not signed in.
                Guid currentRole = DeviceLockdownProfile.GetCurrentLockdownProfile();
                if (currentRole == Guid.Empty)
                {
                    SignInStatus.Text = "You are not signed in.";
                    canSignOut        = false;
                }
                else
                {
                    DeviceLockdownProfileInformation currentProfile = DeviceLockdownProfile.GetLockdownProfileInformation(currentRole);
                    SignInStatus.Text = "You are signed in as " + currentProfile.Name;
                    canSignOut        = true;
                }
                SignOutButton.IsEnabled = canSignOut;
                LoadApplicationUsers();
            }
            catch (System.IO.FileNotFoundException)
            {
                rootPage.NotifyUser("Assigned Access is not configured on this device.", NotifyType.ErrorMessage);
            }
        }
Exemple #2
0
        private void LoadApplicationUsers()
        {
            // Add the available roles.
            foreach (Guid roleId in DeviceLockdownProfile.GetSupportedLockdownProfiles())
            {
                DeviceLockdownProfileInformation profile = DeviceLockdownProfile.GetLockdownProfileInformation(roleId);
                UserRoles.Items.Add(new ListBoxItem()
                {
                    Content = profile.Name, Tag = roleId
                });
            }

            // If there are roles available, then pre-select the first one and enable the Sign In button.
            if (UserRoles.Items.Count > 0)
            {
                UserRoles.SelectedIndex = 0;
                SignInButton.IsEnabled  = true;
            }
        }