Differences
This shows you the differences between the selected revision and the current version of the page.
punbb.net:extension_system 2009/02/04 04:15 | punbb.net:extension_system 2020/02/06 11:04 current | ||
---|---|---|---|
Line 4: | Line 4: | ||
Methods of this class can be both EventHandlers and usual functions. | Methods of this class can be both EventHandlers and usual functions. | ||
- | In order to define a class for which you are creating a handler, you should write the following //Methode Attribute ExtendClass(Class name)//. | + | In order to define a class for which you are creating a handler, you should write the following Method Attribute //ExtendClass(Class name)//. |
- | In order do define the events you are going to handle, use this code //Methode Attribute HandleEvent(Event name)// | + | |
+ | In order do define the events you are going to handle, use Method Attribute //HandleEvent(Event name)// | ||
Here is an example of extension, which writes the names of all the controls used on //Default.aspx// page to it after it’s loading has been completed | Here is an example of extension, which writes the names of all the controls used on //Default.aspx// page to it after it’s loading has been completed | ||
- | namespace PunBB.Helpers | + | namespace PunBB.Helpers |
- | { | + | { |
- | public partial class Extension | + | public partial class Extension |
- | { | + | { |
- | [ExtendClass("PunBB.Default")] | + | [ExtendClass("PunBB.Default")] |
- | [HandleEvent("LoadComplete")] | + | [HandleEvent("LoadComplete")] |
- | public void pun_test(object sender, EventArgs e) | + | public void pun_test(object sender, EventArgs e) |
- | { | + | { |
- | PunPage page = (PunPage)sender; | + | PunPage page = (PunPage)sender; |
- | page.Response.Write(string.Format("We've {0} controls on this page.<BR/>",page.Form.Controls.Count)); | + | page.Response.Write(string.Format("We've {0} controls on this page.<BR/>",page.Form.Controls.Count)); |
- | foreach (Control i in page.Form.Controls) | + | foreach (Control i in page.Form.Controls) |
- | { | + | { |
- | page.Response.Write(string.Format("We've {0} control on page. This control is an object of {1} class.<BR/>", i.ID, i.GetType())); | + | page.Response.Write(string.Format("We've {0} control on page. This control is an object of {1} class.<BR/>", i.ID, i.GetType())); |
- | } | + | } |
- | page.Response.Write(string.Format("sitemap provider is {0}</BR>", SiteMap.Provider.Name)); | + | page.Response.Write(string.Format("sitemap provider is {0}</BR>", SiteMap.Provider.Name)); |
- | } | + | } |
- | } | + | } |
- | } | + | } |