Exemple #1
0
		/// <summary>
		/// Dispose of connect actions.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			try
			{
				if(disposing)
				{
					if(this.serviceCreateAction != null)
					{
						this.serviceCreateAction.Dispose();
						this.serviceCreateAction = null;
					}
					if(this.serviceContractCreateAction != null)
					{
						this.serviceContractCreateAction.Dispose();
						this.serviceContractCreateAction = null;
					}
					if(this.operationCreateAction != null)
					{
						this.operationCreateAction.Dispose();
						this.operationCreateAction = null;
					}
					if(this.messageCreateAction != null)
					{
						this.messageCreateAction.Dispose();
						this.messageCreateAction = null;
					}
					if(this.xsdMessageCreateAction != null)
					{
						this.xsdMessageCreateAction.Dispose();
						this.xsdMessageCreateAction = null;
					}
					if(this.connectToolConnectAction != null)
					{
						this.connectToolConnectAction.Dispose();
						this.connectToolConnectAction = null;
					}
					this.UnsubscribeCompartmentItemsEvents();
				}
			}
			finally
			{
				base.Dispose(disposing);
			}
		}
Exemple #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)
			{
				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.ServiceContracts.ServiceContractDslToolboxHelper.ServiceFilterString))
				{
					if (this.serviceCreateAction == null)
					{
						this.serviceCreateAction = new global::Microsoft.Practices.ServiceFactory.ServiceContracts.ServiceCreateAction(this);
						this.serviceCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.serviceCreateAction.StickyMode = stickyMode;
					action = this.serviceCreateAction;
				}
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.ServiceContracts.ServiceContractDslToolboxHelper.ServiceContractFilterString))
				{
					if (this.serviceContractCreateAction == null)
					{
						this.serviceContractCreateAction = new global::Microsoft.Practices.ServiceFactory.ServiceContracts.ServiceContractCreateAction(this);
						this.serviceContractCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.serviceContractCreateAction.StickyMode = stickyMode;
					action = this.serviceContractCreateAction;
				}
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.ServiceContracts.ServiceContractDslToolboxHelper.OperationFilterString))
				{
					if (this.operationCreateAction == null)
					{
						this.operationCreateAction = new global::Microsoft.Practices.ServiceFactory.ServiceContracts.OperationCreateAction(this);
						this.operationCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.operationCreateAction.StickyMode = stickyMode;
					action = this.operationCreateAction;
				}
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.ServiceContracts.ServiceContractDslToolboxHelper.MessageFilterString))
				{
					if (this.messageCreateAction == null)
					{
						this.messageCreateAction = new global::Microsoft.Practices.ServiceFactory.ServiceContracts.MessageCreateAction(this);
						this.messageCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.messageCreateAction.StickyMode = stickyMode;
					action = this.messageCreateAction;
				}
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.ServiceContracts.ServiceContractDslToolboxHelper.XsdMessageFilterString))
				{
					if (this.xsdMessageCreateAction == null)
					{
						this.xsdMessageCreateAction = new global::Microsoft.Practices.ServiceFactory.ServiceContracts.XsdMessageCreateAction(this);
						this.xsdMessageCreateAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.xsdMessageCreateAction.StickyMode = stickyMode;
					action = this.xsdMessageCreateAction;
				}
				else if (SelectedToolboxItemSupportsFilterString(activeView, global::Microsoft.Practices.ServiceFactory.ServiceContracts.ServiceContractDslToolboxHelper.ConnectToolFilterString))
				{
					if (this.connectToolConnectAction == null)
					{
						this.connectToolConnectAction = new global::Microsoft.Practices.ServiceFactory.ServiceContracts.ConnectToolConnectAction(this);
						this.connectToolConnectAction.MouseActionDeactivated += new DslDiagrams::MouseAction.MouseActionDeactivatedEventHandler(OnToolboxActionDeactivated);
					}
					this.connectToolConnectAction.StickyMode = stickyMode;
					action = this.connectToolConnectAction;
				} 
				else
				{
					action = null;
				}
				
				if (pointArgs.DiagramClientView.ActiveMouseAction != action)
				{
					try
					{
						this.changingMouseAction = true;
						pointArgs.DiagramClientView.ActiveMouseAction = action;
					}
					finally
					{
						this.changingMouseAction = false;
					}
				}
			}
		}