/// <summary>
 /// </summary>
 /// <param name="storage">
 /// </param>
 /// <param name="settingsSerializer">
 /// </param>
 /// <param name="downloader">
 /// </param>
 public ProfileService(
     IAsyncStorage storage, ISerializer <SettingsContract> settingsSerializer, IAsyncDownloader downloader)
 {
     this.storage            = storage;
     this.downloader         = downloader;
     this.settingsSerializer = settingsSerializer;
 }
Exemple #2
0
        private static void ManageDownloads(Options options)
        {
            var requests = new List <Task>(options.IDs.Count());
            IAsyncDownloader downloader = AsyncDownloaderFactory.CreateDownloader(options.Playlist, options.FileName, options.Format);

            foreach (var id in options.IDs)
            {
                requests.Add(downloader.DownloadAsync(id));
            }
            Task.WaitAll(requests.ToArray());
        }
Exemple #3
0
        public void UseAsyncDownloader()
        {
            ReleaseChecker releaseChecker = new ReleaseChecker();

            releaseChecker.UseAsyncDownloader <AsyncDownloader>();
            Assert.IsInstanceOf <AsyncDownloader>(releaseChecker.AsyncDownloader);

            IAsyncDownloader downloader = Substitute.For <IAsyncDownloader>();

            releaseChecker.UseAsyncDownloader(downloader);
            Assert.AreSame(downloader, releaseChecker.AsyncDownloader);
        }
 /// <summary>
 /// Initializes a new instance of the TrackViewModel class.
 /// </summary>
 public TrackViewModel(IAsyncDownloader downloader, ProfileService profileService)
 {
     this.downloader             = downloader;
     this.profileService         = profileService;
     this.ToggleFavouriteCommand = new CommandLink()
     {
         Command = new DelegateCommand(
             this.ToggleFavourite,
             () => this.downloader.IsAuthenticated),
         IconUrl          = AddToFavouritesIcon,
         HideWhenInactive = !IsInDesignMode
     };
 }
Exemple #5
0
        public void CheckEmptyArray()
        {
            string returnJson = "[]";

            ReleaseChecker   releaseChecker = new ReleaseChecker();
            IAsyncDownloader downloader     = Substitute.For <IAsyncDownloader>();

            downloader.DownloadAsync(null, 0).ReturnsForAnyArgs(Task.FromResult(returnJson));
            releaseChecker.UseAsyncDownloader(downloader);

            Release result = releaseChecker.Check().Result;

            Assert.AreEqual(null, result);
        }
Exemple #6
0
        public void CheckInvalidVersion()
        {
            string versionString = "v1.3.5.2150000000";
            string url           = "http://url.to/some?download#location";
            string returnJson    = string.Format(@"[ {{ ""html_url"": ""{0}"", ""tag_name"": ""{1}"" }} ]", url, versionString);

            ReleaseChecker   releaseChecker = new ReleaseChecker();
            IAsyncDownloader downloader     = Substitute.For <IAsyncDownloader>();

            downloader.DownloadAsync(null, 0).ReturnsForAnyArgs(Task.FromResult(returnJson));
            releaseChecker.UseAsyncDownloader(downloader);

            Release result = releaseChecker.Check().Result;

            Assert.AreEqual(null, result);
        }
        /// <summary>
        /// Initializes a new instance of the PlayPageViewModel class.
        /// </summary>
        public PlayPageViewModel(IAsyncDownloader downloader, ProfileService profileService)
        {
            this.downloader     = downloader;
            this.profileService = profileService;
            this.ApplicationBarButtonCommands = new ObservableCollection <ICommandLink>();
            this.ApplicationBarMenuCommands   = new ObservableCollection <ICommandLink>();
            this.PlayedPanel      = new MixPlayedTracksViewModel();
            this.ReviewsPanel     = new ReviewsPanelViewModel();
            this.ReviewMixCommand = new CommandLink
            {
                Command = new DelegateCommand(this.AddReview, this.CanAddReview),
                Text    = StringResources.Command_ReviewMix
            };
            this.LikeUnlikeCommand = new CommandLink
            {
                Command = new DelegateCommand(this.LikeUnlike, this.CanLikeUnlike),
                IconUrl = new Uri("/icons/appbar.heart2.empty.rest.png", UriKind.Relative),
                Text    = StringResources.Command_LikeMix
            };
            this.PinToStartCommand = new CommandLink
            {
                Command = new DelegateCommand(this.PinToStart), Text = StringResources.Command_PinToStart
            };

            this.ShareCommand = new CommandLink
            {
                Text    = StringResources.Command_ShareMix,
                Command = new DelegateCommand(this.Share, () => this.Mix != null)
            };
            this.ApplicationBarButtonCommands.Add(this.PlayedPanel.PlayPauseCommand);
            this.ApplicationBarButtonCommands.Add(this.PlayedPanel.NextTrackCommand);
            this.ApplicationBarButtonCommands.Add(this.LikeUnlikeCommand);
            this.ApplicationBarMenuCommands.Add(this.ReviewMixCommand);
            this.ApplicationBarMenuCommands.Add(this.PinToStartCommand);
            this.ApplicationBarMenuCommands.Add(this.ShareCommand);

            this.EmailCommand = new CommandLink
            {
                Text    = StringResources.Command_EmailMix,
                Command = new DelegateCommand(this.Email, () => this.Mix != null)
            };
            this.ApplicationBarMenuCommands.Add(this.EmailCommand);

            this.Title = StringResources.Title_Mix;
        }
 /// <summary>
 ///   Initializes a new instance of the UserProfilePageViewModel class.
 /// </summary>
 public UserProfilePageViewModel(IAsyncDownloader downloader, ProfileService profileService)
 {
     this.downloader      = downloader;
     this.profileService  = profileService;
     this.Mixes           = new UserProfileMixesViewModel(false, this.profileService);
     this.LikedMixes      = new UserProfileLikedMixesViewModel(false, this.profileService);
     this.Tracks          = new UserProfileTracksViewModel(false, this.profileService);
     this.FollowedByUsers = new FollowedByUsersViewModel(false, this.profileService);
     this.FollowsUsers    = new FollowsUsersViewModel(false, this.profileService);
     this.ApplicationBarButtonCommands = new ObservableCollection <ICommandLink>();
     this.ApplicationBarMenuCommands   = new ObservableCollection <ICommandLink>();
     this.ToggleFollowUserCommandLink  = new CommandLink()
     {
         Command = new DelegateCommand(this.ToggleFollowUser, this.CanToggleFollowUser),
         Text    = StringResources.Command_FollowUser,
         IconUrl = FollowUserIcon
     };
     this.ApplicationBarButtonCommands.Add(this.ToggleFollowUserCommandLink);
 }
Exemple #9
0
 public YouTubeService(IAsyncDownloader downloader)
 {
     this.downloader = downloader;
 }
Exemple #10
0
 public AsyncPlaylistDownloader(FileNameOptions fileName, IAsyncDownloader downloader)
     : base(fileName)
 {
     this.downloader = downloader;
 }
Exemple #11
0
 public void UseAsyncDownloader(IAsyncDownloader asyncDownloader)
 {
     this.AsyncDownloader = asyncDownloader;
 }