Reprinted from: http://blog.joycode.com/joy/archive/2006/11/04/86110.aspx
In the past, the book was connected. Happy has already raised a demand for everyone and provided ideas for solving technical difficulties. I don't know how many friends have begun to write their first sidebar gadget that is not "Hello World. Starting today, we will gradually introduce how to develop sidebar gadget.
Use gadget. XML to define sidebar gadget
Just as every computer language has an entry function, sidebar gadget also has a main entry at startup, and this main entry file is Gadget. xml. However, you can store this file in multiple regions, that is, the root directory of the gadget, or the regional language (such as ZH-CN, en-US) Directory of the gadget. According to my understanding, Gadget should first find the most suitable tool under the regional language directory. XML, and then find the gadget In the root directory. XML, while a typical gadget. the XML file structure is as follows (the description file of the Vista built-in clock gadget, the red text in the document is happy comments, and the numbers in the comments correspond to the numbers in the figure ):
<? XML version = "1.0" encoding = "UTF-8"?>
<Gadget>
<Name> clock </Name> defines the gadget name (1)
<Namespace> Microsoft. Windows </namespace> defines the namespace of the gadget and interacts with Js.
<Version> 1.0.0.0 </version> Version Information (2)
<Author name = "Microsoft Corporation"> author information (3)
<Info url = "http://go.microsoft.com/fwlink? Linkid = 55696 "text =" www.gallery.microsoft.com "/> link to the author's website (4)
<Logo src = "logo.png"/> author's logo information (5)
</Author>
<Copyright>? 2006 </Copyright> copyright information (6)
<Description> View the clock in your time zone or any city in the world. </Description> function description (7)
<Icons>
<Icon Height = "48" width = "48" src = "icon.png"/> icon displayed when the toolbox is to be selected (8)
</Icons>
<Hosts>
<Host name = "sidebar"> only sidebar is supported. In the future, live.com or slideshow may adopt a unified approach.
<Base type = "html" apiversion = "1.0.0" src = "clock.html"/> type only supports HTML, and may support WPF, WPF, E, or Ajax in the future; SRC is used to specify the HTML source file of the main interface.
<Permissions> full </permissions> currently, only full can be set. See this article.
<Platform minplatformversion = "1.0" type = "apiname" text = "apiname"/>
<Defaultimage src = "drag.png"/> the logo displayed when you drag the tool selection box to the sidebar
</Host>
</Hosts>
</Gadget>
Through the above information, sidebar can get the relevant information in the gadget, but a gadget is more than that. For example, when the above clock is displayed in the sidebar, it should be shown in the left figure. In this case, we noticed that there is a small wrench icon that can be used to choose its favorite watch shape or other custom settings. How is this part reflected in the source code?
Also, there are some gadget, such as the built-in RSS reader. When you clickArticleWhen the title is displayed, A flyout window is automatically displayed on the left.Source codeIn response?
In addition, the CPU and memory usage of the gadget that comes with the system is similar to the car's speedtable. How does it obtain such real-time system information?
In addition, when a gadget is dragged from the sidebar to the desktop, the page size changes. Why?
Also, there are many transparent effects in gadget. For example, the table is surrounded by transparent, circular, or other types, rather than the rectangles of common web pages. Why?
In addition, the server side in the gadget file interacts with the client to implement partial refreshing, but the ASP. NET Ajax framework is not used. Why?
If you are interested, please continue to read this tutorial. Please come here today.