Пример #1
0
        /// <summary>  Adds an event handler(s) to the Cartridge.  This method
        /// will find all possible event handler interfaces supported
        /// by the passed in object.
        /// *
        /// </summary>
        /// <param name="ev">object impementing a valid EventHandler-derived interface
        /// </param>
        /// <returns>true if a supported interface, false otherwise or if null
        ///
        /// </returns>
        public virtual bool addEventHandler(EventHandler ev)
        {
            if (ev == null)
            {
                return(false);
            }

            bool found = false;

            if (ev is ReferenceInsertionEventHandler)
            {
                rieh  = (ReferenceInsertionEventHandler)ev;
                found = true;
            }

            if (ev is NullSetEventHandler)
            {
                nseh  = (NullSetEventHandler)ev;
                found = true;
            }

            if (ev is MethodExceptionEventHandler)
            {
                meeh  = (MethodExceptionEventHandler)ev;
                found = true;
            }

            return(found);
        }
Пример #2
0
        /// <summary>  Removes an event handler(s) from the Cartridge.  This method
        /// will find all possible event handler interfaces supported
        /// by the passed in object and remove them.
        /// *
        /// </summary>
        /// <param name="ev">object impementing a valid EventHandler-derived interface
        /// </param>
        /// <returns>true if a supported interface, false otherwise or if null
        ///
        /// </returns>
        public virtual bool removeEventHandler(EventHandler ev)
        {
            if (ev == null)
            {
                return(false);
            }

            bool found = false;

            if (ev == rieh)
            {
                rieh  = null;
                found = true;
            }

            if (ev == nseh)
            {
                nseh  = null;
                found = true;
            }

            if (ev == meeh)
            {
                meeh  = null;
                found = true;
            }

            return(found);
        }
	/// <summary>  Adds an event handler(s) to the Cartridge.  This method
	/// will find all possible event handler interfaces supported
	/// by the passed in object.
	/// *
	/// </summary>
	/// <param name="ev">object impementing a valid EventHandler-derived interface
	/// </param>
	/// <returns>true if a supported interface, false otherwise or if null
	///
	/// </returns>
	public virtual bool addEventHandler(EventHandler ev) {
	    if (ev == null) {
		return false;
	    }

	    bool found = false;

	    if (ev is ReferenceInsertionEventHandler) {
		rieh = (ReferenceInsertionEventHandler) ev;
		found = true;
	    }

	    if (ev is NullSetEventHandler) {
		nseh = (NullSetEventHandler) ev;
		found = true;
	    }

	    if (ev is MethodExceptionEventHandler) {
		meeh = (MethodExceptionEventHandler) ev;
		found = true;
	    }

	    return found;
	}
	/// <summary>  Removes an event handler(s) from the Cartridge.  This method
	/// will find all possible event handler interfaces supported
	/// by the passed in object and remove them.
	/// *
	/// </summary>
	/// <param name="ev">object impementing a valid EventHandler-derived interface
	/// </param>
	/// <returns>true if a supported interface, false otherwise or if null
	///
	/// </returns>
	public virtual bool removeEventHandler(EventHandler ev) {
	    if (ev == null) {
		return false;
	    }

	    bool found = false;

	    if (ev == rieh) {
		rieh = null;
		found = true;
	    }

	    if (ev == nseh) {
		nseh = null;
		found = true;
	    }

	    if (ev == meeh) {
		meeh = null;
		found = true;
	    }

	    return found;
	}