示例#1
0
 /// <summary>
 /// Dispose of connect actions.
 /// </summary>
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             if (this.fatherConnectAction != null)
             {
                 this.fatherConnectAction.Dispose();
                 this.fatherConnectAction = null;
             }
             if (this.actuatorConnectAction != null)
             {
                 this.actuatorConnectAction.Dispose();
                 this.actuatorConnectAction = null;
             }
             if (this.sensorConnectAction != null)
             {
                 this.sensorConnectAction.Dispose();
                 this.sensorConnectAction = null;
             }
             if (this.alternativeConnectAction != null)
             {
                 this.alternativeConnectAction.Dispose();
                 this.alternativeConnectAction = null;
             }
             if (this.brotherConnectAction != null)
             {
                 this.brotherConnectAction.Dispose();
                 this.brotherConnectAction = null;
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
示例#2
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::Ufba.vShome.vShomeToolboxHelper.FatherFilterString))
                {
                    if (this.fatherConnectAction == null)
                    {
                        this.fatherConnectAction = new global::Ufba.vShome.FatherConnectAction(this);
                        this.fatherConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
                    }
                    action = this.fatherConnectAction;
                }
                else if (SelectedToolboxItemSupportsFilterString(activeView, global::Ufba.vShome.vShomeToolboxHelper.ActuatorFilterString))
                {
                    if (this.actuatorConnectAction == null)
                    {
                        this.actuatorConnectAction = new global::Ufba.vShome.ActuatorConnectAction(this);
                        this.actuatorConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
                    }
                    action = this.actuatorConnectAction;
                }
                else if (SelectedToolboxItemSupportsFilterString(activeView, global::Ufba.vShome.vShomeToolboxHelper.SensorFilterString))
                {
                    if (this.sensorConnectAction == null)
                    {
                        this.sensorConnectAction = new global::Ufba.vShome.SensorConnectAction(this);
                        this.sensorConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
                    }
                    action = this.sensorConnectAction;
                }
                else if (SelectedToolboxItemSupportsFilterString(activeView, global::Ufba.vShome.vShomeToolboxHelper.AlternativeFilterString))
                {
                    if (this.alternativeConnectAction == null)
                    {
                        this.alternativeConnectAction = new global::Ufba.vShome.AlternativeConnectAction(this);
                        this.alternativeConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
                    }
                    action = this.alternativeConnectAction;
                }
                else if (SelectedToolboxItemSupportsFilterString(activeView, global::Ufba.vShome.vShomeToolboxHelper.BrotherFilterString))
                {
                    if (this.brotherConnectAction == null)
                    {
                        this.brotherConnectAction = new global::Ufba.vShome.BrotherConnectAction(this);
                        this.brotherConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnConnectActionDeactivated);
                    }
                    action = this.brotherConnectAction;
                }
                else
                {
                    action = null;
                }

                if (pointArgs.DiagramClientView.ActiveMouseAction != action)
                {
                    try
                    {
                        this.changingMouseAction = true;
                        pointArgs.DiagramClientView.ActiveMouseAction = action;
                    }
                    finally
                    {
                        this.changingMouseAction = false;
                    }
                }
            }
        }