Click here to Skip to main content
15,895,746 members
Articles / Programming Languages / C#

WebBrowserControl for the .NET Framework 1.1

Rate me:
Please Sign up or sign in to vote.
3.06/5 (11 votes)
15 Apr 2010CPOL2 min read 98.8K   1.6K   21  
An implementation of a web browser control for the .NET Framework 1.1.
namespace Pajocomo.Windows.Forms
{
    /// <summary>
    /// Represents the method that will handle the <see cref="WebBrowserControl.ScriptError"/> event of the <see cref="WebBrowserControl"/>.
    /// </summary>
    /// <param name="sender">
    /// The source of the event.
    /// </param>
    /// <param name="e">
    /// A <see cref="ProcessUrlActionEventArgs"/> that contains the event data. 
    /// </param>
    public delegate void ProcessUrlActionEventHandler(object sender, ProcessUrlActionEventArgs e);

    /// <summary>
    /// Provides data for the <see cref="WebBrowserControl.ScriptError"/> event.
    /// </summary>
    public class ProcessUrlActionEventArgs : System.EventArgs
    {
        #region Private Instance Fields

        private bool handled;
		private bool cancel;
		private bool hasContext;
		private string url;
        private UrlAction urlAction;
        private UrlPolicy urlPolicy;
        private System.Guid context;
        private ProcessUrlActionFlags flags;

        #endregion

        #region Private Instance Constructors

        private ProcessUrlActionEventArgs() {}

        #endregion

        #region Internal Instance Constructors

		/// <summary>
		/// Provides data for the <see cref="WebBrowserControl.ScriptError"/> event.
		/// </summary>
		/// <param name="url">The URL.</param>
		/// <param name="urlAction">The URL action.</param>
		/// <param name="urlPolicy">The URL policy.</param>
		/// <param name="context">The context.</param>
		/// <param name="hasContext">The indication whether the URL action has context.</param>
		/// <param name="flags">The flags.</param>
        internal ProcessUrlActionEventArgs(
            string url,
            UrlAction urlAction,
            UrlPolicy urlPolicy,
            System.Guid context,
			bool hasContext,
            ProcessUrlActionFlags flags) : base()
        {
            this.url = url;
            this.urlAction = urlAction;
            this.urlPolicy = urlPolicy;
            this.context = context;
			this.hasContext = hasContext;
            this.flags = flags;
            this.handled = false;
			this.cancel = false;
        }

        #endregion

        #region Public Instance Properties

        /// <summary>
        /// Gets a value indicating whether the event was handled.
        /// </summary>
        /// <value><see langword="true"/> if handled; otherwise, <see langword="false"/>.</value>
        public bool Handled
        {
            get
            {
                return this.handled;
            }
            set
            {
                this.handled = value;
            }
        }

		/// <summary>
		/// Gets a value indicating whether the URL action should be canceled.
		/// </summary>
		/// <value>
		/// 	<see langword="true"/> if the URL action should be canceled; otherwise, <see langword="false"/>.
		/// </value>
		public bool Cancel
		{
			get
			{
				return this.cancel;
			}
			set
			{
				this.cancel = value;
			}
		}

        /// <summary>
        /// Gets the URL.
        /// </summary>
        /// <value>The URL.</value>
        public string Url
        {
            get
            {
                return this.url;
            }
        }

        /// <summary>
        /// Gets the action being performed.
        /// </summary>
        /// <value>The action being performed.</value>
        public UrlAction UrlAction
        {
            get
            {
                return this.urlAction;
            }
        }

        /// <summary>
        /// Gets or sets the URL policy to apply to the action.
        /// </summary>
        /// <value>The URL policy to apply to the action.</value>
        public UrlPolicy UrlPolicy
        {
            get
            {
                return this.urlPolicy;
            }
            set
            {
                this.urlPolicy = value;
            }
        }

        /// <summary>
        /// Gets the context information (a CLSID) used by the delegation routines.
        /// </summary>
        /// <value>The context information (a CLSID) used by the delegation routines.</value>
        /// <remarks>The value of this property is only valid is <see cref="HasContext"/> is <see langword="true"/>.</remarks>
        public System.Guid Context
        {
            get
            {
                return this.context;
            }
        }

		/// <summary>
		/// Gets a value indicating whether the URL action has context.
		/// </summary>
		/// <value>
		/// 	<see langword="true"/> if the URL action has context; otherwise, <see langword="false"/>.
		/// </value>
		public bool HasContext
		{
			get
			{
				return hasContext;
			}
		}

        /// <summary>
        /// Gets the flags.
        /// </summary>
        /// <value>The flags.</value>
        public ProcessUrlActionFlags Flags
        {
            get
            {
                return this.flags;
            }
		}

        #endregion

    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Paulo Morgado
Portugal Portugal

Comments and Discussions