public InspectionUserControlViewModel(PowertracksRepository repository) { _repository = repository; RegattaCollection = new ObservableCollection <Regatta>(); RaceCollection = new PropChangeObservableCollection <Race>(); RaceCollection.ItemPropertyChanged += (sender, args) => { if (sender is Race race) { _repository.UpdateRace(race); } }; EntryCollection = new PropChangeObservableCollection <RaceEntry>(); EntryCollection.ItemPropertyChanged += (sender, args) => { if (sender is RaceEntry entry) { _repository.UpdateEntry(entry); } }; var regattas = _repository.GetRegattas(); foreach (var regatta in regattas) { RegattaCollection.Add(regatta); } }
public SetUpUserControlViewModel(PowertracksRepository repository) { _repository = repository; HomeDir = @"c:\data\data_entry"; RegattaCollection = new ObservableCollection <Regatta>(_repository.GetRegattas()); SelectedRegatta = RegattaCollection.FirstOrDefault(); }
public MainWindow() { InitializeComponent(); var repository = new PowertracksRepository(); SetUpUserControl.Repository = repository; ScanUserControl.Repository = repository; _setUpViewModel = new SetUpUserControlViewModel(repository); _setUpViewModel.PropertyChanged += SetUpUcViewModelOnPropertyChanged; SetUpUserControl.DataContext = _setUpViewModel; _scanViewModel = new ScanUserControlViewModel(repository); ScanUserControl.DataContext = _scanViewModel; UpdateScanUserControlFields(); _inspectViewModel = new InspectionUserControlViewModel(repository); InspectionUserControl.DataContext = _inspectViewModel; }
public ScanUserControlViewModel(PowertracksRepository repository) { _repository = repository; MatchResultCollection = new ObservableCollection <AutoEntryMatchResult>(); }