示例#1
0
 partial void OnNavigateOnMapClick(NSObject sender)
 {
     if (NavigateVenueOnMapCommand != null &&
         NavigateVenueOnMapCommand.CanExecute(DataContext.TargetVenue))
     {
         NavigateVenueOnMapCommand.Execute(DataContext.TargetVenue);
     }
 }
示例#2
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);
        }