示例#1
0
        private async Task <int> CheckForNotificationsInternal(bool showToasts = false)
        {
            var unreadCount = 0;

            if (!AuthenticationService.Current.IsLoggedIn)
            {
                UpdateTileCount(0, false);
                return(unreadCount);
            }

            try
            {
                var response = await _vidMeClient.GetUnreadNotificationCountAsync();

                unreadCount = response;

                if (showToasts && unreadCount > 0)
                {
                    var notifications = await _vidMeClient.GetNotificationsAsync(unreadCount);

                    if (notifications != null && !notifications.Notifications.IsNullOrEmpty())
                    {
                        if (_notifications == null)
                        {
                            _notifications = notifications.Notifications;
                        }
                    }
                }

                UpdateTileCount(unreadCount, unreadCount > 0 && showToasts);
            }
            catch (Exception ex)
            {
            }

            return(unreadCount);
        }