public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CGPoint location)
        {
            UIViewController result = null;

            // First, get the index path and view for the previewed cell.
            var indexPath = base.TableView.IndexPathForRowAtPoint(location);

            if (indexPath != null)
            {
                var cell = base.TableView.CellAt(indexPath);
                if (cell != null)
                {
                    // Enable blurring of other UI elements, and a zoom in animation while peeking.
                    previewingContext.SourceRect = cell.Frame;

                    // Create and configure an instance of the color item view controller to show for the peek.
                    var viewController = base.Storyboard.InstantiateViewController("ColorItemViewController") as ColorItemViewController;

                    // Pass over a reference to the ColorData object and the specific ColorItem being viewed.
                    viewController.ColorData = ColorData;
                    viewController.ColorItem = ColorData.Colors[indexPath.Row];

                    result = viewController;
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
        {
            Console.WriteLine("CommitViewContoller");

            var sv = (UICollectionView)previewingContext.SourceView;

            var x = previewingContext.SourceRect.X + (previewingContext.SourceRect.Width / 2);
            var y = previewingContext.SourceRect.Y + (previewingContext.SourceRect.Height / 2);

            var indexPath = CollectionView.IndexPathForItemAtPoint(new CGPoint(x, y));
            var popAt     = todoItems [indexPath.Row];


            var detailViewController = (DetailViewController)Storyboard.InstantiateViewController("detailvc");

            if (detailViewController == null)
            {
                return;
            }

            detailViewController.SetTodo(popAt);

            //viewControllerToCommit = peekViewController;
            ShowViewController(detailViewController, this);
        }
Ejemplo n.º 3
0
        public override UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CGPoint location)
        {
            var indexPath = _restaurantTableViewController.TableView.IndexPathForRowAtPoint(location);

            if (indexPath == null)
            {
                return(null);
            }

            var cell = _restaurantTableViewController.TableView.CellAt(indexPath);

            if (cell == null)
            {
                return(null);
            }

            var restaurantDetaiViewController = _restaurantTableViewController.Storyboard?.InstantiateViewController("RestaurantDetailViewController") as NewRestaurantDetailViewController;

            if (restaurantDetaiViewController == null)
            {
                return(null);
            }

            var selectedRestaurant = _restaurantsMO[indexPath.Row];

            restaurantDetaiViewController.RestaurantMO         = selectedRestaurant;
            restaurantDetaiViewController.PreferredContentSize = new CGSize(0, 460);
            previewingContext.SourceRect = cell.Frame;

            return(restaurantDetaiViewController);
        }
        /// <summary>
        /// Gets the view controller that will be displayed for a 3D Touch preview "peek".
        /// </summary>
        /// <returns>The view controller for preview.</returns>
        /// <param name="previewingContext">Previewing context.</param>
        /// <param name="location">Location.</param>
        public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CoreGraphics.CGPoint location)
        {
            // Obtain the index path and the cell that was pressed.
            var indexPath = TableView.IndexPathForRowAtPoint(location);

            if (indexPath == null)
            {
                return(null);
            }

            // get the cell that is being pressed for preview "peeking"
            var cell = TableView.CellAt(indexPath);

            if (cell == null)
            {
                return(null);
            }

            // Create a detail view controller and set its properties.
            var detailViewController = Storyboard.InstantiateViewController("AcquaintanceDetailViewController") as AcquaintanceDetailViewController;

            if (detailViewController == null)
            {
                return(null);
            }

            // set the acquaintance on the view controller
            detailViewController.Acquaintance = _AcquaintanceTableViewSource.Acquaintances[indexPath.Row];

            // set the frame on the screen that will NOT be blurred out during the preview "peek"
            previewingContext.SourceRect = cell.Frame;

            return(detailViewController);
        }
Ejemplo n.º 5
0
        public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CGPoint location)
        {
            // Obtain the index path and the cell that was pressed.
            var indexPath = TableView.IndexPathForRowAtPoint(location);

            if (indexPath == null)
            {
                return(null);
            }

            var cell = TableView.CellAt(indexPath);

            if (cell == null)
            {
                return(null);
            }

            // Create a detail view controller and set its properties.
            var detailViewController = (DetailViewController)Storyboard.InstantiateViewController("DetailViewController");

            if (detailViewController == null)
            {
                return(null);
            }

            var previewDetail = sampleData [indexPath.Row];

            detailViewController.DetailItemTitle      = previewDetail.Title;
            detailViewController.PreferredContentSize = new CGSize(0, previewDetail.PreferredHeight);
            previewingContext.SourceRect = cell.Frame;
            return(detailViewController);
        }
 public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     if (presentViewController)
     {
         PresentViewController(viewControllerToCommit, true, null);
     }
     else
     {
         NavigationController.PushViewController(viewControllerToCommit, true);
     }
 }
