BusyBoxDotNet (English)
For the original Italian page, please click on the link: http://www.guru4.net/articoli/busyboxdotnet/default.aspx
Nella construction of applications web can happen of having to carry out sul serveur delle operations that demand a discreet amount of time for being executed, like to example the generation of report or the execution of query complex on database.
Currently the browser available they do not preview an effect method in order to inform the customer who the demand has been carried out and in it has attended of an answer, inducing the utilizzatore not to understand why it continues to being visualized the same page, and consequently inrtroducendo the risk that it continues to carry out operations that they involve a cross-post of the data, than in many cases can be harmful.
In order to obviate to this BusyBoxDotNet problem it proposes a solution that is not only limited to inform the customer of the execution of the operation, but ago in stilisticamente elegant way and can prevent the submit repeated of data.
Background
The idea originates them is meritatamente due to Mark Wagner - of which BusyBoxDotNet it maintains the name - that of it has implemented an excellent version and works them.
The reason for which BusyBoxDotNet it has been created is the necessity to include all in a riutilizzabile and highly personalizzabile member, without the need of having to write code Javascript or modifying the pages manually web.
BusyBoxDotNet is in fact a bookcase of WebControls for ASP.NET, whose main control is exactly BusyBox. The other present controls in the bookcase allow to personalize of the behavior and to facilitate of integration.
Beyond to this, although BusyBoxDotNet initially is been born like a simple one porting of the idea originates them to ASP.NET, later on to a first release and thanks to the suggestions of Matteo Lineages the sources of the version originate them have been abandon to you and have been recreated from the null one in order to extend of the compatibility with the browser available and in order to improve of the behavior.
Technologies and languages use you
ASP.NET
Javascript
C #
Browser heads
The operation of BusyBoxDotNet has been verified on following browser:
Internet Explorer 6.0
Work 8,52 *
Netscape 8.1
Firefox 1.5
* Work is supported with some limitations; you see continuation notes.
Introduction
Various ways exist in order to resolve the problem of the notification to the customer of a process that can potentially demand much time for being completed. A common method is the visualization of an intermediate page that as an example takes care of the notification, visualizing an animated image and an informative message. E' always this then that it is taken care to begin the process to long duration, so that it can remain visualized until its completion.
This approach has however some limitations, more or less meaningful:
Alone nella navigation between two different pages works, cannot be applied al postback della same page.
It demands the manual modification of all the pages in the case in which it wants to be included in a preesistente application.
It implies the loss of all the advantages brings to you from the ViewState.
For this reason BusyBoxDotNet is realized in order to exceed all these limitations, nonchè in order to bring remarkable improvements:
He is applicable to whichever demand to the serveur web, from postback to the demand for one the new page.
Benchè is not its scope originates them is possible to use it even if a side does not happen roundtrip towards the serveur but also only client.
E' simple to insert in preesistenti pages and does not demand no manual modification of the pages.
The approach of BusyBoxDotNet can therefore be reassumed in these points:
It comes included in the page a script Javascript that is taken care of its creation, together to other functions helper.
The visualization can happen intercepting the event onbeforeunload of the element window - implying therefore the visualization during whichever transition of page, it is it demanded it of one new resource or a postback - intercepting the solo postback the page, or personalizing the visualization choosing manually when it must be visualized (useful for the browser that they do not support the event onbeforeunload like Work).
Through Javascript and DOM it comes dynamically created and added to the document an element div, that it contains the message to optionally visualize to the customer and an animated image.
The recovery of the resources embedded in assembly (scripts and the images) happens through HttpHandler. For the scripts it is also possible to include in the page their content, and in this case the HttpHandler does not come used.
Characteristics
BusyBoxDotNet can be used like whichever other bookcase of controls web, and like these the controls contained in BusyBoxDotNet have a behavior of default, that it is possible to personalize is to Time design that programmaticamente.
The behavior standard of the BusyBox control is reassumed in these points:
Visualization to the postback of the page in which it comes inserted (compatible with all the browser with which it has been tested)
-
Layout with messages and image standard:

