Example #1
0
        public Task RemoveLivestream(ChannelIdentifier channelIdentifier)
        {
            if (channelIdentifier == null)
            {
                throw new ArgumentNullException(nameof(channelIdentifier));
            }
            var matchingLivestreams = Livestreams.Where(x => Equals(channelIdentifier, x.ChannelIdentifier)).ToList();

            Livestreams.RemoveRange(matchingLivestreams);
            return(Task.CompletedTask);
        }
        private void PopulateLivestreams(List <LivestreamModel> livestreamModels)
        {
            foreach (var livestream in livestreamModels)
            {
                var livestreamModel = Livestreams.FirstOrDefault(x => Equals(livestream, x));
                livestreamModel?.PopulateSelf(livestream);
            }

            var newStreams     = livestreamModels.Except(Livestreams).ToList();
            var removedStreams = Livestreams.Except(livestreamModels).ToList();

            Livestreams.AddRange(newStreams);
            Livestreams.RemoveRange(removedStreams);
        }
        public async Task RemoveLivestream(ChannelIdentifier channelIdentifier)
        {
            if (channelIdentifier == null)
            {
                return;
            }

            await channelIdentifier.ApiClient.RemoveChannel(channelIdentifier);

            channelIdentifiers.Remove(channelIdentifier);
            // TODO - if removal of a channel would remove more than 1 livestream, consider warning the user
            var matchingLivestreams = Livestreams.Where(x => Equals(channelIdentifier, x.ChannelIdentifier)).ToList();

            Livestreams.RemoveRange(matchingLivestreams);
            SaveLivestreams();
        }