Ejemplo n.º 7
0
 public async void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     try {
         var ed = viewControllerToCommit as IDocumentEditor;
         if (ed != null)
         {
             await DocumentAppDelegate.Shared.OpenDocument(ed.DocumentReference.File.Path, false);
         }
     } catch (Exception ex) {
         Log.Error(ex);
     }
 }
Ejemplo n.º 8
0
        public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CoreGraphics.CGPoint location)
        {
            try {
                if (docsView == null)
                {
                    return(null);
                }

                var p    = new Praeclarum.Graphics.PointF((float)location.X, (float)location.Y);
                var item = docsView.GetItemAtPoint(p);

                if (item == null)
                {
                    return(null);
                }

                var dref = item.Reference;
                if (dref == null)
                {
                    return(null);
                }

                var docIndex = Docs.FindIndex(x => x.File.Path == dref.File.Path);
                if (docIndex < 0)
                {
                    return(null);
                }

                var newEditor = DocumentAppDelegate.Shared.App.CreateDocumentEditor(docIndex, Docs);
                if (newEditor == null)
                {
                    return(null);
                }

                newEditor.IsPreviewing = true;

                BindEditorAsync(newEditor).ContinueWith(t => {
                    if (t.IsFaulted)
                    {
                        Log.Error(t.Exception);
                    }
                });

                return((UIViewController)newEditor);
            } catch (Exception ex) {
                Log.Error(ex);
                return(null);
            }
        }
Ejemplo n.º 9
0
        void SwitchToMode(bool animated)
        {
            var b = View.Bounds;

            var oldView    = docsView;
            var oldPreview = docsPreview;

            if (oldView != null)
            {
                oldView.SortChanged -= HandleSortChanged;
                oldView.SelectedDocuments.CollectionChanged -= HandleSelectedDocumentsChanged;
                oldView.RenameRequested -= HandleRenameRequested;
                if (ios9 && oldPreview != null)
                {
                    UnregisterForPreviewingWithContext(oldPreview);
                }
            }

            var newView = viewMode == DocumentsViewMode.List ?
                          (IDocumentsView) new DocumentListView(b) :
                          (IDocumentsView) new DocumentThumbnailsView(b);



            docsView              = newView;
            docsView.IsSyncing    = IsSyncing;
            docsView.Items        = items;
            docsView.Sort         = DocumentAppDelegate.Shared.Settings.DocumentsSort;
            docsView.SortChanged += HandleSortChanged;
            docsView.SelectedDocuments.CollectionChanged += HandleSelectedDocumentsChanged;
            docsView.RenameRequested += HandleRenameRequested;

            var longPress = new UILongPressGestureRecognizer(HandleLongPress)
            {
                MinimumPressDuration = 0.5,
            };

            View = (UIView)newView;
            View.AddGestureRecognizer(longPress);
            if (ios9)
            {
                docsPreview = RegisterForPreviewingWithDelegate(this, View);
            }
        }
        public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CGPoint location)
        {
            var indexPath = TableView.IndexPathForRowAtPoint(location);
            var cell      = TableView.CellAt(indexPath);

            if (cell == null || demoProductViewController == false)
            {
                return(null);
            }

            var product = products[indexPath.Row];
            var productViewController = GetProductViewController();

            productViewController.LoadProduct(product, null);

            previewingContext.SourceRect = cell.Frame;

            return(productViewController);
        }
        /// Create a previewing view controller to be shown at "Peek".
        public override UIViewController GetViewControllerForPreview (IUIViewControllerPreviewing previewingContext, CGPoint location)
        {
            // Grab the item to preview
            var indexPath = SearchController.SearchResultsTableView.IndexPathForRowAtPoint (location);
            var cell = SearchController.SearchResultsTableView.CellAt (indexPath);
            var item = SearchController.DataSource.Beers[indexPath.Row];

            // Grab a controller and set it to the default sizes
            var detailViewController = SearchController.Storyboard.InstantiateViewController ("beerDescriptionView") as BeerDescriptionTableView;
            detailViewController.PreferredContentSize = new CGSize (0, 0);

            // Set the data for the display
            detailViewController.SetBeer (item);
            detailViewController.NavigationItem.LeftBarButtonItem = SearchController.SplitViewController.DisplayModeButtonItem;
            detailViewController.NavigationItem.LeftItemsSupplementBackButton = true;

            // Set the source rect to the cell frame, so everything else is blurred.
            previewingContext.SourceRect = cell.Frame;

            return detailViewController;
        }
        public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
        {
            Console.WriteLine ("CommitViewContoller");

            var sv = (UICollectionView)previewingContext.SourceView;

            var x = previewingContext.SourceRect.X + (previewingContext.SourceRect.Width / 2);
            var y = previewingContext.SourceRect.Y + (previewingContext.SourceRect.Height / 2);

            var indexPath = CollectionView.IndexPathForItemAtPoint (new CGPoint(x,y));
            var popAt = tasks [indexPath.Row];

            var detailViewController = (DetailViewController)Storyboard.InstantiateViewController ("detailvc");
            if (detailViewController == null)
                return;

            detailViewController.SetTodo (popAt);

            //viewControllerToCommit = peekViewController;
            ShowViewController (detailViewController, this);
        }
