Пример #1
0
		/// <summary>
		///   Raises the Changing event. </summary>
		/// <param name="e">
		///   The arguments object associated with the Changing event. </param>
		/// <remarks>
		///   This method should be invoked prior to making a change to the profile so that the
		///   Changing event is raised, giving a chance to the handlers to prevent the change from
		///   happening (by setting e.Cancel to true). This method calls each individual handler 
		///   associated with the Changing event and checks the resulting e.Cancel flag.  
		///   If it's true, it stops and does not call of any remaining handlers since the change 
		///   needs to be prevented anyway. </remarks>
		/// <seealso cref="Changing" />
		/// <seealso cref="OnChanged" />
		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;
			}
		}
Пример #2
0
        /// <summary>
        ///   Raises the Changing event. </summary>
        /// <param name="e">
        ///   The arguments object associated with the Changing event. </param>
        /// <remarks>
        ///   This method should be invoked prior to making a change to the profile so that the
        ///   Changing event is raised, giving a chance to the handlers to prevent the change from
        ///   happening (by setting e.Cancel to true). This method calls each individual handler
        ///   associated with the Changing event and checks the resulting e.Cancel flag.
        ///   If it's true, it stops and does not call of any remaining handlers since the change
        ///   needs to be prevented anyway. </remarks>
        /// <seealso cref="Changing" />
        /// <seealso cref="OnChanged" />
        protected virtual void OnChanging(ProfileChangingArgs e)
        {
            if (Changing == null)
            {
                return;
            }

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

                if (e.Cancel)
                {
                    break;
                }
            }
        }