Example #1
0
        public Episode(
            string key,
            string title,
            string description,
            string itemThumbnail,
            DateTimeOffset publishDate,
            TimeSpan duration,
            string subtitle,
            Feed feed     = null,
            string feedId = "")
        {
            this.Id             = Guid.NewGuid();
            this.Key            = key;
            this.LocalFileName  = BackgroundDownloadHelper.SafeHashUri(new Uri(this.Key));
            this._title         = title;
            this._description   = description;
            this._itemThumbnail = itemThumbnail;

            this._publishDate = publishDate;
            this._duration    = duration;
            this.Subtitle     = subtitle;

            if (feed != null)
            {
                this._feed  = feed;
                this.FeedId = feed?.Uri?.ToString();
            }
            else if (!string.IsNullOrEmpty(feedId))
            {
                this.FeedId = feedId;
            }
        }
Example #2
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs args)
        {
            // XBOX support
            if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Xbox")
            {
                ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
                bool result = ApplicationViewScaling.TrySetDisableLayoutScaling(true);
            }

            await InitializeAsync();

            InitWindow(skipWindowCreation: args.PrelaunchActivated);

            // Tasks after activation
            await StartupAsync();

            await Window.Current.Dispatcher.RunIdleAsync(async (s) =>
                                                         await BackgroundDownloadHelper.AttachToDownloads());
        }
Example #3
0
        protected async override void OnBackgroundActivated(BackgroundActivatedEventArgs args)
        {
            var instance = args?.TaskInstance;

            await BackgroundDownloadHelper.CheckCompletionResult(instance);

            base.OnBackgroundActivated(args);
            if (args.TaskInstance.TriggerDetails is AppServiceTriggerDetails details && _container != null)
            {
                var remotePlayerService = _container.Resolve <IRemotePlayerService>();

                remotePlayerService.RemoteActivation(args.TaskInstance.GetDeferral(), details.AppServiceConnection);
                appServiceDeferral = args.TaskInstance.GetDeferral();

                Connection = details.AppServiceConnection;
                Connection.RequestReceived += OnRequestReceived;
                Connection.ServiceClosed   += AppServiceConnection_ServiceClosed;
            }
        }
Example #4
0
 public void DownloadEpisode(Episode episode)
 {
     var task = BackgroundDownloadHelper.Download(new System.Uri(episode.Key));
 }
Example #5
0
        public void DownloadCurrentEpisode()
        {
            var task = BackgroundDownloadHelper.Download(new Uri(CurrentEpisode.Key));

            task.ContinueWith(t => DownloadError?.Invoke(this, EventArgs.Empty), TaskContinuationOptions.OnlyOnFaulted);
        }