public override void Initialize() { for (int i=0; i<4; i++) { for (int j=0; j<5; j++) { PNode rect = PPath.CreateRectangle(i*60, j*60, 50, 50); rect.Brush = new SolidBrush(Color.Blue); Canvas.Layer.AddChild(rect); } } // Turn off default navigation event handlers //Canvas.RemoveInputEventListener(Canvas.PanEventHandler); Canvas.RemoveInputEventListener(Canvas.ZoomEventHandler); // Create a selection event handler PSelectionEventHandler selectionEventHandler = new PSelectionEventHandler(Canvas.Layer, Canvas.Layer); Canvas.AddInputEventListener(selectionEventHandler); Canvas.Root.DefaultInputManager.KeyboardFocus = Canvas.Camera.ToPickPath(); //PNotificationCenter.DefaultCenter.AddListener(this, // "selectionChanged", // PSelectionEventHandler.SELECTION_CHANGED_NOTIFICATION, // selectionEventHandler); base.Initialize (); }
/// <summary> /// Constructs a new BoundsFilter with the given bounds and selectionHandler. /// </summary> /// <param name="bounds"> /// The bounds to use when deciding whether to accept a node. /// </param> /// <param name="selectionHandler"> /// The selection event handler to which this BoundsFilter will apply. /// </param> public BoundsFilter(RectangleF bounds, PSelectionEventHandler selectionHandler) { this.bounds = bounds; this.selectionHandler = selectionHandler; }