コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public SetUpUserControlViewModel(PowertracksRepository repository)
        {
            _repository = repository;

            HomeDir           = @"c:\data\data_entry";
            RegattaCollection = new ObservableCollection <Regatta>(_repository.GetRegattas());
            SelectedRegatta   = RegattaCollection.FirstOrDefault();
        }
コード例 #3
0
        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;
        }
コード例 #4
0
 public ScanUserControlViewModel(PowertracksRepository repository)
 {
     _repository           = repository;
     MatchResultCollection = new ObservableCollection <AutoEntryMatchResult>();
 }