public AudioListItemViewModel( IPlayerService playerService, IEventAggregator eventAggregator, IDownloadManagerService downloadService, AudioCommandsProxy commandProxy) { Contract.Requires(playerService != null); Contract.Requires(eventAggregator != null); Contract.Requires(commandProxy != null); Contract.Requires(downloadService != null); this.playerService = playerService; this.eventAggregator = eventAggregator; this.commandProxy = commandProxy; this.downloadService = downloadService; State = PlayState.Stop; DownloadProgress = 0; SwitchLyricsStateCommand = new DelegateCommand(this.SwitchLyricsState); PlayCommand = new DelegateCommand(this.Play); ChangeStateCommand = new DelegateCommand(this.ChangeState); AddCommand = new DelegateCommand(async() => await this.Add()); DeleteCommand = new DelegateCommand(async() => await this.Delete()); RestoreCommand = new DelegateCommand(async() => await this.Restore()); DownloadCommand = new DelegateCommand(this.StartDownload); this.eventAggregator.GetEvent <AudioSelectedEvent>().Subscribe( audio => { State = PlayState.Stop; Deattach(); }, ThreadOption.UIThread, false, audio => audio != this && State != PlayState.Stop); }
public AudioController(IAudioService audioService, IEventAggregator eventAggregator, IPlayerService playerService, AudioCommandsProxy commandsProxy) { Contract.Requires(audioService != null); Contract.Requires(eventAggregator != null); Contract.Requires(commandsProxy != null); Contract.Requires(playerService != null); this.commandsProxy = commandsProxy; this.audioService = audioService; this.eventAggregator = eventAggregator; this.playerService = playerService; this.items = new ObservableCollection <IAudioListItemViewModel>(); ItemsView = CollectionViewSource.GetDefaultView(this.items); this.isShuffle = false; this.MoveNextCommand = new DelegateCommand(this.MoveNext, this.ValidateMove); this.MovePrevCommand = new DelegateCommand(this.MovePrev, this.ValidateMove); this.SwitchTimeProgressCommand = new DelegateCommand(this.SwitchTimeProgress, () => CurrentItem != null); Attach(); }
public AudioListItemViewModel( IPlayerService playerService, IEventAggregator eventAggregator, IDownloadManagerService downloadService, AudioCommandsProxy commandProxy) { Contract.Requires(playerService != null); Contract.Requires(eventAggregator != null); Contract.Requires(commandProxy != null); Contract.Requires(downloadService != null); this.playerService = playerService; this.eventAggregator = eventAggregator; this.commandProxy = commandProxy; this.downloadService = downloadService; State = PlayState.Stop; DownloadProgress = 0; SwitchLyricsStateCommand = new DelegateCommand(this.SwitchLyricsState); PlayCommand = new DelegateCommand(this.Play); ChangeStateCommand = new DelegateCommand(this.ChangeState); AddCommand = new DelegateCommand(async () => await this.Add()); DeleteCommand = new DelegateCommand(async () => await this.Delete()); RestoreCommand = new DelegateCommand(async () => await this.Restore()); DownloadCommand = new DelegateCommand(this.StartDownload); this.eventAggregator.GetEvent<AudioSelectedEvent>().Subscribe( audio => { State = PlayState.Stop; Deattach(); }, ThreadOption.UIThread, false, audio => audio != this && State != PlayState.Stop); }
public AudioController(IAudioService audioService, IEventAggregator eventAggregator, IPlayerService playerService, AudioCommandsProxy commandsProxy) { Contract.Requires(audioService != null); Contract.Requires(eventAggregator != null); Contract.Requires(commandsProxy != null); Contract.Requires(playerService != null); this.commandsProxy = commandsProxy; this.audioService = audioService; this.eventAggregator = eventAggregator; this.playerService = playerService; this.items = new ObservableCollection<IAudioListItemViewModel>(); ItemsView = CollectionViewSource.GetDefaultView(this.items); this.isShuffle = false; this.MoveNextCommand = new DelegateCommand(this.MoveNext, this.ValidateMove); this.MovePrevCommand = new DelegateCommand(this.MovePrev, this.ValidateMove); this.SwitchTimeProgressCommand = new DelegateCommand(this.SwitchTimeProgress, () => CurrentItem != null); Attach(); }