public void BuidPage() { ApplicationContext.TaskSoftwareList = null; if (ApplicationContext.SoftwareList == null) { Functions.GetAllSoftware(); } if (ApplicationContext.UpdateSourceSoftwareList == null) { Functions.GetAllUpdateSourceSoftware(); } var updSourceSoftwares = ApplicationContext.UpdateSourceSoftwareList.Where( r => r.UpdateSourceId == ApplicationContext.SoftwareSelectedNodeId).Select(r => r.SoftwareId).ToList(); var softwareOfSource = ApplicationContext.SoftwareList.Where(r => updSourceSoftwares.Contains(r.Id) && r.UpdateSourceId == ApplicationContext.SoftwareSelectedNodeId); var scvl = new ObservableCollection <SoftwareContentView>(); foreach (var software in softwareOfSource) { var scv = new SoftwareContentView(software); scvl.Add(scv); } ViewList = scvl; }
private IEnumerable <SoftwareContentView> GetSoftwareCollection() { var softwareSelected = ApplicationContext.TaskSoftwareSelectedList .Where(c => c.TaskId == _taskItemViewModel.Id) .Select(c => c.SoftwareId); return(ApplicationContext.TaskSoftwareList.Select(c => { var softwareContent = new SoftwareContentView(c); if (softwareSelected.Contains(softwareContent.Id)) { softwareContent.IsSelected = true; } return softwareContent; })); }