Click here to Skip to main content
15,880,503 members
Articles / Programming Languages / C#

Extended .NET 2.0 WebBrowser Control

Rate me:
Please Sign up or sign in to vote.
4.90/5 (118 votes)
29 Mar 20069 min read 1.4M   37.7K   341  
Extending the .NET 2.0 WebBrowser control.
using System;
using System.Collections.Generic;
using System.Text;
using ExtendedWebBrowser2.Properties;

namespace ExtendedWebBrowser2
{
  /// <summary>
  /// This class is used for obtaining and storing settings
  /// </summary>
  /// <remarks>
  /// This is a single instance class, so that there is only one
  /// instance needed of the <see cref="Settings"/> class
  /// </remarks>
  class SettingsHelper
  {
    /// <summary>
    /// Creates a new instance of the <see cref="SettingsHelper"/> class
    /// </summary>
    private SettingsHelper()
    {
      _mySettings = new Settings();
    }

    /// <summary>
    /// Stores the instance of the <see cref="Settings"/> class
    /// </summary>
    private Settings _mySettings;

    /// <summary>
    /// Stores the instance of the <see cref="SettingsHelper"/> class
    /// </summary>
    private static SettingsHelper _instance;
    
    /// <summary>
    /// An object for locking the thread, when needed
    /// </summary>
    private static object _lockObject = new object();

    /// <summary>
    /// Obtains the current instance of the <see cref="SettingsHelper"/> class.
    /// </summary>
    /// <remarks>
    /// If there is no instance of the <see cref="SettingsHelper"/> class, one will be created
    /// </remarks>
    public static SettingsHelper Current
    {
      get 
      {
        if (_instance == null)
        {
          lock (_lockObject)
          {
            if (_instance == null)
              _instance = new SettingsHelper();
          }
        }
        return _instance; 
      }
    }

    /// <summary>
    /// Gets or sets the <see cref="PopupBlockerFilterLevel"/>
    /// </summary>
    public PopupBlockerFilterLevel FilterLevel
    {
      get { return _mySettings.FilterLevel; }
      set { _mySettings.FilterLevel = value; }
    }

    /// <summary>
    /// Gets or sets a value indicating if script errors should be shown
    /// </summary>
    public bool ShowScriptErrors
    {
      get { return _mySettings.ShowScriptErrors; }
      set { _mySettings.ShowScriptErrors = value; }
    }

    /// <summary>
    /// Saves the <see cref="Settings"/>
    /// </summary>
    public void Save()
    {
      _mySettings.Save();
    }

  }
}

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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Chile Chile
I am
- born in The Netherlands
- living in Chile together with my wife.
- a Microsoft Certified Professional Developer on all 3 areas (Windows, Web and Enterprise)
- an MCITP on Microsoft SQL Server 2005 (Database Administrator)
- an active programmer for about 14 years.
- a business owner, of a Dutch company called "The Wheel Automatisering" (http://www.thewheel.nl)
- a coder in C#, VB.Net and Managed C++.
- someone who likes to share knowledge

For fun I like to go out with my dogs, enjoy the sun or write some articles that I share with the community.

Comments and Discussions