Ejemplo n.º 13
0
        public override UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CGPoint location)
        {
            // Grab the item to preview
            var indexPath = beerViewController.TableView.IndexPathForRowAtPoint(location);
            var cell      = beerViewController.TableView.CellAt(indexPath);
            var item      = beerViewController.Beers[indexPath.Row];

            // Grab a controller and set it to the default sizes
            var detailViewController = beerViewController.Storyboard.InstantiateViewController("BEER_DESCRIPTION") as BeerDescriptionTableView;

            detailViewController.PreferredContentSize = new CGSize(0, 0);

            // Set the data for the display
            detailViewController.SetBeer(item);
            detailViewController.NavigationItem.LeftBarButtonItem             = beerViewController.SplitViewController.DisplayModeButtonItem;
            detailViewController.NavigationItem.LeftItemsSupplementBackButton = true;

            // Set the source rect to the cell frame, so everything else is blurred.
            previewingContext.SourceRect = cell.Frame;

            return(detailViewController);
        }
Ejemplo n.º 14
0
        public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CGPoint location)
        {
            // Obtain the index path and the cell that was pressed.
            var indexPath = CollectionView.IndexPathForItemAtPoint(location);

            Console.WriteLine("ForPreview " + location.ToString() + " " + indexPath);

            if (indexPath == null)
            {
                return(null);
            }

            var cell = CollectionView.CellForItem(indexPath);

            if (cell == null)
            {
                return(null);
            }


            // Create a detail view controller and set its properties.
            var peekViewController = (PeekViewController)Storyboard.InstantiateViewController("peekvc");

            if (peekViewController == null)
            {
                return(null);
            }

            var peekAt = todoItems [indexPath.Row];

            peekViewController.SetTodo(peekAt);
            peekViewController.PreferredContentSize = new CGSize(0, 160);

            previewingContext.SourceRect = cell.Frame;

            return(peekViewController);
        }
 /// Present the view controller for the "Pop" action.
 public override void CommitViewController (IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     // Reuse Peek view controller for details presentation
     SearchController.ShowViewController(viewControllerToCommit,this);
 }
 public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     // Push the configured view controller onto the navigation stack.
     base.NavigationController.PushViewController(viewControllerToCommit, true);
 }
Ejemplo n.º 17
0
 public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     ShowViewController(viewControllerToCommit, this);
 }
Ejemplo n.º 18
0
 public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     Console.WriteLine("CommitViewController");
 }
