Exemplo n.º 1
0
        public SettingsViewModel(ISettingsHandler settingsHandler, IDisplayHandler displayHandler, IOpenFileDialog openFileDialog)
        {
            _settingsHandler            = settingsHandler ?? throw new ArgumentException("Parameter cannot be null", nameof(settingsHandler));
            _displayHandler             = displayHandler ?? throw new ArgumentException("Parameter cannot be null", nameof(displayHandler));
            _openFileDialog             = openFileDialog ?? throw new ArgumentException("Parameter cannot be null", nameof(openFileDialog));
            _checkInterval              = settingsHandler.GetCheckInterval();
            _autoStart                  = settingsHandler.GetAutoStart();
            _attachLastFileFromLocation = settingsHandler.GetAttachLastFileFromLocation();
            _lastFileToAttachLocation   = settingsHandler.GetLastFileToAttachLocation();
            var displays = _displayHandler.Get().Select(d => new DisplayViewModel(d, SaveDisplaySettings));

            _displays   = new ObservableCollection <DisplayViewModel>(displays);
            _isExpanded = settingsHandler.GetSettingsIsExpanded();
        }