示例#1
0
        private void Advise(object rcw)
        {
            BCLDebug.Assert(_connectionPoint == null, "comevent sink is already advised");

            ComTypes.IConnectionPointContainer cpc = (ComTypes.IConnectionPointContainer)rcw;
            ComTypes.IConnectionPoint          cp;
            cpc.FindConnectionPoint(ref _iidSourceItf, out cp);

            object sinkObject = this;

            cp.Advise(sinkObject, out _cookie);

            _connectionPoint = cp;
        }
示例#2
0
        private void Unadvise()
        {
            BCLDebug.Assert(_connectionPoint != null, "can not unadvise from empty connection point");

            try {
                _connectionPoint.Unadvise(_cookie);
                Marshal.ReleaseComObject(_connectionPoint);
            } catch (System.Exception) {
                // swallow all exceptions on unadvise
                // the host may not be available at this point
            } finally {
                _connectionPoint = null;
            }
        }
        private void Unadvise() {
            BCLDebug.Assert(_connectionPoint != null, "can not unadvise from empty connection point");

            try {
                _connectionPoint.Unadvise(_cookie);
                Marshal.ReleaseComObject(_connectionPoint);
            } catch (System.Exception) {
                // swallow all exceptions on unadvise
                // the host may not be available at this point
            } finally {
                _connectionPoint = null;
            }

        } 
        private void Advise(object rcw) {
            BCLDebug.Assert(_connectionPoint == null, "comevent sink is already advised");

            ComTypes.IConnectionPointContainer cpc = (ComTypes.IConnectionPointContainer)rcw;
            ComTypes.IConnectionPoint cp;
            cpc.FindConnectionPoint(ref _iidSourceItf, out cp);

            object sinkObject = this;

            cp.Advise(sinkObject, out _cookie);

            _connectionPoint = cp;
        }