Visualization of a layer of overlay semi-transparent of the same color of the background of the page, that it prevents every ulterior interaction with the elements of the page during the visualization of the box.
While this is the behavior of default, the remarkable amount of property exposed from the control concurs to personalize it liberations.
What is possible to make
Of continuation a list is brought back of that it is possible to make with BusyBoxDotNet, and subsequently also of that at the moment it is not possible to make, but that it could be present in future versions.
Chosen of the event that triggers the visualization of the BusyBox: onbeforeunload, onsubmit or personalized.
Modification of the style of the box: text, dimension, image, edge, background, layout.
They are present become part images between which it is possible to choose (approached through HttpHandler), but it is also possible to choose of one personalized (recovery from the rows system).Possibility to make to appear the box with a delay, nonchè to hide it after a sure one timeout. These characteristics are interesting in the case are wanted to be only visualized the box if a determined process more demands than a time defined for being completed, or in the case in which it is wanted to be hidden if within a sure time the process has not been still carried a.termine.
Possibility to make to appear the box with an effect of fade-in, choosing of the speed.
Possibility to carry out the fading of the box when the mouse it is posizionato to you over.
Possibility to disabilitare the visualization of the layer of overlay.
Chosen of the color and the opacity of the layer of overlay.
Timing of the layer of overlay. In the case in which the box it is made to appear with delay and/or to disappear with advance payment, it is possible to choose the behavior of the layer of overlay.
Possibility to choose if to visualize box even if the document it has not been completely loaded and to show a message of alert in affirmative case.
What still is not possible to make
To manually define a layout for the box.
To set up a various positioning from that one of default (always centered to the inside dell page).
It does not preview the presence of smartnavigation in the page.
It cannot be moved through drag-and-drop.
Whichever window cannot be closed manually like one.
Public properties
The following table lists the property that is possible to use in order to personalize the style and the behavior of the BusyBox control.
Category: style (appearance)
| Name | Type | Description |
| BackColor | Color | Color of the background of the box. Attention: the images embedded in the assembly have all background white man, therefore with a background of other color the effect will not be exceptional. |
|---|---|---|
| BorderColor | Color | Color of the edge of the box. |
| BorderStyle | BorderStyle | Style of the edge of the box. |
| BorderWidtd | Unit | Thickness of the edge of the box. |
| FadeOnMouseOverOpacity | Int | Opacity of the box when the mouse there is over. Value from 0 to 100. 0 mean transparent, 100 completely opaque. This property is estimated alone if the FadeOnMouseOver property is set up to true. |
| Image | ImageTemplate | Selection of the image between those precaricate in the assembly. |
| ImagePosition | ImagePositioning | Position of the image in the box. Available two layout predefined. |
| ImageUrl | String | URL of the personalized image to show in the busybox. Only estimated if the Image property is set up to Custom. |
| Opacity | Int | Opacity of the box. Value from 0 to 100. 0 transparent, 100 opaque. |
| Text | String | Message to show in the box. |
| TextBold | Bool | Property bold of the message. |
| TextColor | Color | Color of the message. |
| TextFontName | String | Font of the message. |
| TextItalic | Bool | Property italic of the message. |
| TextSize | FontUnit | Dimension of the text of the message. |
| Title | String | Title to show in the box. |
| TitleBold | Bool | Property bold of the title it. |
| TitleColor | Color | Color of the title it. |
| TitleFontName | String | Font of the title it. |
| TitleItalic | Bool | Property italic of the title it. |
| TitleSize | FontUnit | Dimension of the title it. |
Category: behavior (behavior)
| Name | Type | Description |
| FadeInSpeed | Int | Speed of appearance of the box. 0 slow, 100 immediate. |
|---|---|---|
| FadeOnMouseOver | Bool | If set up to true the box he becomes semi-transparent to the passage of the mouse. |
| ShowBusyBox | ShowBehavior | Formulations of appearance of the box.
|
| ShowDelay | Int | Value in milliseconds of the delay of appearance of the box. |
| ShowTimeout | Int | Value in milliseconds of the timeout of appearance of the box. Expired the time it will come hidden. |
| Visible | Bool | It qualifies or disabilita the visualization of the box to level of page. |
Category: layout
| Name | Type | Description |
| Height | Unit | Height of the box. If set up it does not assume predefined dimensions. |
|---|---|---|
| Width | Unit | Width of the box. If set up it does not assume predefined dimensions. |
Category: misc
| Name | Type | Description |
| ID | Int | ID of the control. |
|---|---|---|
| AlertIfDocumentNotCompletelyLoaded | Bool | It visualizes a message of alert if it is attempted to visualize the box before that the document completely is loaded. |
| IncludeScriptsInPage | Bool | It includes the scripts directly Javascript in the page, instead that referenziarli through the attribute src. |
| ShowOnlyIfDocumentCompletelyLoaded | Bool | It only visualizes the box if the document has been completely loaded. |
Category: overlay
| Name | Type | Description |
| ImmediatelyOverlay | Bool | Used when the ShowDelay property has a greater value of 0. If set up to true, the overlay it comes hardly shown the event of visualization of the box comes triggered, even if it, because of the delay, he is not still visible. |
|---|---|---|
| KeepOverlay | Bool | Used when the ShowTimeout property has a greater value of 0. If set up to true, the overlay it comes maintained also the box is scomparso because of the timeout. |
| Overlay | Bool | It concurs to decide if to show or the overlay less. All the other property of this category are estimated alone if this assumes value true. |
| OverlayColor | Color | Color of the overlay. If set up it does not assume the color set up for the tag body of the page. |
| OverlayOpacity | Int | Opacity of the overlay. Value from 0 to 100. 0 transparent, 100 covering. |
Alternatives to I use of the events OnBeforeUnload and OnSubmit
In some cases the two alternatives available for the visualization of the box are not that one of which need can be had.
The Always value of the ShowBusyBox property records the OnBeforeUnload event of the element window, while the OnPostBackOnly value records the OnSubmit event of the form.
Together to the problem of the OnBeforeUnload event that in Work is not supported, it has been the reason for which to the bookcase they have been added three ulterior controls: BusyBoxPanel, BusyBoxHyperLink and BusyBoxButton.
Everyone of they inherits from omonimo the control standard of ASP.NET and exposes one ulterior property: BusyBoxToShow.
This property concurs to select the BusyBox control inserted in the page of which the visualization is wanted to be carried out. For everyone of the controls the event that triggera the visualization of the BusyBox to which it is associated is the event onClick side client.
In other words, if one becomes part in form a control of BusyBoxButton type and it is associated to present a BusyBox control in the page, to the click on the button it will come also visualized the BusyBox. The same thing happens for the BusyBoxHyperLink control and the elements, of whichever type they is, posizionati to the inside of a BusyBoxPanel control.
Compatibility
The BusyBoxDotNet bookcase is totally compatible with the versions indicated of the browser, but it is not excluded that he is compatible with others browser and different versions from those indicated.
The only limits of compatibility have been find to you with Work, and can be sintetizzabili in the following points:
Work does not support the OnBeforeUnload event, consequently when the ShowBusyBox property of the BusyBox control is set up to Always (OnBeforeUnload event), the box does not come visualized.
Work does not support the opacity of the elements, therefore it is box that the overlay they will be or invisibili or the completely completely opaque, and effects of fading are not obtainable.
Guide to I use
Of continuation the steps necessary are brought back in order to integrate BusyBoxDotNet to the inside of web forms ASP.NET.
To import the controls in Visual Study NET
In the case Visual is used Study NET is advisable to import the controls contained in the bookcase to the inside of the toolbox.
The detailed procedure is described in this article: Management of elements and cards in the Case of the instruments
Document Type
For the way in which it has been constructed, BusyBoxDotNet demands that the pages in which is inserted they are at least of 1,0 type XHTML Transitional. The DocType is specified in the first line of the page and can be found single in that point.
Visual Study NET 2003 of default uses HTML 4,0, therefore if it is used the IDE of Microsoft house is necessary to modify manually the pages inserting this directive:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Recording of the HttpHandler
In order to use the images and the scripts included in the assembly it is necessary to record a HttpHandler in the rows of configuration web.config of the application in which BusyBoxDotNet it will come used, than will be taken care of the recovery of the resources. In order to make that it is necessary to add the following declaration to the inside of the section < system.web > of the web.config:
<httpHandlers>
<add
verb="*"
path="BusyBoxDotNet.axd"
type="BusyBoxDotNet.ResourceHttpHandler, BusyBoxDotNet" />
</httpHandlers>
References
The BusyBoxDotNet plan is accommodated on sourceforge.net:
Situated Web: http://busybox.sourceforge.net/
Download: http://sourceforge.net/project/showfiles.php?group_id=159977
This article is reported to version 0.1.2 of BusyBoxDotNet