public FileImportViewModel(IFileImport fileImporter, ITagImport tagImport, TagImportOption tagImportOption, IEventAggregator eventAggregator, ILoggerFacade loggerFacade)
        {
            _fileImporter            = fileImporter;
            _tagImport               = tagImport;
            _tagImport.OnTagUpdated += OnFileImported;
            _tagImportOption         = tagImportOption;

            _eventAggregator = eventAggregator;
            _importLogger    = loggerFacade;

            _eventAggregator.GetEvent <StartScanSongsEvent>().Subscribe(async() => await OnImportFilesAsync());
            _eventAggregator.GetEvent <StopScanSongsEvent>().Subscribe(OnStopImport);
        }
示例#2
0
        public FileMenuViewModel(IHorsifySettings horsifySettings, TagImportOption tagImportOption, IEventAggregator eventAggregator)
            : base(horsifySettings)
        {
            _eventAggregator = eventAggregator;
            TagImportOption  = tagImportOption;

            //Commands
            ScanMusicCommand     = new DelegateCommand(OnScanMusic, () => !_isScanRunning);
            StopScanMusicCommand = new DelegateCommand(OnStopScanMusic, () => _isScanRunning);

            //Listen for scan completed event and update commands
            _eventAggregator.GetEvent <ScanSongsEndedEvent>().Subscribe(() =>
            {
                _isScanRunning = false;
                UpdateScanCommandsCanExecute();
            });
        }