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); }
public void ShowHideModalView(ModalViewContext context) { if (PresentedViewController != null) { DisposeModalView(); } if (context != null) { var view = default(IModalView); switch (context.ViewKind) { case ModalViewKind.FullscreenImage: view = new ImageFullscreenView { ImageURL = context.DataContext as string }; break; case ModalViewKind.Browser: var viewModel = Mvx.IocConstruct <BrowserViewModel>(); viewModel.Init(new BrowserViewModel.Parameters { URL = context.DataContext as string }); view = new ModalNavView(new BrowserView { ViewModel = viewModel }); break; } view.ToHide += OnModalViewToHide; PresentViewController((UIViewController)view, true, null); } }
private void NavigateDetails() { var context = new ModalViewContext( ModalViewKind.Browser, DataContext.Show.DetailsUrl); if (ShowHideModalViewCommand != null && ShowHideModalViewCommand.CanExecute(context)) { ShowHideModalViewCommand.Execute(context); } }
public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath) { var item = _collectionSource.ItemsSource.Cast <object>().ElementAt(indexPath.Row); var contact = item as Contact; if (contact != null) { if (contact.Type == ContactType.Phone) { if (CallPhoneCommand != null && CallPhoneCommand.CanExecute(contact)) { CallPhoneCommand.Execute(contact); } } if (contact.Type == ContactType.Email) { if (ComposeEmailCommand != null && ComposeEmailCommand.CanExecute(contact)) { ComposeEmailCommand.Execute(contact); } } if (contact.Type == ContactType.Url) { var context = new ModalViewContext( ModalViewKind.Browser, contact.ContactText); if (ShowHideModalViewCommand != null && ShowHideModalViewCommand.CanExecute(context)) { ShowHideModalViewCommand.Execute(context); } } } collectionView.DeselectItem(indexPath, false); }
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); }