public MediaPlayer(ViewModelServiceContainer container, IMediaPlayer player, IValidator <MediaPlayer> validator, AudioDevices devices, Playlist playlist, Data.MediaPlayer model) : base(model, validator, container.Messenger) { _manager = container.LocalizationService; Player = player ?? throw new ArgumentNullException(nameof(player), $"{nameof(player)} {Resources.IsRequired}"); _name = model.Name; _audioDevices = devices; _sequence = model.Sequence; _createdBy = model.CreatedBy; _createdOn = model.CreatedOn; _updatedBy = model.UpdatedBy; _updatedOn = model.UpdatedOn; if (AudioDevices.Items.Count > 0) { Player.AudioDevice = AudioDevices.Items.FirstOrDefault(p => p.Name == Model.DeviceName) ?? AudioDevices.Items[0]; } InitializeSubscriptions(); InitiliazeCommands(); Validate(); }
public MediaPlayerMapper(ViewModelServiceContainer container, IMediaPlayer mediaPlayer, AudioDevices devices, IValidator <MediaPlayer> validator) : base(container, validator) { _mediaPlayer = mediaPlayer ?? throw new ArgumentNullException(nameof(mediaPlayer), $"{nameof(mediaPlayer)} {Resources.IsRequired}"); _devices = devices ?? throw new ArgumentNullException(nameof(devices), $"{nameof(devices)} {Resources.IsRequired}"); InitializeMapper(); }
public MediaPlayerMapper(ILocalizationService translator, IMediaPlayer mediaPlayer, AudioDevices devices, ISequenceProvider sequenceProvider, IMapleLog log, IValidator <MediaPlayer> validator) : base(translator, sequenceProvider, log, validator) { _mediaPlayer = mediaPlayer ?? throw new ArgumentNullException(nameof(mediaPlayer)); _devices = devices ?? throw new ArgumentNullException(nameof(devices)); InitializeMapper(); }
/// <summary> /// Initializes a new instance of the <see cref="MediaPlayers"/> class. /// </summary> /// <param name="manager">The manager.</param> /// <param name="playerFactory">The player factory.</param> /// <param name="repo">The repo.</param> /// <param name="devices">The devices.</param> /// <param name="dialog">The dialog.</param> public MediaPlayers(IMapleLog log, ILocalizationService translationService, IMediaPlayerMapper mediaPlayerMapper, Func <IMediaPlayer> playerFactory, Func <IMediaRepository> repo, AudioDevices devices, DialogViewModel dialog, ISequenceProvider sequenceProvider) : base(log, translationService, sequenceProvider) { _playerFactory = playerFactory ?? throw new ArgumentNullException(nameof(playerFactory)); _devices = devices ?? throw new ArgumentNullException(nameof(devices)); _dialog = dialog ?? throw new ArgumentNullException(nameof(dialog)); _repositoryFactory = repo ?? throw new ArgumentNullException(nameof(repo)); _mediaPlayerMapper = mediaPlayerMapper ?? throw new ArgumentNullException(nameof(mediaPlayerMapper)); }
/// <summary> /// Initializes a new instance of the <see cref="MediaPlayers"/> class. /// </summary> /// <param name="manager">The manager.</param> /// <param name="playerFactory">The player factory.</param> /// <param name="repositoryFactory">The repo.</param> /// <param name="devices">The devices.</param> /// <param name="dialog">The dialog.</param> public MediaPlayers(ViewModelServiceContainer container, IMediaPlayerMapper mediaPlayerMapper, Func <IMediaPlayer> playerFactory, Func <IMediaRepository> repositoryFactory, AudioDevices devices, DialogViewModel dialog) : base(container) { _playerFactory = playerFactory ?? throw new ArgumentNullException(nameof(playerFactory), $"{nameof(playerFactory)} {Resources.IsRequired}"); _devices = devices ?? throw new ArgumentNullException(nameof(devices), $"{nameof(devices)} {Resources.IsRequired}"); _dialog = dialog ?? throw new ArgumentNullException(nameof(dialog), $"{nameof(dialog)} {Resources.IsRequired}"); _repositoryFactory = repositoryFactory ?? throw new ArgumentNullException(nameof(repositoryFactory), $"{nameof(repositoryFactory)} {Resources.IsRequired}"); _mediaPlayerMapper = mediaPlayerMapper ?? throw new ArgumentNullException(nameof(mediaPlayerMapper), $"{nameof(mediaPlayerMapper)} {Resources.IsRequired}"); _notificationService = container.NotificationService; }
public NAudioMediaPlayer(ILoggingService log, IMessenger messenger, AudioDevices audioDevices, IWavePlayerFactory factory) : base(messenger, audioDevices) { _settings = new MediaFoundationReader.MediaFoundationReaderSettings { RepositionInRead = true, SingleReaderObject = false, RequestFloatOutput = false, }; _player = factory.GetPlayer(log); _player.PlaybackStopped += PlaybackStopped; _messenger.Subscribe <PlayingMediaItemMessage>(OnPlaybackStarted); OnPropertyChanged(nameof(VolumeMin)); OnPropertyChanged(nameof(VolumeMax)); }
public MainMediaPlayer(ViewModelServiceContainer container, IMediaPlayer player, IValidator <MediaPlayer> validator, AudioDevices devices, Playlist playlist, MediaPlayerModel model) : base(container, player, validator, devices, playlist, model) { IsPrimary = model.IsPrimary; _manager.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(ILocalizationService.CurrentLanguage)) { UpdateName(); } }; UpdateName(); }
protected BasePlayer(IMessenger messenger, AudioDevices audioDevices) { _messenger = messenger ?? throw new ArgumentNullException(nameof(messenger), $"{nameof(messenger)} {Resources.IsRequired}"); }
protected BasePlayer(IMessenger messenger, AudioDevices audioDevices) : base(messenger) { }