Beispiel #1
0
        public LocalProgram AddLocalProgram(LocalProgram program)
        {
            int newid = Insert(program);

            program.Id = newid;
            return(program);
        }
        public static LocalProgram LocalProgramFromRemoteProgram(RemoteProgram remoteProgram)
        {
            LocalProgram program = new LocalProgram();
            program.ProgramId = remoteProgram.ProgramId;
            program.Name = remoteProgram.Name;
            program.Description = remoteProgram.Description;
            program.ThumbnailPath = remoteProgram.ThumbnailPath;
            program.MoviePath = remoteProgram.MoviePath;
            program.State = "D";
            program.Downloaded = DateTime.Now;
            program.Expires = DateTime.Now.AddDays(14);
            program.StreamingUrl = remoteProgram.StreamingUrl;
            program.ThumbnailUrl = remoteProgram.ThumbnailUrl;

            return program;
        }
Beispiel #3
0
        public static LocalProgram LocalProgramFromRemoteProgram(RemoteProgram remoteProgram)
        {
            LocalProgram program = new LocalProgram();

            program.ProgramId     = remoteProgram.ProgramId;
            program.Name          = remoteProgram.Name;
            program.Description   = remoteProgram.Description;
            program.ThumbnailPath = remoteProgram.ThumbnailPath;
            program.MoviePath     = remoteProgram.MoviePath;
            program.State         = "D";
            program.Downloaded    = DateTime.Now;
            program.Expires       = DateTime.Now.AddDays(14);
            program.StreamingUrl  = remoteProgram.StreamingUrl;
            program.ThumbnailUrl  = remoteProgram.ThumbnailUrl;


            return(program);
        }
        /// <summary>
        /// Downloads a program - does not use threads, so should be called from in a off-main-ui thread.
        ///
        /// Called from the QueueDownloader, usually.
        /// </summary>
        /// <param name="program">
        /// A <see cref="LocalProgram"/>
        /// </param>
        public void DownloadLocalProgram(LocalProgram program)
        {
            Program               = new RemoteProgram();
            Program.ProgramId     = program.ProgramId;
            Program.Name          = program.Name;
            Program.Description   = program.Description;
            Program.ThumbnailPath = program.ThumbnailPath;
            Program.MoviePath     = program.MoviePath;
            Program.StreamingUrl  = program.StreamingUrl;
            Program.ThumbnailUrl  = program.ThumbnailUrl;


            if (!DownloadPathExists)
            {
                Directory.CreateDirectory(Path.Combine(BasePath, DownloadFilepath));
            }


            string imageUrl = Program.ThumbnailUrl;

            if (!string.IsNullOrEmpty(FullsizeImageUrl))
            {
                imageUrl = FullsizeImageUrl;
            }

            Program.ThumbnailPath = DownloadImageToFile(Path.Combine(BasePath, DownloadFilepath), Program.ProgramId, imageUrl);
            Program.ThumbnailPath = Program.ProgramId + "/" + Program.ThumbnailPath;

            Program.MoviePath = OutputFilename;

            if (string.IsNullOrEmpty(StreamingUrl))
            {
                OnDownloadFinished();
            }
            else
            {
                DownloadToFile(StreamingUrl, Path.Combine(BasePath, Program.MoviePath), OnDownloadProgress, OnDownloadFinished);
            }
        }
Beispiel #5
0
 public LocalProgramHelper(LocalProgram theProgram)
 {
     Program = theProgram;
 }
 public LocalProgramHelper(LocalProgram theProgram)
 {
     Program = theProgram;
 }
Beispiel #7
0
 public LocalProgram AddLocalProgram(LocalProgram program)
 {
     int newid = Insert(program);
     program.Id = newid;
     return program;
 }
        void HandleQueueDownloaderOnEnd(LocalProgram finishedProgram)
        {
            InvokeOnMainThread(delegate {
                Console.WriteLine("{0} is finished", finishedProgram.Name);

                AppDelegate.SessionDatabase.MarkProgramAsDownloaded(finishedProgram.Id);
            });
        }
        void HandleQueueDownloaderOnStart(LocalProgram startedProgram, int queueSize)
        {
            InvokeOnMainThread(delegate {
                Console.WriteLine("{0} has started", startedProgram.Name);

                TitleLabel.Text = startedProgram.Name;
                TitleLabel.SetNeedsDisplay();
                ImageView.Image = RemoteProgramHelper.GetFullsizeImageFromFile(startedProgram.ThumbnailPath, ImageView.Bounds);
                if (queueSize == 0)
                {
                    SubLabel.Text = "Downloading. No more items in the queue";
                } else if (queueSize == 1) {
                    SubLabel.Text = String.Format("Downloading. {0} item remaining to download", queueSize);
                } else {
                    SubLabel.Text = string.Format("Downloading. {0} items remaining to download", queueSize);
                }

                SubLabel.SetNeedsDisplay();
                ProgressBar.Progress = 0;
                ProgressBar.SetNeedsDisplay();

            });
        }
 void HandleQueueDownloaderOnProgress(LocalProgram currentProgram, float progress)
 {
     InvokeOnMainThread(delegate {
         Console.WriteLine("{0} has progressed", currentProgram.Name);
         ProgressBar.Progress = progress;
         ProgressBar.SetNeedsDisplay();
     });
 }
        /// <summary>
        /// Downloads a program - does not use threads, so should be called from in a off-main-ui thread.
        /// 
        /// Called from the QueueDownloader, usually.
        /// </summary>
        /// <param name="program">
        /// A <see cref="LocalProgram"/>
        /// </param>
        public void DownloadLocalProgram(LocalProgram program)
        {
            Program = new RemoteProgram();
            Program.ProgramId = program.ProgramId;
            Program.Name = program.Name;
            Program.Description = program.Description;
            Program.ThumbnailPath = program.ThumbnailPath;
            Program.MoviePath = program.MoviePath;
            Program.StreamingUrl = program.StreamingUrl;
            Program.ThumbnailUrl = program.ThumbnailUrl;

            if (!DownloadPathExists)
            {
                Directory.CreateDirectory(Path.Combine(BasePath,DownloadFilepath));
            }

            string imageUrl = Program.ThumbnailUrl;
            if (!string.IsNullOrEmpty(FullsizeImageUrl)) imageUrl = FullsizeImageUrl;

            Program.ThumbnailPath = DownloadImageToFile(Path.Combine(BasePath,DownloadFilepath), Program.ProgramId, imageUrl);
            Program.ThumbnailPath = Program.ProgramId + "/" + Program.ThumbnailPath;

            Program.MoviePath = OutputFilename;

            if (string.IsNullOrEmpty(StreamingUrl))
            {
                OnDownloadFinished();
            } else {
                DownloadToFile(StreamingUrl, Path.Combine(BasePath,Program.MoviePath), OnDownloadProgress, OnDownloadFinished);
            }
        }