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:14 | punbb.net:extension_system 2020/02/06 11:04 current | ||
---|---|---|---|
Line 1: | Line 1: | ||
PunBB.NET extensions are a set of event handlers. | PunBB.NET extensions are a set of event handlers. | ||
All extensions use partial class Extension, which can be found in PunBB.Helpers namespace. | All extensions use partial class Extension, which can be found in PunBB.Helpers namespace. | ||
+ | |||
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 do define the events you are going to handle, use this code Methode 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 | ||
- | namespace PunBB.Helpers | + | In order to define a class for which you are creating a handler, you should write the following Method Attribute //ExtendClass(Class name)//. |
- | { | + | |
- | public partial class Extension | + | In order do define the events you are going to handle, use Method Attribute //HandleEvent(Event name)// |
- | { | + | |
- | [ExtendClass("PunBB.Default")] | + | 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 |
- | [HandleEvent("LoadComplete")] | + | |
- | public void pun_test(object sender, EventArgs e) | + | namespace PunBB.Helpers |
- | { | + | { |
- | PunPage page = (PunPage)sender; | + | public partial class Extension |
- | page.Response.Write(string.Format("We've {0} controls on this page.<BR/>",page.Form.Controls.Count)); | + | { |
- | foreach (Control i in page.Form.Controls) | + | [ExtendClass("PunBB.Default")] |
- | { | + | [HandleEvent("LoadComplete")] |
- | page.Response.Write(string.Format("We've {0} control on page. This control is an object of {1} class.<BR/>", i.ID, i.GetType())); | + | public void pun_test(object sender, EventArgs e) |
- | } | + | { |
- | page.Response.Write(string.Format("sitemap provider is {0}</BR>", SiteMap.Provider.Name)); | + | PunPage page = (PunPage)sender; |
- | } | + | page.Response.Write(string.Format("We've {0} controls on this page.<BR/>",page.Form.Controls.Count)); |
- | } | + | 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("sitemap provider is {0}</BR>", SiteMap.Provider.Name)); | ||
+ | } | ||
+ | } | ||
+ | } | ||