Skip to main content

Proxy Switcher

Go Search
Home
Proxy Switcher
AutoHistory for Word 2007
Browser Selector
  
Projects on mwiedemeyer.de > Proxy Switcher > Pages > Switcher-en  

How to create your own switcher?
 

Proxy Switcher actually support Internet Explorer, Firefox and Opera. Normally this is enough, because most applications can use the Internet Explorer proxy settings.

If you now have an application with its own proxy configuration, you can create your own switcher for this app, so it can be automatically managed by Proxy Switcher.

In this article I will show you, how to do it..

Implementation

First of all, you need to create a new class library project in Visual Studio 2008. Its also possible to use the free version Visual Studio 2008 Express (C# or VB.NET).

image

Next, you need to add a reference to ProxySwitcher.Shared.dll. The base class is contained in this assembly.

image

Next, rename the Class1.cs file in DemoSwitcher.cs for example. This class now needs to inherit from SwitcherBase class. Therefore you will also need a using statement:

image

All necessary methods can be automatically created by using the SmartTag which appears if you have SwitcherBase completely typed in. These methods are “DisableProxy”, “EnableProxy” and the property “Name”.

image

The name property returns the name of this switcher which is later shown in the Proxy Switcher UI.

Enable and Disable should be self-explanatory. Within these methods you can access this.CurrentProxyEntry to retrieve the proxy settings which should be activated/deactivated.

image

This is the minimal needed code.

Advanced

If you want to do a little bit more, you can create a settings dialog or load/save configurations specially needed for your switcher:

image 

Deployment

After you code is complete, the project needs to be compiled. The assembly (for me "PSDemoSwitcher.dll") now have to be copied to the Proxy Switcher folder, normally “C:\Program Files\ProxySwitcher”.

If you now start Proxy Switcher, your newly created switcher should appear in the "Application" tab.

image

 

Download:

The documented sample code can be downloaded here.