public static ITickerCommunicationService CreateService(int whichService, bool useLogging) { if (whichService > maxServiceIndex) { throw new ArgumentOutOfRangeException(nameof(whichService)); } if (service != null) { service.StopRefreshing(); service.Dispose(); service = null; } switch (whichService) { case 0: service = new YComNewsService(useLogging); break; case 1: service = new RedditRSSNewsService(useLogging); break; case 2: service = new BBCNewsRSSNewsService(useLogging); break; case 3: service = new ArsTechnicaRSSNewsService(useLogging); break; } return(service); }
static ServiceSelector() { servicesItems = new Dictionary <int, List <string> >(); // populate pages for all services so we can display in settings window foreach (KeyValuePair <int, string> kvp in serviceList) { ITickerCommunicationService dummyService = CreateService(kvp.Key, false); var items = new List <string>(); foreach ((int, string description)s in dummyService.ViewIdsAndDescriptions) { items.Add(s.description); } servicesItems.Add(kvp.Key, items); dummyService.Dispose(); } }