private async Task RefreshAsync() { m_account = null; m_userNotificationManager = null; m_activeNotifications.Clear(); // The ConnectedDevices SDK does not support multi-user currently. When this support becomes available // the user would be sent via NavigationEventArgs. For now, just grab the first one if it exists. var connectedDevicesManager = ((App)Application.Current).ConnectedDevicesManager; if ((connectedDevicesManager.Accounts.Count > 0)) { m_account = connectedDevicesManager.Accounts[0]; if (m_account.UserNotifications != null) { m_userNotificationManager = connectedDevicesManager.Accounts[0].UserNotifications; } } RefreshButton.IsEnabled = (m_userNotificationManager != null); LogoutButton.IsEnabled = (m_account != null); if (m_account != null) { Description.Text = $"{m_account.Type} user "; } if (m_userNotificationManager != null) { m_userNotificationManager.CacheUpdated += Cache_CacheUpdated; await m_userNotificationManager.RefreshAsync(); } }
private void InitializeSubcomponents() { if (RegistrationState != AccountRegistrationState.InAppCacheAndSdkCache) { throw new Exception("Account must be in both SDK and App cache before subcomponents can be initialized"); } var account = new ConnectedDevicesAccount(Id, Type); UserNotifications = new UserNotificationsManager(m_platform, account); }
private void ClearSubcomponents() { UserNotifications.Reset(); UserNotifications = null; }