/// <summary> /// Dispose of connect actions. /// </summary> protected override void Dispose(bool disposing) { try { if(disposing) { if(this.dataContractToolCreateAction != null) { this.dataContractToolCreateAction.Dispose(); this.dataContractToolCreateAction = null; } if(this.dataContractEnumToolCreateAction != null) { this.dataContractEnumToolCreateAction.Dispose(); this.dataContractEnumToolCreateAction = null; } if(this.primitiveDataTypeCollectionToolCreateAction != null) { this.primitiveDataTypeCollectionToolCreateAction.Dispose(); this.primitiveDataTypeCollectionToolCreateAction = null; } if(this.dataContractCollectionToolCreateAction != null) { this.dataContractCollectionToolCreateAction.Dispose(); this.dataContractCollectionToolCreateAction = null; } if(this.faultContractToolCreateAction != null) { this.faultContractToolCreateAction.Dispose(); this.faultContractToolCreateAction = null; } if(this.aggregationConnectionToolConnectAction != null) { this.aggregationConnectionToolConnectAction.Dispose(); this.aggregationConnectionToolConnectAction = null; } this.UnsubscribeCompartmentItemsEvents(); } } finally { base.Dispose(disposing); } }
/// <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) { bool stickyMode = false; DslDesign::ModelingToolboxItem selectedToolboxItem = activeView.Toolbox.GetSelectedToolboxItem() as DslDesign::ModelingToolboxItem; if (selectedToolboxItem != null && selectedToolboxItem.Id == this.stickyToolboxItemId) { stickyMode = true; } else { stickyMode = false; this.stickyToolboxItemId = null; } DslDiagrams::MouseAction action = null; if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.DataContractToolFilterString)) { if (this.dataContractToolCreateAction == null) { this.dataContractToolCreateAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractToolCreateAction(this); this.dataContractToolCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated); } this.dataContractToolCreateAction.StickyMode = stickyMode; action = this.dataContractToolCreateAction; } else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.DataContractEnumToolFilterString)) { if (this.dataContractEnumToolCreateAction == null) { this.dataContractEnumToolCreateAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractEnumToolCreateAction(this); this.dataContractEnumToolCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated); } this.dataContractEnumToolCreateAction.StickyMode = stickyMode; action = this.dataContractEnumToolCreateAction; } else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.PrimitiveDataTypeCollectionToolFilterString)) { if (this.primitiveDataTypeCollectionToolCreateAction == null) { this.primitiveDataTypeCollectionToolCreateAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.PrimitiveDataTypeCollectionToolCreateAction(this); this.primitiveDataTypeCollectionToolCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated); } this.primitiveDataTypeCollectionToolCreateAction.StickyMode = stickyMode; action = this.primitiveDataTypeCollectionToolCreateAction; } else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.DataContractCollectionToolFilterString)) { if (this.dataContractCollectionToolCreateAction == null) { this.dataContractCollectionToolCreateAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractCollectionToolCreateAction(this); this.dataContractCollectionToolCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated); } this.dataContractCollectionToolCreateAction.StickyMode = stickyMode; action = this.dataContractCollectionToolCreateAction; } else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.FaultContractToolFilterString)) { if (this.faultContractToolCreateAction == null) { this.faultContractToolCreateAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.FaultContractToolCreateAction(this); this.faultContractToolCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated); } this.faultContractToolCreateAction.StickyMode = stickyMode; action = this.faultContractToolCreateAction; } else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslToolboxHelper.AggregationConnectionToolFilterString)) { if (this.aggregationConnectionToolConnectAction == null) { this.aggregationConnectionToolConnectAction = new global::Microsoft.Practices.ServiceFactory.DataContracts.AggregationConnectionToolConnectAction(this); this.aggregationConnectionToolConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated); } this.aggregationConnectionToolConnectAction.StickyMode = stickyMode; action = this.aggregationConnectionToolConnectAction; } else { action = null; } if (pointArgs.DiagramClientView.ActiveMouseAction != action) { try { this.changingMouseAction = true; pointArgs.DiagramClientView.ActiveMouseAction = action; } finally { this.changingMouseAction = false; } } } }