The Microsoft.SharePoint.SPLongOperation class is useful when providing consistent user feedback to users during long running synchronous operation. The documentation tells us that this class “Sets the Web page image to the image used by the server to indicate a lengthy operation (typically, an animated image with associated text)”.
For example, consider a scenario in which a SharePoint Web-Part page is used to add users to an External system by using a WCF service. The add user process maybe a lengthy operation based on the available business logic within the external system and can be wrapped in a SPLongOperation by calling the static SPLongOperation.Begin Method (String, String, SPLongOperation.BeginOperation) where the SPLongOperation.BeginOperation delegate specifies the delegate method that will begin the long operation. There are 2 string parameters which set the SPLongOperation.LeadingHTML and SPLongOperation.TrailingHTML properties (what is displayed as “the associated text”). When the call to the WCF service is completed successfully, the operation is ended by calling either the End or EndScript method, based on whether the window was opened as a dialog or not which can be verified if the query string parameter “IsDlg”, which will be equal to 1 if it is a dialog window. Here is an example for using SPLongOperation:
Additional information on SPLongOperation can be found here: