Ejemplo n.º 1
0
        /// <summary>
        /// Checks if data source has a element after the passed as parameter
        /// </summary>
        /// <param name="current">Current element</param>
        /// <returns>True, if there is a next element, false if there is not</returns>
        public async Task <bool> HasNext(EntitiesBase.RssSearchResult current)
        {
            var data = await GetData();

            if (current == null || !data.Any())
            {
                return(false);
            }

            return(data.IndexOf(current) < data.Count - 1);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Retrieves the next element from source.
        /// </summary>
        /// <param name="current">Current element</param>
        /// <returns>The next element from items, if it exists. Otherwise, returns null</returns>
        public async Task <EntitiesBase.RssSearchResult> Next(EntitiesBase.RssSearchResult current)
        {
            var data = await GetData();

            if (current == null || !data.Any())
            {
                return(null);
            }

            var index = data.IndexOf(current);

            if (index == -1 || index == data.Count - 1)
            {
                return(null);
            }

            return(data[index + 1]);
        }