public override void DidUpdateFocus(UITableView tableView, UITableViewFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            var ec = (context.NextFocusedItem as EpisodeCell);

            if (ec != null)
            {
                showEntriesViewController.Configure(ec);
            }
        }
Exemplo n.º 2
0
        public void DidUpdateFocus(UITableView tableView, UITableViewFocusUpdateContext context, UIFocusAnimationCoordinator coordinator)
        {
            var sc = (context.NextFocusedItem as SessionCell);

            if (sc != null)
            {
                var indexPath    = tableView.IndexPathForCell(sc);
                var startDate    = EventDates.ElementAt(indexPath.Section);
                var dateSessions = Sessions.Where(s => s.Starts.GetValueOrDefault().Date == startDate);
                var session      = dateSessions.ElementAt(indexPath.Row);
                //
                trackLabel.Text          = $"Track: {session.Track ?? "-"}";
                startsLabel.Text         = $"Starts: {session.Starts.GetValueOrDefault().ToLongTimeString()}";
                descriptionTextView.Text = session.CleanBody;
            }
        }
Exemplo n.º 3
0
        void DidUpdateFocus(UITableView tableView, UITableViewFocusUpdateContext focusUpdateContext, UIFocusAnimationCoordinator animationCoordinator)
        {
            NSIndexPath indexPath = focusUpdateContext.NextFocusedIndexPath;

            if (indexPath == null || PosterData?.Items?.Count == 0)
            {
                return;
            }

            if (ListViewImages == null || ListViewImages[indexPath.Row] == null)
            {
                //
                // Create and set a temporary 1 pixel by 1 pixel transparent bitmap image.
                //
                PosterImageView.Hidden = true;

                //
                // Start a background task to load the image.
                //
                Task.Run(async() =>
                {
                    //
                    // Load the image.
                    //
                    var client = new System.Net.Http.HttpClient();
                    var image  = await Utility.LoadImageFromUrlAsync(Crex.Application.Current.GetAbsoluteUrl(PosterData.Items[indexPath.Row].Image.BestMatch));

                    //
                    // Store the image in our cache.
                    //
                    ListViewImages[indexPath.Row] = image;

                    //
                    // Update the UI.
                    //
                    InvokeOnMainThread(() =>
                    {
                        NSIndexPath highlightedIndexPath = NSIndexPath.FromRowSection(-1, 0);

                        for (int i = 0; i < PosterData.Items.Count; i++)
                        {
                            var cell = ListView.CellAt(NSIndexPath.FromRowSection(i, 0));
                            if (cell != null && cell.Focused)
                            {
                                highlightedIndexPath = NSIndexPath.FromRowSection(i, 0);
                                break;
                            }
                        }

                        if (highlightedIndexPath.Row == indexPath.Row)
                        {
                            if (PosterImageView.Hidden == true)
                            {
                                PosterImageView.Alpha  = 0;
                                PosterImageView.Hidden = false;
                                UIView.Animate(Crex.Application.Current.Config.AnimationTime.Value / 1000.0f, () =>
                                {
                                    PosterImageView.Alpha = 1;
                                });
                            }

                            PosterImageView.Image = image;
                        }
                    });
                });
            }
            else
            {
                if (PosterImageView.Hidden == true)
                {
                    PosterImageView.Alpha  = 0;
                    PosterImageView.Hidden = false;
                    UIView.Animate(Crex.Application.Current.Config.AnimationTime.Value / 1000.0f, () =>
                    {
                        PosterImageView.Alpha = 1;
                    });
                }

                PosterImageView.Image = ListViewImages[indexPath.Row];
            }

            //
            // Update the text content about the item.
            //
            DetailLeftView.Text  = PosterData.Items[indexPath.Row].DetailLeft;
            DetailRightView.Text = PosterData.Items[indexPath.Row].DetailRight;
            DescriptionView.Text = PosterData.Items[indexPath.Row].Description;
        }