private async Task DoHouseCleaning() { try { IPodcastDataSource podcastDataSource = BackgroundTaskServiceContext.Instance.GetService <PodcastDataSource>(); await podcastDataSource.DoHouseKeeping(); } catch (Exception e) { Debug.WriteLine("BackgroundTask.Run() - Error {0}", e); } //List<Task> pendingDownloads = new List<Task>(); /* TODO * PodcastGroup favorites = PodcastDataSource.Instance.GetGroup(Constants.FavoritesGroupId); * foreach (Podcast podcast in favorites.Podcasts) * { * foreach (Episode episode in podcast.Episodes) * { * if (episode.State == EpisodeState.PendingDownload) * { * pendingDownloads.Add(episode.Download()); * } * } * }*/ /*var tileContent = TileUpdateManager.GetTemplateContent(TileTemplateType.TileSquareText01); * var tileLines = tileContent.SelectNodes("tile/visual/binding/text"); * tileLines[0].InnerText = "test"; * TileNotification notification = new TileNotification(tileContent); * var updater = TileUpdateManager.CreateTileUpdaterForApplication(); * updater.Update(notification); * * Task.WaitAll(pendingDownloads.ToArray(), m_cancellationTokenSouce.Token);*/ }
private MediaElementWrapper(IServiceContext serviceContext) : base(serviceContext) { m_PodcastDataSource = serviceContext.GetService <IPodcastDataSource>(); SystemMediaTransportControls = SystemMediaTransportControls.GetForCurrentView(); SystemMediaTransportControls.ButtonPressed += SystemMediaTransportControls_ButtonPressed; SystemMediaTransportControls.IsPlayEnabled = true; SystemMediaTransportControls.IsPauseEnabled = true; // Periodically update position in playing episode and every 10 seconds save state too DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromMilliseconds(500); timer.Tick += (sender, e) => { Episode episode = NowPlaying; if (episode != null) { // don't update position when slider is being manipulated. if (!(episode.State is EpisodeStateScanning)) { episode.Position = Position; } if (DateTime.UtcNow.AddSeconds(-10) > m_LastSaveTime) { // save location Task t = m_PodcastDataSource.Store(); m_LastSaveTime = DateTime.UtcNow; } } }; timer.Start(); }
public GroupPage() { m_ServiceContext = ApplicationServiceContext.Instance; m_PodcastDataSource = m_ServiceContext.GetService <IPodcastDataSource>(); this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += navigationHelper_LoadState; }
public Tests() { var config = new Configuration(); _helper = new Helper(config); _helper.Setup(TestData.FileName); // sut _sut = new PodcastDataSource(new NpgsqlConnection(config.ConnectionString)); }
public GetPodcastQueryHandler(IPodcastDataSource dataSource) { _dataSource = dataSource; }
public void OnLoadState(PodcastGroup group, IPodcastDataSource podcastDatasource) { Data = group; m_PodcastDataSource = podcastDatasource; UpdateFields(); }