void FillFaults() { for (int i = 0; i < Section.Faults.Count; i++) { Faults.Add(new FaultViewModel(Section.Faults[i])); } _faultsLinker = new ObservableCollectionsConnector <IFaultLog, IFaultViewModel>(Section.Faults, Faults, ConstructNewFault, log => Faults.FirstOrDefault(e => e.Fault == log)); }
private void FillPsnMeters(IPsnLog psnLog, TrendChartType trendChartType) { foreach (var psnMeter in psnLog.Meters) { PsnMeters.Add(new PsnMeterViewModel(psnMeter, trendChartType)); } _psnMetersConnector = new ObservableCollectionsConnector <IPsnMeter, IPsnMeterViewModel>(psnLog.Meters, PsnMeters, OnConstructDestItem, OnGetDestItem); }
private void FillSections(ILocomotive locomotive) { for (int i = 0; i < locomotive.Sections.Count; i++) { Sections.Add(new SectionViewModel(locomotive.Sections[i], i + 1, this)); } // Связываем модель представления секций с секциями из модели данных. _sectionsLinker = new ObservableCollectionsConnector <ISection, ISectionViewModel> (locomotive.Sections, Sections, OnNewSectionAdded, section => Sections.FirstOrDefault(e => e.Section == section)); }
private void FillLocomotives(IRepository repository) { foreach (var locomotive in repository.Locomotives) { Locomotives.Add(new LocomotiveViewModel(locomotive)); } // Связываем модель представления локомотивов с локомотивами из модели данных. _locomotivesLinker = new ObservableCollectionsConnector <ILocomotive, ILocomotiveViewModel> (repository.Locomotives, Locomotives, OnNewLocomotiveAdded, locomotive => Locomotives.FirstOrDefault(e => e.Locomotive == locomotive)); }
void FillPsnLogs() { foreach (var psnLog in Section.Psns) { if (psnLog.LogType == PsnLogType.FixedLength) { PsnLogs.Add(new PsnLogViewModel(psnLog, TrendChartType.Psn)); } else if (psnLog.LogType == PsnLogType.PowerDepended) { PsnPowerOnLogs.Add(new PsnLogViewModel(psnLog, TrendChartType.Psn)); } } _psnLogsLinker = new ObservableCollectionsConnector <IPsnLog, IPsnLogViewModel> (Section.Psns, PsnLogs, ConstructNewPsnLog, GetPsnLogsDestItem); _psnPowerOnLogsLinker = new ObservableCollectionsConnector <IPsnLog, IPsnLogViewModel> (Section.Psns, PsnPowerOnLogs, ConstructNewPsnPowerOnLog, GetPsnPowerOnLogDestItem); }