Exemplo n.º 1
0
        public MixItemViewModel(
            IMessenger messenger, 
            IMixItem mixItem,
            PlayPauseTrackCommand playPauseCommand,
            IMix mix,
            MixViewModel mixViewModel) : base(messenger)
        {
            this.mix = mix;
            this.mixViewModel = mixViewModel;
            if (messenger == null) throw new ArgumentNullException("messenger");
            if (mixItem == null) throw new ArgumentNullException("mixItem");
            if (playPauseCommand == null) throw new ArgumentNullException("playPauseCommand");
            if (mix == null) throw new ArgumentNullException("mix");
            if (mixViewModel == null) throw new ArgumentNullException("mixViewModel");
            MixItem = mixItem;
            PlayPauseCommand = playPauseCommand;
            messenger.Register<TransitionChangedEvent>(this, OnTransitionChanged);
            messenger.Register<PlaybackSpeedAdjustedEvent>(this, OnPlaybackSpeedAdjusted);
            messenger.Register<TrackUpdatedEvent>(this, OnTrackUpdated);

            messenger.Register<MixLockedEvent>(this, _ => RaisePropertyChanged(() => IsPitchFaderEnabled));
            messenger.Register<MixUnlockedEvent>(this, _ => RaisePropertyChanged(() => IsPitchFaderEnabled));

            // Required for play/pause status
            messenger.Register<PlayerPlayingEvent>(this, _ => RaisePropertyChanged(() => Track));
            messenger.Register<PlayerStoppedEvent>(this, _ => RaisePropertyChanged(() => Track));
            messenger.Register<ConfigSavedEvent>(this, _ => RaisePropertyChanged(() => ActualKey));
        }
Exemplo n.º 2
0
        public AudioPlayerViewModel(
            IMessenger messenger,
            OpenSettingsCommand openSettingsCommand,
            PlayPauseTrackCommand playPauseCommand,
            PlayPreviousTrackCommand playPreviousCommand,
            PlayNextTrackCommand playNextCommand,
            EditTrackCommand editTrackCommand,
            ShowInExplorerCommand showInExplorerCommand,
            DropItemIntoAudioPlayerCommand dropItemCommand)
            : base(messenger)
        {
            if (openSettingsCommand == null) throw new ArgumentNullException("openSettingsCommand");
            if (playPauseCommand == null) throw new ArgumentNullException("playPauseCommand");
            if (playPreviousCommand == null) throw new ArgumentNullException("playPreviousCommand");
            if (playNextCommand == null) throw new ArgumentNullException("playNextCommand");
            if (editTrackCommand == null) throw new ArgumentNullException("editTrackCommand");
            if (showInExplorerCommand == null) throw new ArgumentNullException("showInExplorerCommand");
            if (dropItemCommand == null) throw new ArgumentNullException("dropItemCommand");
            OpenSettingsCommand = openSettingsCommand;
            PlayPauseCommand = playPauseCommand;
            PlayPreviousCommand = playPreviousCommand;
            PlayNextCommand = playNextCommand;
            EditTrackCommand = editTrackCommand;
            ShowInExplorerCommand = showInExplorerCommand;
            DropItemCommand = dropItemCommand;

            messenger.Register<PlayerStoppedEvent>(this, _ => RaisePropertyChanged(() => Track));
            messenger.Register<PlayerLoadedEvent>(this, OnLoaded);
            messenger.Register<PlayerPlayingEvent>(this, _ => RaisePropertyChanged(() => Track));
        }
 public MixItemViewModelFactory(
     IMessenger messenger, 
     PlayPauseTrackCommand playPauseCommand)
 {
     if (messenger == null) throw new ArgumentNullException("messenger");
     if (playPauseCommand == null) throw new ArgumentNullException("playPauseCommand");
     this.messenger = messenger;
     this.playPauseCommand = playPauseCommand;
 }
        public ImportFilesAndPlayCommand(
            ITrackLibrary library, 
            IProgressDialogService progressDialog,
            PlayPauseTrackCommand playCommand) : base(library, progressDialog)
        {
            if (playCommand == null)
            {
                throw new ArgumentNullException("playCommand");
            }

            this.playCommand = playCommand;
        }
 public TrackLibraryItemViewModelFactory(
     IMessenger messenger, 
     IAudioPlayer player, 
     QuickEditBpmCommand quickEditBpmCommand, 
     QuickEditHarmonicKeyCommand quickEditHarmonicKeyCommand, 
     PlayPauseTrackCommand playPauseCommand)
 {
     if (messenger == null) throw new ArgumentNullException("messenger");
     if (player == null) throw new ArgumentNullException("player");
     if (quickEditBpmCommand == null) throw new ArgumentNullException("quickEditBpmCommand");
     if (quickEditHarmonicKeyCommand == null) throw new ArgumentNullException("quickEditHarmonicKeyCommand");
     if (playPauseCommand == null) throw new ArgumentNullException("playPauseCommand");
     this.messenger = messenger;
     this.player = player;
     this.quickEditBpmCommand = quickEditBpmCommand;
     this.quickEditHarmonicKeyCommand = quickEditHarmonicKeyCommand;
     this.playPauseCommand = playPauseCommand;
 }
Exemplo n.º 6
0
        public TrackLibraryViewModel(
            IMessenger messenger,
            ImportFilesIntoLibraryCommand importFilesCommand,
            RemoveTracksFromLibraryCommand removeTracksCommand,
            PlayPauseTrackCommand playCommand,
            SearchLibraryCommand searchCommand,
            ShowInExplorerCommand showInExplorerCommand,
            OpenSettingsCommand openSettingsCommand,
            EditTrackCommand editTrackCommand,
            ITrackLibraryItemViewModelFactory itemFactory)
            : base(messenger)
        {
            
            if (importFilesCommand == null) throw new ArgumentNullException("importFilesCommand");
            if (removeTracksCommand == null) throw new ArgumentNullException("removeTracksCommand");
            if (playCommand == null) throw new ArgumentNullException("playCommand");
            if (searchCommand == null) throw new ArgumentNullException("searchCommand");
            if (showInExplorerCommand == null) throw new ArgumentNullException("showInExplorerCommand");
            if (openSettingsCommand == null) throw new ArgumentNullException("openSettingsCommand");
            if (editTrackCommand == null) throw new ArgumentNullException("editTrackCommand");
            if (itemFactory == null) throw new ArgumentNullException("itemFactory");

            items = new ObservableCollection<TrackLibraryItemViewModel>();
            ItemsView = CollectionViewSource.GetDefaultView(items);
            PlayPauseCommand = playCommand;
            this.itemFactory = itemFactory;

            messenger.Register<TrackAddedToLibraryEvent>(this, OnTrackAddedToLibrary);
            messenger.Register<TrackRemovedFromLibraryEvent>(this, OnTrackRemoved);
            messenger.Register<SearchRequestedEvent>(this, OnSearchRequested);
            messenger.Register<SearchTextClearedEvent>(this, OnSearchTextCleared);
            messenger.Register<SearchBoxFocusRequestedEvent>(this, OnSearchBoxFocusRequested);
            messenger.Register<TrackLibraryLoadedEvent>(this, OnTrackLibraryLoaded);

            SearchCommand = searchCommand;
            ShowInExplorerCommand = showInExplorerCommand;
            OpenSettingsCommand = openSettingsCommand;
            EditTrackCommand = editTrackCommand;

            ImportFilesCommand = importFilesCommand;
            RemoveCommand = removeTracksCommand;
        }