Ejemplo n.º 1
0
        /// <summary>
        ///   Initialize the events of the type.
        /// </summary>
        /// <param name="type">
        ///   A <b>Type</b> value.
        /// </param>
        private void InitEvents(Type type)
        {
            // Check parameters.
            if (type == null)
            {
                throw new ArgumentNullException();
            }

            // Get events in the type.
            EventInfo[] eventInfos = type.GetEvents(BindingFlags.DeclaredOnly |
                        BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);

            // Add the event to the tree view.
            foreach (EventInfo eventInfo in eventInfos)
            {
                // Get attributes for this event.
                string attributes = Utility.GetAttributesForMember(eventInfo);

                string temName = "Event: " + eventInfo.Name;
                string temText = temName + attributes;

                GCAEvent temEvent = new GCAEvent(temName, temText);
                this.Events.Add(temEvent);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///   Initialize the events of the type.
        /// </summary>
        /// <param name="type">
        ///   A <b>Type</b> value.
        /// </param>
        private void InitEvents(Type type)
        {
            // Check parameters.
            if (type == null)
            {
                throw new ArgumentNullException();
            }

            // Get events in the type.
            EventInfo[] eventInfos = type.GetEvents(
                        BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static);

            // Add the event to the tree view.
            foreach (EventInfo eventInfo in eventInfos)
            {
                // Get attributes for this event.
                string attributes = Utility.GetAttributesForMember(eventInfo);
                string temName = null;
                string temText = null;
                if (eventInfo.DeclaringType == type)
                {
                    temName = "Event";
                }
                else if (eventInfo.DeclaringType == typeof(System.Windows.Forms.Control))
                {
                    temName = "Event: From Control";
                }
                else
                {
                    temName = "Event: From Father";
                }

                temText = temName + " " + eventInfo.Name + attributes;

                GCAEvent temEvent = new GCAEvent(temName, temText, eventInfo.Name);
                this.Events.Add(temEvent);
            }
        }