Beispiel #1
0
        protected virtual void OnChanging(ProfileChangingArgs e)
        {
            if (Changing == null)
            {
                return;
            }

            foreach (ProfileChangingHandler handler in Changing.GetInvocationList())
            {
                handler(this, e);

                // If a particular handler cancels the event, stop
                if (e.Cancel)
                {
                    break;
                }
            }
        }
Beispiel #2
0
        protected bool RaiseChangeEvent(bool changing, ProfileChangeType changeType, string section, string entry, object value)
        {
            if (changing)
            {
                // Don't even bother if there are no handlers.
                if (Changing == null)
                {
                    return(true);
                }

                ProfileChangingArgs e = new ProfileChangingArgs(changeType, section, entry, value);
                OnChanging(e);
                return(!e.Cancel);
            }

            // Don't even bother if there are no handlers.
            if (Changed != null)
            {
                OnChanged(new ProfileChangedArgs(changeType, section, entry, value));
            }
            return(true);
        }