Пример #1
0
 /// <summary>
 /// Occurs when the user disconnects an object from the port.
 /// </summary>
 /// <remarks><para>Raising an event invokes the event handler through a delegate.</para>
 /// <para>The <c>OnPortDisconencted</c> method also allows derived classes to handle the event without attaching a delegate. This is the preferred
 /// technique for handling the event in a derived class.</para>
 /// <para>Notes to Inheritors: </para>
 /// <para>When overriding <c>OnPortDisconencted</c> in a derived class, be sure to call the base class's <c>OnPortConnected</c> method so that registered
 /// delegates receive the event.</para>
 /// </remarks>
 /// <param name = "args">A <see cref = "PortDisconnectedEventArgs">PortDisconnectedEventArgs</see> that contains information about the event.</param>
 protected void OnPortDisconnected(PortDisconnectedEventArgs args)
 {
     if (PortDisconnected != null)
     {
         PortDisconnected(this, args);
     }
 }
Пример #2
0
        /// <summary>
        ///	Disconnects whatever object is connected to this port.
        /// </summary>
        /// <exception cref ="ECapeUnknown">The error to be raised when other error(s),  specified for this operation, are not suitable.</exception>
        private void Disconnect(bool connecting)
        {
            if (m_ConnectedNonSerializableObject != null)
            {
                if (m_ConnectedNonSerializableObject.GetType().IsCOMObject)
                {
                    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(m_ConnectedNonSerializableObject);
                }
                if (m_ConnectedNonSerializableObject is MaterialObjectWrapper)
                {
                    ((MaterialObjectWrapper)m_ConnectedNonSerializableObject).Dispose();
                }
                m_ConnectedNonSerializableObject = null;
                return;
            }
            m_ConnectedObject = null;
            PortDisconnectedEventArgs args = new PortDisconnectedEventArgs(this.ComponentName);

            OnPortDisconnected(args);
            if (!connecting)
            {
                NotifyPropertyChanged("connectedObject");
            }
        }