public SimpleImportResultsDialog(ISimpleImportCompletedPayload importResults) { InitializeComponent(); var paragraph = new Paragraph(); paragraph.Inlines.Add(System.IO.File.ReadAllText(importResults.ErrorFile)); var document = new FlowDocument(paragraph); FlowDocReader.Document = document; }
/// <summary> /// Requeries the specified payload. /// </summary> /// <param name="payload">The payload.</param> private void Requery(ISimpleImportCompletedPayload payload) { if (!payload.Inserted.Any()) { return; } if (payload.CountInserted > 0) { OnLoad(); } }
private void Requery(ISimpleImportCompletedPayload payload) { //MappedCustomRegionToPopulationCount = HospitalRegistryService.GetCustomRegionToPopulationMappingCount(); //if (!payload.Inserted.OfType<CustomRegion>().Any()) return; //Func<MonahrqRegion, RegionViewModel> vcmFactory = (reg) => new RegionViewModel(Controller, reg); //if (payload.CountInserted > 0) //{ // Items = new ObservableCollection<RegionViewModel>(Controller.Regions.Select(region => vcmFactory(region.Region))); // ItemsView = new ListCollectionView(Items); //} }
private void Requery(ISimpleImportCompletedPayload payload) { if (!payload.Inserted.OfType <Hospital>().Any()) { return; } var inserted = payload.Inserted.Select(hosp => new HospitalViewModel() { Hospital = hosp as Hospital }); var existing = HospitalsCollectionView == null? Enumerable.Empty <HospitalViewModel>() : HospitalsCollectionView.SourceCollection as IEnumerable <HospitalViewModel>; if (HospitalsCollectionView != null) { HospitalsCollectionView.DetachFromSourceCollection(); } HospitalsCollectionView = CollectionViewSource.GetDefaultView(new ObservableCollection <HospitalViewModel>(existing.OfType <HospitalViewModel>().Concat(inserted))) as ListCollectionView; }