Exemplo n.º 1
0
 public void LoadPrograms(string sourceUrl)
 {
     programs = RemoteProgramHelper.GetRemoteProgramList(sourceUrl, false);
     UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
     controller.TableView.ReloadData();
     UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
 }
        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();
            });
        }
 public void LoadData()
 {
     if (programs == null)
     {
         programs = RemoteProgramHelper.GetRemoteProgramList(controller.ProgramDefinition.FeedUrl);
     }
 }
Exemplo n.º 4
0
            public void RequestImage(object state)
            {
                RemoteProgramHelper program = state as RemoteProgramHelper;

                program.GetImageIntoCache(delegate {
                    InvokeOnMainThread(delegate {
                        DisplayImage(program);
                    });
                });
            }
Exemplo n.º 5
0
            public void GetImageForCell(UITableViewCell cell, RemoteProgramHelper program)
            {
                if (program.HasImage)
                {
                    cell.ImageView.Image = program.Image;
                    cell.ImageView.Alpha = 1.0f;
                    return;
                }

                program.TempCell = cell;
                SetTempImage(program);
                ThreadPool.QueueUserWorkItem(RequestImage, program);
            }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            CloseButton.TouchUpInside += delegate {
                DismissModalViewControllerAnimated(true);
            };

            CloseButton.Hidden = true;

            queueDownloader       = new QueueDownloader();
            queueDownloader.Queue = AppDelegate.SessionDatabase.GetLocalQueuedPrograms();

            if (queueDownloader.Queue.Count > 0)
            {
                LocalProgram firstProgram = queueDownloader.Queue[0];

                TitleLabel.Text = firstProgram.Name;

                ImageView.Image = RemoteProgramHelper.GetFullsizeImageFromFile(firstProgram.ThumbnailPath, ImageView.Bounds);
                int queueSize = queueDownloader.Queue.Count;
                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);
                }


                ProgressBar.Progress = 0;
            }
            queueDownloader.OnStart       += HandleQueueDownloaderOnStart;
            queueDownloader.OnProgress    += HandleQueueDownloaderOnProgress;
            queueDownloader.OnEnd         += HandleQueueDownloaderOnEnd;
            queueDownloader.OnNoMoreItems += HandleQueueDownloaderOnNoMoreItems;

            UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            UIApplication.SharedApplication.IdleTimerDisabled = true;
            queueDownloader.Start();
        }
Exemplo n.º 7
0
            public void DisplayImage(RemoteProgramHelper program)
            {
                program.TempCell.ImageView.Image = program.Image;



                //UIView.BeginAnimations("imageThumbnailTransitionIn");
                //UIView.SetAnimationDuration(0.5f);



                program.TempCell.ImageView.Alpha = 1.0f;
                program.TempCell.SetNeedsDisplay();
                //UIView.CommitAnimations();



                program.TempCell = null;
            }
Exemplo n.º 8
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            //File.Delete(Path.Combine (DocumentsFolder, "onthetele.db"));
            SessionDatabase = new Database.Database(Path.Combine(DocumentsFolder, "onthetele.db"));

            //add the removing of old stuff in here

            RemoteProgramHelper.ClearImageCache();
            RemoteProgramHelper.CleanupCache();

            List <UIViewController> viewControllers = new List <UIViewController>(tabbarController.ViewControllers);

            // add in a view controller for each category
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.News));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.Children));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.Comedy));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.Drama));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.Entertainment));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.Factual));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.Films));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.LifestyleAndLeisure));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.Music));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.ReligionAndEthics));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.Sport));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.SignZone));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.AudioDescribed));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.NorthernIreland));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.Scotland));
            viewControllers.Add(OnlineProgramViewController.GetNavigationController(OnlineProgramDefinition.Wales));



            tabbarController.ViewControllers = viewControllers.ToArray();
            tabbarController.MoreNavigationController.NavigationBar.BarStyle = UIBarStyle.Black;
            tabbarController.CustomizableViewControllers = null;

            window.AddSubview(tabbarController.View);
            window.MakeKeyAndVisible();

            return(true);
        }
Exemplo n.º 9
0
            // Customize the appearance of table view cells.
            public override UITableViewCell GetCell(UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath)
            {
                string cellIdentifier = "Cell";
                var    cell           = tableView.DequeueReusableCell(cellIdentifier);

                if (cell == null)
                {
                    cell = new UITableViewCell(UITableViewCellStyle.Subtitle, cellIdentifier);
                }


                RemoteProgramHelper program = new RemoteProgramHelper(programs[indexPath.Row]);



                cell.TextLabel.Text = program.Program.Name;


                cell.DetailTextLabel.Text = program.Program.Description;
                cell.DetailTextLabel.Font = UIFont.SystemFontOfSize(IplayerConst.DetailTextLabelSize);


                if (program.DownloadedFileExists)
                {
                    cell.Accessory = UITableViewCellAccessory.Checkmark;
                }
                else
                {
                    cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
                }

                cell.ImageView.Alpha = 1.0f;
                GetImageForCell(cell, program);

                //cell.ImageView.Image = program.Image;
                return(cell);
            }
Exemplo n.º 10
0
        public void WorkerThread()
        {
            int processed = 1;

            foreach (LocalProgram program in Queue)
            {
                OnStart(program, Queue.Count - processed);

                RemoteProgramHelper remoteProgramHelper = new RemoteProgramHelper(null);
                remoteProgramHelper.OnDownloadProgress += delegate(float amountDone) {
                    OnProgress(program, amountDone);
                };

                remoteProgramHelper.OnDownloadFinished += delegate() {
                    OnEnd(program);
                };

                remoteProgramHelper.DownloadLocalProgram(program);

                processed++;
            }

            OnNoMoreItems();
        }
Exemplo n.º 11
0
 public void SetTempImage(RemoteProgramHelper program)
 {
     program.TempCell.ImageView.Image = ImageHelper.TempImage;
 }