Ejemplo n.º 19
0
 public override void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     _restaurantTableViewController.ShowViewController(viewControllerToCommit, this);
 }
		public UIViewController GetViewControllerForPreview (IUIViewControllerPreviewing previewingContext, CGPoint location)
		{
			// Obtain the index path and the cell that was pressed.
			var indexPath = TableView.IndexPathForRowAtPoint (location);

			if (indexPath == null)
				return null;

			var cell = TableView.CellAt (indexPath);

			if (cell == null)
				return null;

			// Create a detail view controller and set its properties.
			var detailViewController = (DetailViewController)Storyboard.InstantiateViewController ("DetailViewController");
			if (detailViewController == null)
				return null;

			var previewDetail = sampleData [indexPath.Row];
			detailViewController.DetailItemTitle = previewDetail.Title;
			detailViewController.PreferredContentSize = new CGSize (0, previewDetail.PreferredHeight);
			previewingContext.SourceRect = cell.Frame;
			return detailViewController;
		}
Ejemplo n.º 21
0
 public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CoreGraphics.CGPoint location)
 {
     Console.WriteLine ("BasePageRenderer.ViewDidLoad");
     return new UIViewController ();
 }
		public async void CommitViewController (IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
		{
			try {
				var ed = viewControllerToCommit as IDocumentEditor;
				if (ed != null) {
					await DocumentAppDelegate.Shared.OpenDocument (ed.DocumentReference.File.Path, false);
				}
			} catch (Exception ex) {
				Log.Error (ex);
			}
		}
 public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     if (presentViewController) {
         PresentViewController (viewControllerToCommit, true, null);
     } else {
         NavigationController.PushViewController (viewControllerToCommit, true);
     }
 }
Ejemplo n.º 24
0
        public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CoreGraphics.CGPoint location)
        {
            var indexPath = this.TableView.IndexPathForRowAtPoint (location);
            var cell = this.TableView.CellAt (indexPath);
            var item = this.Data.GetCheckpoint(indexPath);

            var previewer= Detail.GetDetailDialog (item);

            previewingContext.SourceRect = cell.Frame;
            previewer.PreferredContentSize = new CGSize (0, 0);

            return previewer;
        }
 /// Present the view controller for the "Pop" action.
 public override void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     // Reuse Peek view controller for details presentation
     SearchController.ShowViewController(viewControllerToCommit, this);
 }
		/// <summary>
		/// Gets the view controller that will be displayed for a 3D Touch preview "peek".
		/// </summary>
		/// <returns>The view controller for preview.</returns>
		/// <param name="previewingContext">Previewing context.</param>
		/// <param name="location">Location.</param>
		public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CoreGraphics.CGPoint location)
		{
			// Obtain the index path and the cell that was pressed.
			var indexPath = TableView.IndexPathForRowAtPoint(location);

			if (indexPath == null)
				return null;

			// get the cell that is being pressed for preview "peeking"
			var cell = TableView.CellAt(indexPath);

			if (cell == null)
				return null;

			// Create a detail view controller and set its properties.
			var detailViewController = Storyboard.InstantiateViewController("AcquaintanceDetailViewController") as AcquaintanceDetailViewController;

			if (detailViewController == null)
				return null;

			// set the acquaintance on the view controller
			detailViewController.Acquaintance = _AcquaintanceTableViewSource.Acquaintances[indexPath.Row];

			// set the frame on the screen that will NOT be blurred out during the preview "peek"
			previewingContext.SourceRect = cell.Frame;

			return detailViewController;
		}
		/// <summary>
		/// Commits the view controller that will displayed when a 3D Touch gesture is fully depressed, beyond just the preview.
		/// </summary>
		/// <param name="previewingContext">Previewing context.</param>
		/// <param name="viewControllerToCommit">View controller to commit.</param>
		public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
		{
			// Show the view controller that is being preview "peeked".
			// Instead, you could do whatever you want here, such as commit some other view controller than the one that is being "peeked".
			ShowViewController(viewControllerToCommit, this);
		}
 public override void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     beerViewController.ShowViewController(viewControllerToCommit, this);
 }
Ejemplo n.º 29
0
 public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     Console.WriteLine ("CommitViewController");
 }
