Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

After a site is provisioned my code is continue to run. Is there a way to put hour glass or some animated image until i hit the last line of the code?

public override void WebProvisioned(SPWebEventProperties properties)
share|improve this question
    
Did this work for you? I was trying to accomplish teh same thing in my ItemAdding event receiver but I can't figure out how to use the SPLongOperation method. –  user4390 Aug 9 '11 at 14:34
add comment

2 Answers

up vote 1 down vote accepted

The default WebProvisioned event receiver is asynchronous and actually runs under the owstimer, not the IIS worker process. Regardless, even if you specify synchronous, there is no ability to interact with the user browser to control the cursor.

share|improve this answer
    
Thanks for the inside details. –  Monica Contera May 18 '11 at 17:17
    
Thanks @Chris.. Is there an equivilant synchronous method for WebProvisioned that is run in the user context? I'm not able to get in and check right at the moment. –  Clayton Firth May 18 '11 at 22:27
    
You need to add a Synchronization node to the event receiver element... check this blog: stefan-stanev-sharepoint-blog.blogspot.com/2010/09/… –  Chris Beckett May 19 '11 at 17:35
add comment

I believe that you can use the SPLongOperation class to achieve this.

You need to put the long running code between SPLogOperation.Begin() and SPLongOperaiton.End() method invocation.

var longOperation=new SPLongOperation(this.Page);
longOperation.LeadingHTML = "Please wait while the operation is running";
longOperation.TrailingHTML = "Once the operation is finished you will be redirected to result page";
longOperation.Begin();

//Do long operation here
Thread.Sleep(10000);

longOperation.End("Result.aspx");
share|improve this answer
2  
Using the SPLongOperation is an interesting idea, but I am not sure you can get a valid Page object in the event receiver. You would need to specify it to be synchronous and try to cast the page object from the HTTPContext since I don't believe it is provided in the event handler properties. –  Chris Beckett May 18 '11 at 6:41
    
I am willing to try your way. Thanks –  Monica Contera May 18 '11 at 17:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.