Example #1
0
        private void InitializeGestures()
        {
            _headerImageTapGesture = new UITapGestureRecognizer(() => {
                var context = new ModalViewContext(
                    ModalViewKind.FullscreenImage,
                    ImageBackground.ImageUrl);

                if (ShowHideModalViewCommand != null &&
                    ShowHideModalViewCommand.CanExecute(context))
                {
                    ShowHideModalViewCommand.Execute(context);
                }
            })
            {
                NumberOfTouchesRequired = (uint)1,
                NumberOfTapsRequired    = (uint)1
            };

            ImageBackground.AddGestureRecognizer(_headerImageTapGesture);

            _descriptionTapGesture = new UITapGestureRecognizer(() => {
                if (ExpandCollapseCommand != null &&
                    ExpandCollapseCommand.CanExecute(null))
                {
                    ExpandCollapseCommand.Execute(null);
                }
            })
            {
                NumberOfTouchesRequired = (uint)1,
                NumberOfTapsRequired    = (uint)1
            };

            DescriptionLabel.AddGestureRecognizer(_descriptionTapGesture);
        }
Example #2
0
        private void NavigateDetails()
        {
            var context = new ModalViewContext(
                ModalViewKind.Browser,
                DataContext.Show.DetailsUrl);

            if (ShowHideModalViewCommand != null &&
                ShowHideModalViewCommand.CanExecute(context))
            {
                ShowHideModalViewCommand.Execute(context);
            }
        }
Example #3
0
        private void InitializeGestures()
        {
            _cellTapGesture = new UITapGestureRecognizer(rec =>
            {
                if (IsExpanded && DataContext.Show.HasPictures() &&
                    rec.LocatedInView(ThumbImageView))
                {
                    var context = new ModalViewContext(
                        ModalViewKind.FullscreenImage,
                        DataContext.Show.Pictures.Full);

                    if (ShowHideModalViewCommand != null &&
                        ShowHideModalViewCommand.CanExecute(context))
                    {
                        ShowHideModalViewCommand.Execute(context);
                    }
                }
                else if (IsExpanded && DataContext.Show.HasDetailsUrl() &&
                         rec.LocatedInView(this,
                                           new CGRect(0, Bounds.Height - DetailsTapAreaHeight,
                                                      DetailsLabel.Frame.X + DetailsLabel.Frame.Width + HorizontalBorder,
                                                      DetailsTapAreaHeight)))
                {
                    NavigateDetails();
                }
                else if (IsExpanded && DataContext.IsLocationAvailable &&
                         rec.LocatedInView(this,
                                           new CGRect(0, LocationLabel.Frame.Y,
                                                      LocationLabel.Frame.X + LocationLabel.Frame.Width + HorizontalBorder,
                                                      LocationLabel.Frame.Height)))
                {
                    if (NavigateVenueOnMapCommand != null &&
                        NavigateVenueOnMapCommand.CanExecute(DataContext.TargetVenue))
                    {
                        NavigateVenueOnMapCommand.Execute(DataContext.TargetVenue);
                    }
                }
                else
                {
                    if (ExpandCollapseShowCommand != null &&
                        ExpandCollapseShowCommand.CanExecute(DataContext.Show))
                    {
                        ExpandCollapseShowCommand.Execute(DataContext.Show);
                    }
                }
            })
            {
                NumberOfTouchesRequired = (uint)1,
                NumberOfTapsRequired    = (uint)1
            };

            AddGestureRecognizer(_cellTapGesture);

            _starTapGesture = new UITapGestureRecognizer(() =>
            {
                if (DataContext != null)
                {
                    DataContext.IsFavorite = !DataContext.IsFavorite;
                    UpdateFavoriteState();

                    var tuple = new Tuple <int, Show>(DataContext.OrgEventId, DataContext.Show);

                    if (DataContext.IsFavorite)
                    {
                        if (SetFavoriteCommand.CanExecute(tuple))
                        {
                            SetFavoriteCommand.Execute(tuple);
                        }
                    }
                    else
                    {
                        if (UnsetFavoriteCommand.CanExecute(tuple))
                        {
                            UnsetFavoriteCommand.Execute(tuple);
                        }
                    }
                }
            });

            StarButton.AddGestureRecognizer(_starTapGesture);
        }