Esempio n. 1
0
        /// <summary>
        /// Override to provide the right mouse action when trying
        /// to create links on the diagram
        /// </summary>
        /// <param name="pointArgs"></param>
        public override void OnViewMouseEnter(DslDiagrams::DiagramPointEventArgs pointArgs)
        {
            if (pointArgs == null)
            {
                throw new global::System.ArgumentNullException("pointArgs");
            }

            DslDiagrams::DiagramView activeView = this.ActiveDiagramView;

            if (activeView != null)
            {
                DslDiagrams::MouseAction action = null;
                if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Example.Circuits.CircuitsToolboxHelper.WireFilterString))
                {
                    if (this.wireConnectAction == null)
                    {
                        this.wireConnectAction = new global::Microsoft.Example.Circuits.WireConnectAction(this);
                        this.wireConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
                    }
                    action = this.wireConnectAction;
                }
                else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Example.Circuits.CircuitsToolboxHelper.CommentConnectorFilterString))
                {
                    if (this.commentConnectorConnectAction == null)
                    {
                        this.commentConnectorConnectAction = new global::Microsoft.Example.Circuits.CommentConnectorConnectAction(this);
                        this.commentConnectorConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
                    }
                    action = this.commentConnectorConnectAction;
                }
                else
                {
                    action = null;
                }

                if (pointArgs.DiagramClientView.ActiveMouseAction != action)
                {
                    try
                    {
                        this.changingMouseAction = true;
                        pointArgs.DiagramClientView.ActiveMouseAction = action;
                    }
                    finally
                    {
                        this.changingMouseAction = false;
                    }
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Dispose of connect actions.
 /// </summary>
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             if (this.wireConnectAction != null)
             {
                 this.wireConnectAction.Dispose();
                 this.wireConnectAction = null;
             }
             if (this.commentConnectorConnectAction != null)
             {
                 this.commentConnectorConnectAction.Dispose();
                 this.commentConnectorConnectAction = null;
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }