public TranscodingController(IMessageService messageService, IShellService shellService, IMusicFileContext musicFileContext, ISelectionService selectionService,
                              TranscodingService transcodingService, Lazy <ITranscoder> transcoder, Lazy <TranscodingListViewModel> transcodingListViewModel)
 {
     this.messageService              = messageService;
     this.shellService                = shellService;
     this.musicFileContext            = musicFileContext;
     this.selectionService            = selectionService;
     this.transcodingService          = transcodingService;
     this.transcoder                  = transcoder;
     this.transcodingListViewModel    = transcodingListViewModel;
     this.cancellationTokenSources    = new Dictionary <TranscodeItem, CancellationTokenSource>();
     this.convertToMp3AllCommand      = new DelegateCommand(ConvertToMp3All, CanConvertToMp3All);
     this.convertToMp3SelectedCommand = new DelegateCommand(ConvertToMp3Selected, CanConvertToMp3Selected);
     this.cancelAllCommand            = new DelegateCommand(CancelAll, CanCancelAll);
     this.cancelSelectedCommand       = new DelegateCommand(CancelSelected, CanCancelSelected);
     this.throttler          = new SemaphoreSlim(Environment.ProcessorCount); // Do not dispose the throttler; it is used after Shutdown to cancel the open tasks
     this.transcodingManager = new TranscodingManager();
 }
 public TranscodingController(IMessageService messageService, IShellService shellService, IMusicFileContext musicFileContext, ISelectionService selectionService,
                              TranscodingService transcodingService, Lazy <ITranscoder> transcoder, Lazy <TranscodingListViewModel> transcodingListViewModel)
 {
     this.messageService           = messageService;
     this.shellService             = shellService;
     this.musicFileContext         = musicFileContext;
     this.selectionService         = selectionService;
     this.transcodingService       = transcodingService;
     this.transcoder               = transcoder;
     this.transcodingListViewModel = transcodingListViewModel;
     cancellationTokenSources      = new Dictionary <TranscodeItem, CancellationTokenSource>();
     convertToMp3AllCommand        = new DelegateCommand(ConvertToMp3All, CanConvertToMp3All);
     convertToMp3SelectedCommand   = new DelegateCommand(ConvertToMp3Selected, CanConvertToMp3Selected);
     cancelAllCommand              = new DelegateCommand(CancelAll, CanCancelAll);
     cancelSelectedCommand         = new DelegateCommand(CancelSelected, CanCancelSelected);
     throttler          = new SemaphoreSlim(Environment.ProcessorCount); // Do not dispose the throttler; it is used after Shutdown to cancel the open tasks
     transcodingManager = new TranscodingManager();
     throttledMusicFilesCollectionChangedAction = new ThrottledAction(ThrottledMusicFilesCollectionChanged, ThrottledActionMode.InvokeOnlyIfIdleForDelayTime, TimeSpan.FromMilliseconds(10));
 }