public async void Login() { try { // object resultString; if (App.User == null) { App.User = await loginService.AuthenticateAsync(); LoggedIn = true; } else { toastService.ShowToast($"User {App.User.UserName} is already authenticated", "User authenticated"); } var authResult = await pushNotificationService.CreateInstallation(); App.User.UserName = authResult.UserId; Username = authResult.UserId; toastService.ShowToast($"User {Username} has authenticated successfully", "Success"); Groups = authResult.SharedDevices; clipboardService.DataCopiedToClipboard += (s, data) => { SharedData = data; }; pushNotificationService.NotificationReceived += async(s, e) => { e.Cancel = true; XmlDocument xDoc = e.ToastNotification.Content; string copiedText = xDoc.InnerText; App.IncomingCopiedText = copiedText; await Windows.ApplicationModel.Core.CoreApplication.MainView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { bool result = await clipboardService.IsTextSameWithClipboard(copiedText); if (!result) { DataPackage clipboardContent = new DataPackage(); clipboardContent.SetText(copiedText); Clipboard.SetContent(clipboardContent); } }); }; GetHistoryData(); } catch (Exception e) { toastService.ShowToast($"Error occured while authenticating user: {e.Message}", "Authentication failed"); } }