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(); }
public Form4(List <File_struct> data, string url, string query, Form1 new_form) { InitializeComponent(); try { new_form_1 = new_form; new_form_1.Hide(); label1.Text = "Vaicājums: " + query + ", URL: " + url; for (int i = 0; i < data.Count; i++) { if (String.Compare(data[i].query, query) == 0 && String.Compare(data[i].url, url) == 0) { site.Add(new Site(data[i].query, data[i].url, data[i].pos, data[i].day.ToString() + "/" + data[i].month.ToString() + "/" + data[i].year.ToString())); } } } catch (Exception e) { MessageBox.Show("Вызвано исключение! \n" + e, "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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() }); }