private async void Authenticate_Tapped(object sender, TappedRoutedEventArgs e) { try { this.IsEnabled = false; progressRing.Visibility = Visibility.Visible; var graph = new Graph(await MSAAuthenticator.GetAccessTokenAsync("User.Read")); //await (new MessageDialog(await graph.GetUserUniqueIdAsync())).ShowAsync(); var userId = await graph.GetUserUniqueIdAsync(); SecureKeyStorage.SetUserId(userId); } catch (Exception ex) { Debug.WriteLine($"Authenticate failed. {ex.ToString()}"); MainPage.Current.IsAskedAboutMSAPermission = false; MainPage.Current.isAskedAboutMSAPermissionThisTime = true; } finally { this.IsEnabled = true; FlyoutCloseRequest?.Invoke(this, new EventArgs()); } }
private async void ActivateFindingOtherDevices() { var graph = new Graph(await MSAAuthenticator.GetAccessTokenAsync("User.Read")); var userId = await graph.GetUserUniqueIdAsync(); SecureKeyStorage.SetUserId(userId); findOtherDevices = true; OnPropertyChanged("FindOtherDevices"); FindOtherDevicesProgressRingActive = false; FindOtherDevicesEnabled = true; #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed MainPage.Current.DiscoverOtherDevices(true); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed }