/// <summary> /// Prepares the app for use. /// </summary> private async Task InitalizeAsync() { Application.Current.UnhandledException += (s, e) => AsyncErrorHandler.HandleException(e.Exception); AuthenticationHelper.UserLoggedIn += async(s, e) => { User = e; SynchronizationHelper.RecursiveRegisterPropertyChanged(e); var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync(); var hub = new NotificationHub(HubName, HubEndpoint); await hub.RegisterNativeAsync(channel.Uri, new[] { User.Email }); }; await AuthenticationHelper.TryLogInSilently(); if (App.User != null) { Window.Current.Content = new Views.Shell(); } else { Window.Current.Content = new Views.Welcome(); } Window.Current.Activate(); }