Exemple #1
0
 public AudioInfoCacheOnlyProvider(AudioInfo.AudioInfoFactory infoFactory,
                                   IAudioStorage cache,
                                   long userId,
                                   PlayingStateChangedEventHandler optionalStateChangedHandler = null)
 {
     __InfoFactory = infoFactory;
     __Cache       = cache;
     __UserId      = userId;
     __OptionalStateChangedHandler = optionalStateChangedHandler;
 }
Exemple #2
0
 public AudioInfoProvider(Func <long, int, int, ReadOnlyCollection <Audio> > getAudio,
                          Func <long, int> getCount,
                          AudioInfo.AudioInfoFactory infoFactory,
                          long userId,
                          PlayingStateChangedEventHandler optionalStateChangedHandler = null)
 {
     __GetAudio    = getAudio;
     __GetCount    = getCount;
     __InfoFactory = infoFactory;
     __UserId      = userId;
     __OptionalStateChangedHandler = optionalStateChangedHandler;
 }
Exemple #3
0
        private AudioInfo.AudioInfoFactory GetFactory(IWebDownloader downloader, out PlayingStateChangedEventHandler handler)
        {
            var factory = new AudioInfo.AudioInfoFactory(__AudioStorage, downloader);

            handler = playable =>
            {
                if (__IsDisposingNow == 0)
                {
                    if (playable.State == PlayingState.Playing)
                    {
                        __OpenedChannels.Add(playable);
                    }
                    else if (playable.State == PlayingState.Stopped)
                    {
                        __OpenedChannels.Remove(playable);
                    }
                }
            };
            return(factory);
        }
Exemple #4
0
            public AudioInfo Create(long userId,
                                    int index,
                                    IAudio audio,
                                    Uri url,
                                    PlayingStateChangedEventHandler handler = null)
            {
                var info = new AudioInfo(__Storage,
                                         __Downloader,
                                         audio.AudioId,
                                         userId,
                                         audio.Title,
                                         audio.Artist,
                                         audio.Duration,
                                         index,
                                         url);

                if (handler != null)
                {
                    info.Playable.PlayingStateChanged += handler;
                }
                return(info);
            }
Exemple #5
0
            public AudioInfo Create(long userId,
                int index,
                IAudio audio,
                Uri url,
                PlayingStateChangedEventHandler handler = null)
            {
                var info = new AudioInfo(__Storage,
                    __Downloader,
                    audio.AudioId,
                    userId,
                    audio.Title,
                    audio.Artist,
                    audio.Duration,
                    index,
                    url);

                if (handler != null)
                {
                    info.Playable.PlayingStateChanged += handler;
                }
                return info;
            }
Exemple #6
0
 private AudioInfo.AudioInfoFactory GetFactory(IWebDownloader downloader, out PlayingStateChangedEventHandler handler)
 {
     var factory = new AudioInfo.AudioInfoFactory(__AudioStorage, downloader);
     handler = playable =>
     {
         if (__IsDisposingNow == 0)
         {
             if (playable.State == PlayingState.Playing)
                 __OpenedChannels.Add(playable);
             else if (playable.State == PlayingState.Stopped)
                 __OpenedChannels.Remove(playable);
         }
     };
     return factory;
 }