Example #1
0
        public ViewController(
            ISessionFactory sessionFactory,
            IProjectFactory projectFactory,
            IIbtFileParser telemetryFileParser,
            IOptionsMonitor <iRacingTelemetryOptions> optionsAccessor,
            ILog log,
            IServiceProvider serviceProvider,
            IDisplayInfoService displayInfoService)
        {
            _serviceProvider = serviceProvider;

            _sessionFactory      = (sessionFactory == null) ? throw new ArgumentNullException(nameof(sessionFactory)) : sessionFactory;
            _projectFactory      = (projectFactory == null) ? throw new ArgumentNullException(nameof(projectFactory)) : projectFactory;
            _displayInfoService  = (displayInfoService == null) ? throw new ArgumentNullException(nameof(displayInfoService)) : displayInfoService;
            _telemetryFileParser = (telemetryFileParser == null) ? throw new ArgumentNullException(nameof(telemetryFileParser)) : telemetryFileParser;

            _options = (optionsAccessor == null) ? throw new ArgumentNullException(nameof(optionsAccessor)) : optionsAccessor.CurrentValue;
            Log      = (log == null) ? throw new ArgumentNullException(nameof(log)) : log;

            MdiChildren = new ObservableCollection <IMdiChildForm>();
            MdiChildren.CollectionChanged += MdiChildren_CollectionChanged;

            PropertyChanged += TelemetryViewController_PropertyChanged;
            ProjectClosing  += TelemetryViewController_ProjectClosing;

            Task.Run(async() =>
            {
                await LoadFieldDefinitionsAsync();
                FieldDefinitions.CollectionChanged += FieldDefinitions_CollectionChanged;

                await LoadFieldDisplayInfos();
                FieldDisplayInfos.CollectionChanged += FieldDisplayInfos_CollectionChanged;
            });
        }
 public EventManagement(IEventService eventService, IFileService fileService, IObtainFileService obtainFileService, IValidateFile validateFile, IDisplayInfoService displayInfoService)
 {
     _eventService       = eventService ?? throw new ArgumentNullException(nameof(eventService));
     _fileService        = fileService ?? throw new ArgumentNullException(nameof(fileService));
     _obtainFileService  = obtainFileService ?? throw new ArgumentNullException(nameof(obtainFileService));
     _validateFile       = validateFile ?? throw new ArgumentNullException(nameof(validateFile));
     _displayInfoService = displayInfoService ?? throw new ArgumentNullException(nameof(displayInfoService));
 }