コード例 #1
0
        /// <summary>
        /// Cleans up the COM object references.
        /// </summary>
        /// <param name="disposing">
        /// <see langword="true"/> if this was called from the
        /// <see cref="IDisposable"/> interface.
        /// </param>
        private void Dispose(bool disposing)
        {
            lock (this)
            {
                if (null != _eventSink)
                {
                    _eventSink.Dispose();
                    _eventSink = null;
                }

                if (null != _connectionPoint)
                {
                    while (Marshal.ReleaseComObject(_connectionPoint) > 0)
                    {
                        ;
                    }
                    _connectionPoint = null;
                }

                if (null != _connectionPointContainer)
                {
                    while (Marshal.ReleaseComObject(_connectionPointContainer) > 0)
                    {
                        ;
                    }
                    _connectionPointContainer = null;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Initialize the event sink.
        /// </summary>
        private void Initialize()
        {
            if (null == _connectionPointContainer)
            {
                throw new ObjectDisposedException("ComEventProvider");
            }

            IConnectionPoint connectionPoint;
            Guid             pointGuid = _connectionPointGuid;

            _connectionPointContainer.FindConnectionPoint(ref pointGuid, out connectionPoint);
            _connectionPoint = connectionPoint;

            _eventSink = (ComEventSink)Activator.CreateInstance(_eventSinkType);
            _eventSink.Connect(_connectionPoint);
            _eventSink.Owner = _owner;
        }
コード例 #3
0
		/// <summary>
		/// Cleans up the COM object references.
		/// </summary>
		/// <param name="disposing">
		/// <see langword="true"/> if this was called from the
		/// <see cref="IDisposable"/> interface.
		/// </param>
		private void Dispose(bool disposing)
		{
			lock(this)
			{
				if (null != _eventSink)
				{
					_eventSink.Dispose();
					_eventSink = null;
				}
				
				if (null != _connectionPoint)
				{
					while( Marshal.ReleaseComObject(_connectionPoint) > 0 );
					_connectionPoint = null;
				}
				
				if (null != _connectionPointContainer)
				{
					while( Marshal.ReleaseComObject(_connectionPointContainer) > 0 );
					_connectionPointContainer = null;
				}
			}
		}
コード例 #4
0
		/// <summary>
		/// Initialize the event sink.
		/// </summary>
		private void Initialize()
		{
			if (null == _connectionPointContainer)
				throw new ObjectDisposedException("ComEventProvider");
			
			IConnectionPoint connectionPoint;
			Guid pointGuid = _connectionPointGuid;
			_connectionPointContainer.FindConnectionPoint(ref pointGuid, out connectionPoint);
			_connectionPoint = connectionPoint;
			
			_eventSink = (ComEventSink)Activator.CreateInstance(_eventSinkType);
			_eventSink.Connect(_connectionPoint);
			_eventSink.Owner = _owner;
		}