/// <summary> /// Initialize the drag/drop when the diagram is associated with a view (i.e. when /// a model is loaded from a file) /// </summary> protected override void OnAssociated(DiagramAssociationEventArgs e) { base.OnAssociated(e); // Ensure we have a view if (e.DiagramView == null || e.DiagramView.DiagramClientView == null) { return; } // Wireup the drag/drop support Control ctrl = e.DiagramView.DiagramClientView; ctrl.AllowDrop = true; ctrl.DragOver += OnDragOver; ctrl.DragDrop += OnDragDrop; }
/// <summary> /// Initialize the drag/drop when the diagram is associated with a view (i.e. when /// a model is loaded from a file) /// </summary> protected override void OnAssociated(DiagramAssociationEventArgs e) { base.OnAssociated(e); // Ensure we have a view if (e.DiagramView == null || e.DiagramView.DiagramClientView == null) { return; } // Wireup the drag/drop support Control ctrl = e.DiagramView.DiagramClientView; ctrl.AllowDrop = true; ctrl.DragOver += new DragEventHandler(OnDragOver); ctrl.DragDrop += new DragEventHandler(OnDragDrop); }
/// <summary> /// Unsubscribe to the shape selection changed event when view is about to be disposed. /// </summary> protected override void OnDisassociated(DiagramAssociationEventArgs e) { if (e.DiagramView != null && e.DiagramView.Selection != null) { e.DiagramView.Selection.ShapeSelectionChanged -= diagramView_OnShapeSelectionChanged; } base.OnDisassociated(e); }
protected override void OnAssociated(DiagramAssociationEventArgs e) { base.OnAssociated(e); // Initialize and add LinkLabels to diagram watermark if (e.DiagramView != null) { // OnAssociated gets called when the document gets loaded as well as reloaded. This means that // we need to reset the watermark before we refresh the link labels associated with them. // Resetting the watermark does the appropriate steps to check if the artifact is designer safe, etc. // to determine what watermark to display. if (e.DiagramView.Watermark != null) { ResetWatermark(e.DiagramView); } Debug.Assert(e.DiagramView.Selection != null, "Why DiagramView's Selection property is null?"); if (e.DiagramView.Selection != null) { e.DiagramView.Selection.ShapeSelectionChanged += diagramView_OnShapeSelectionChanged; } } }