|
|
|
Pretty IE Toolbar in C# |
|
|
|
||||
IntroductionOne of our clients addressed to KBSoft with an idea to create a commercial toolbar for Internet Explorer. The idea was simple – it was necessary to implement a toolbar for Internet Explorer 7.0 containing the following elements:
We started to work on this task and started with a choice of a platform. As it turned out, it is not a simple thing to make a toolbar for Internet Explorer with a declared functionality. It is necessary to deal with Com-components, interact with browser and store cashed data somewhere. Fortunately, it appeared that it is possible to do everything on .Net 2.0. platform, which simplified the task a lot. The result of our work is given below – it is IEToolbarEngine component, presenting high level interface for toolbar and its elements creation. Perhaps, this component will allow you to implement own toolbars or you will find some useful data for the implementation of own projects in MS Visual Studio environment in the description of this device. |
Usage
If to speak generally, the toolbar presents itself |
|||
|
internal void CreateToolbarItems ()
{
try
{
…
//Get current assembly.
Assembly currentAssembly =
Assembly.GetAssembly( this.GetType() );
//Links cration.
Link link1 = new Link("Home page",
"http://kbsoft-group.com/");
Link link2 = new Link("Clear Search History",
IEToolbarEngine.WrapInternalCommand(IEToolbarEngine.cmdClearHistory));
//Getting image from resources
Image img = Image.FromStream(
currentAssembly.GetManifestResourceStream("IEToolbarEngine.main.png") );
//Create toobar item.
menu = new MainMenu( this, "Company", "Main",
new Link[] { link1, link2 }, img);
//Add item to internal collection
items.Add (menu);
…
}
}
|
||||
|
A creation of one toolbar element is demonstrated here, this element contains a logo and a brief drop-down menu.
An item is created with the help of |
||||
|
|
||||
|
A created element will look like that:
Title text, tips, array of links ( |
Let us note, for those who are curious, that name of a resource embedded into the assembly is formed
from the default namespace name, and from the resource name itself
(hence, the line
After a creation, it is necessary to add a new element into the collection of
Creation of several elements is demonstrated in |
|||
SearchBoxItemnew SearchBoxItem (this, " |
||||
|
The following parameters are specified to the constructor: link to |
A few words about search line format. There are |
|||
LinkListItem
LinkListItem(this, "Advantages", "Advantages",
new Link[] { link1, link2, link3, link4 }, img);
|
||||
|
Simple list with links. Constructor parameters- link to
|
||||
RssTicker
RssTicker(this, "RSS", "RSS Channel",
"http://www.euro2008.uefa.com/rss/index.xml", 1440, img, "RSSChannel");
|
||||
|
This element presents itself a list of links received from RSS feed. For that, a link to RSS-feed and a period of channel update is given to a constructor. The string – a unique name of RSS-channel, which will be used for creation of a cash-file in application folder in "Application Data\IEToolbar\Cache", should be transmitted the last. The resulting element looks like that:
|
||||
Installation ProjectAlso the demo project contains an installation project IEToolbarInstallation, generating Setup.exe file, which allows to install the toolbar to the user machine and delete it if necessary. It is created by the means of MS Visual Studio. The moments, connected with the implementation of installation project which should be paid attention to, are given below.
There is |
The installer is given a directive to search this class in the build at the installation and start its
actions
Basic for |
|||
Offshore software development which feels in-house © 2000 - 2007 KB_Soft Group |
KB_Soft Group 18/1 Planirovochnaya st., Novosibirsk 630032 Russia |
info@kbsoft-group.com tel: +7 (383) 3553313 fax: +7 (383) 3553250 |