public void ReleaseCOMProxy()
        {
            IEventBinding typeEvent = this as IEventBinding;

            if (null != typeEvent)
            {
                typeEvent.DisposeSinkHelper();
            }

            // remove himself from parent childlist
            if (null != _parentObject)
            {
                _parentObject.RemoveChildObject(this);
                _parentObject = null;
            }

            // finally release himself
            if (null != _underlyingObject)
            {
                if (_underlyingObject is ICustomAdapter)
                {
                    // enumerator
                    ICustomAdapter adapter = (ICustomAdapter)_underlyingObject;
                    Marshal.ReleaseComObject(adapter.GetUnderlyingObject());
                }
                else
                {
                    Marshal.ReleaseComObject(_underlyingObject);
                }
                _underlyingObject = null;
            }
        }
Exemple #2
0
        public void Dispose()
        {
            IEventBinding eventBind = this as IEventBinding;

            if (null != eventBind)
            {
                eventBind.DisposeSinkHelper();
            }

            RemoveChildObjects();
            ReleaseCOMProxy();
        }
        public new void Dispose()
        {
            _isDisposed = true;

            // in case of object implements also event binding we dispose them
            IEventBinding eventBind = this as IEventBinding;

            if (null != eventBind)
            {
                eventBind.DisposeSinkHelper();
            }

            RemoveChildObjects();
            ReleaseCOMProxy();
        }
Exemple #4
0
        public void ReleaseCOMProxy()
        {
            IEventBinding typeEvent = this as IEventBinding;

            if (null != typeEvent)
            {
                typeEvent.DisposeSinkHelper();
            }

            // remove himself from parent childlist
            if (null != _parentObject)
            {
                _parentObject.RemoveChildObject(this);
                _parentObject = null;
            }

            // finally release himself
            if (null != _comProxy)
            {
                Marshal.ReleaseComObject(_comProxy);
                _comProxy = null;
            }
        }