void GetFilteredAndSortedSites() { SitesList.Clear(); var localSitesDic = OnlineVideoSettings.Instance.SiteSettingsList.ToDictionary(s => s.Name, s => s); var onlyLocalSites = OnlineVideoSettings.Instance.SiteSettingsList.ToDictionary(s => s.Name, s => s); List <OnlineVideosWebservice.Site> filteredsortedSites = new List <OnlineVideos.OnlineVideosWebservice.Site>(Sites.Updater.OnlineSites); filteredsortedSites.ForEach(os => { if (localSitesDic.ContainsKey(os.Name)) { onlyLocalSites.Remove(os.Name); } }); filteredsortedSites.AddRange(onlyLocalSites.Select(ls => new OnlineVideosWebservice.Site() { Name = ls.Value.Name, IsAdult = ls.Value.ConfirmAge, Description = ls.Value.Description, Language = ls.Value.Language, LastUpdated = ls.Value.LastUpdated })); filteredsortedSites = filteredsortedSites.FindAll(SitePassesFilter); filteredsortedSites.Sort(CompareSiteForSort); foreach (OnlineVideosWebservice.Site site in filteredsortedSites) { if (!site.IsAdult || !OnlineVideoSettings.Instance.UseAgeConfirmation || OnlineVideoSettings.Instance.AgeConfirmed) { SiteSettings localSite = null; localSitesDic.TryGetValue(site.Name, out localSite); var loListItem = new OnlineSiteViewModel(site, localSite); SitesList.Add(loListItem); } } SitesList.FireChange(); }
void RebuildSitesList() { SitesList.Clear(); foreach (var site in OnlineVideoSettings.Instance.SiteUtilsList) { if (site.Value.Settings.IsEnabled && (!site.Value.Settings.ConfirmAge || !OnlineVideoSettings.Instance.UseAgeConfirmation || OnlineVideoSettings.Instance.AgeConfirmed)) { SitesList.Add(new SiteViewModel(site.Value)); } } SitesList.FireChange(); }
public void SelectSiteGroup(SiteGroupViewModel siteGroupModel) { if (BackgroundTask.Instance.IsExecuting) { return; } SitesList.Clear(); foreach (string siteName in siteGroupModel.Sites) { var siteutils = OnlineVideoSettings.Instance.SiteUtilsList; SitesList.Add(new SiteViewModel(siteutils[siteName])); } sitesListHasAllSites = false; SitesList.FireChange(); IWorkflowManager workflowManager = ServiceRegistration.Get <IWorkflowManager>(); workflowManager.NavigatePushAsync(Guids.WorkflowStateSites, new NavigationContextConfig() { NavigationContextDisplayLabel = siteGroupModel.Labels["Name"].ToString() }); }