public override void ViewDidLoad() { base.ViewDidLoad( ); // setup the table view and general background view colors SeriesTable = new UITableView( ); SeriesTable.Layer.AnchorPoint = CGPoint.Empty; SeriesTable.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); SeriesTable.SeparatorStyle = UITableViewCellSeparatorStyle.None; View.AddSubview(SeriesTable); // setup the messages list Messages = new List <MessageEntry>(); TableSource source = new TableSource(this, Messages, Series); SeriesTable.Source = source; SeriesTable.Delegate = new TableViewDelegate(source, Task.NavToolbar); // log the series they tapped on. MessageAnalytic.Instance.Trigger(MessageAnalytic.BrowseSeries, Series.SeriesName); IsVisible = true; for (int i = 0; i < Series.Messages.Count; i++) { MessageEntry messageEntry = new MessageEntry(); Messages.Add(messageEntry); messageEntry.Message = Series.Messages[i]; } // do we have the real image? if (TryLoadImage(NotesTask.FormatBillboardImageName(Series.SeriesName)) == false) { // no, so use a placeholder and request the actual image SeriesBillboard = new UIImage(NSBundle.MainBundle.BundlePath + "/" + PrivateNoteConfig.NotesMainPlaceholder); // request! FileCache.Instance.DownloadFileToCache(Series.BillboardUrl, NotesTask.FormatBillboardImageName(Series.SeriesName), null, delegate { Rock.Mobile.Threading.Util.PerformOnUIThread( delegate { if (IsVisible == true) { TryLoadImage(NotesTask.FormatBillboardImageName(Series.SeriesName)); } }); }); } }
void SetupSeriesEntries(List <Series> seriesList) { SeriesEntries.Clear( ); for (int i = 0; i < seriesList.Count; i++) { // add the entry to our list SeriesEntry entry = new SeriesEntry(); SeriesEntries.Add(entry); // copy over the series and give it a placeholder image entry.Series = seriesList[i]; // attempt to load / download images. // for billboards, we ONLY CARE about loading the first series' billboard. if (i == 0) { bool imageExists = TryLoadImage(ref entry.mBillboard, NotesTask.FormatBillboardImageName(entry.Series.SeriesName)); if (imageExists == false) { FileCache.Instance.DownloadFileToCache(entry.Series.BillboardUrl, NotesTask.FormatBillboardImageName(entry.Series.SeriesName), null, delegate { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { if (IsVisible == true) { TryLoadImage(ref entry.mBillboard, NotesTask.FormatBillboardImageName(entry.Series.SeriesName)); } }); }); } } // for everything, we care about the thumbnails bool thumbExists = TryLoadImage(ref entry.mThumbnail, NotesTask.FormatThumbImageName(entry.Series.SeriesName)); if (thumbExists == false) { FileCache.Instance.DownloadFileToCache(entry.Series.ThumbnailUrl, NotesTask.FormatThumbImageName(entry.Series.SeriesName), null, delegate { Rock.Mobile.Threading.Util.PerformOnUIThread(delegate { if (IsVisible == true) { TryLoadImage(ref entry.mThumbnail, NotesTask.FormatThumbImageName(entry.Series.SeriesName)); } }); }); } } }