コード例 #1
0
 private async Task SignOutAsync()
 {
     // Apply the Default role, which is represented by Guid.Empty.
     // The Default role is the one that is used when nobody is signed in.
     // Note that successfully applying the profile will result in the termination of all running apps, including this sample.
     await DeviceLockdownProfile.ApplyLockdownProfileAsync(Guid.Empty);
 }
コード例 #2
0
        private async Task SignInAsync()
        {
            // Extract the name and role of the item the user selected.
            ListBoxItem selectedItem = (ListBoxItem)UserRoles.SelectedItem;
            string      selectedName = (string)selectedItem.Content;
            Guid        selectedRole = (Guid)selectedItem.Tag;

            bool canSignIn;

            if (UseAzureAuthenticationCheckBox.IsChecked.Value)
            {
                canSignIn = await AuthenticateAzureRole(selectedRole, selectedName);
            }
            else
            {
                // If the sample should use local authentication,
                // then do some app-specific authentication here.
                // For this sample, we just assume anybody can sign in as any role.
                canSignIn = true;
            }

            if (canSignIn)
            {
                // Note that successfully applying the profile will result in the termination of all running apps, including this sample.
                await DeviceLockdownProfile.ApplyLockdownProfileAsync(selectedRole);
            }
        }