Ejemplo n.º 30
0
 public override void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     beerViewController.ShowViewController(viewControllerToCommit, this);
 }
		public void CommitViewController (IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
		{
			ShowViewController (viewControllerToCommit, this);
		}
        public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CGPoint location)
        {
            // Obtain the index path and the cell that was pressed.
            var indexPath = CollectionView.IndexPathForItemAtPoint (location);

            Console.WriteLine ("ForPreview " + location.ToString() + " " + indexPath);

            if (indexPath == null)
                return null;

            var cell = CollectionView.CellForItem (indexPath);

            if (cell == null)
                return null;

            // Create a detail view controller and set its properties.
            var peekViewController = (PeekViewController)Storyboard.InstantiateViewController ("peekvc");
            if (peekViewController == null)
                return null;

            var peekAt = tasks [indexPath.Row];
            peekViewController.SetTodo (peekAt);
            peekViewController.PreferredContentSize = new CGSize (0, 160);

            previewingContext.SourceRect = cell.Frame;

            return peekViewController;
        }
 /// <summary>
 /// Commits the view controller that will displayed when a 3D Touch gesture is fully depressed, beyond just the preview.
 /// </summary>
 /// <param name="previewingContext">Previewing context.</param>
 /// <param name="viewControllerToCommit">View controller to commit.</param>
 public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     // Show the view controller that is being preview "peeked".
     // Instead, you could do whatever you want here, such as commit some other view controller than the one that is being "peeked".
     ShowViewController(viewControllerToCommit, this);
 }
Ejemplo n.º 34
0
 public void CommitViewController(IUIViewControllerPreviewing previewingContext, UIViewController viewControllerToCommit)
 {
     this.Detail.ShowDetailDialog (viewControllerToCommit as CheckPointDetailDialog);
 }
		void SwitchToMode (bool animated)
		{
			var b = View.Bounds;

			var oldView = docsView;
			var oldPreview = docsPreview;
			if (oldView != null) {
				oldView.SortChanged -= HandleSortChanged;
				oldView.SelectedDocuments.CollectionChanged -= HandleSelectedDocumentsChanged;
				oldView.RenameRequested -= HandleRenameRequested;
				if (ios9 && oldPreview != null) {
					UnregisterForPreviewingWithContext (oldPreview);
				}
			}

			var newView = viewMode == DocumentsViewMode.List ? 
			        (IDocumentsView)new DocumentListView (b) : 
			        (IDocumentsView)new DocumentThumbnailsView (b);



			docsView = newView;
			docsView.IsSyncing = IsSyncing;
			docsView.Items = items;
			docsView.Sort = DocumentAppDelegate.Shared.Settings.DocumentsSort;
			docsView.SortChanged += HandleSortChanged;
			docsView.SelectedDocuments.CollectionChanged += HandleSelectedDocumentsChanged;
			docsView.RenameRequested += HandleRenameRequested;

			var longPress = new UILongPressGestureRecognizer (HandleLongPress) {
				MinimumPressDuration = 0.5,
			};

			View = (UIView)newView;
			View.AddGestureRecognizer (longPress);
			if (ios9) {
				docsPreview = RegisterForPreviewingWithDelegate (this, View);
			}
		}
Ejemplo n.º 36
0
 public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CoreGraphics.CGPoint location)
 {
     Console.WriteLine("BasePageRenderer.ViewDidLoad");
     return(new UIViewController());
 }
		public UIViewController GetViewControllerForPreview (IUIViewControllerPreviewing previewingContext, CoreGraphics.CGPoint location)
		{
			try {

				if (docsView == null) return null;

				var p = new Praeclarum.Graphics.PointF ((float)location.X, (float)location.Y);
				var item = docsView.GetItemAtPoint (p);

				if (item == null) return null;

				var dref = item.Reference;
				if (dref == null) return null;

				var docIndex = Docs.FindIndex (x => x.File.Path == dref.File.Path);
				if (docIndex < 0) return null;

				var newEditor = DocumentAppDelegate.Shared.App.CreateDocumentEditor (docIndex, Docs);
				if (newEditor == null) return null;

				newEditor.IsPreviewing = true;

				BindEditorAsync (newEditor).ContinueWith (t => {
					if (t.IsFaulted) {
						Log.Error(t.Exception);
					}
				});

				return (UIViewController)newEditor;

			} catch (Exception ex) {
				Log.Error (ex);
				return null;
			}
		}
        public UIViewController GetViewControllerForPreview(IUIViewControllerPreviewing previewingContext, CGPoint location)
        {
            var indexPath = TableView.IndexPathForRowAtPoint (location);
            var cell = TableView.CellAt (indexPath);
            if (cell == null || demoProductViewController == false) {
                return null;
            }

            var product = products [indexPath.Row];
            var productViewController = GetProductViewController ();
            productViewController.LoadWithProduct (product, null);

            previewingContext.SourceRect = cell.Frame;

            return productViewController;
        }