曾經有過如何微軟創建漂亮的長時間運行的窗口在SharePoint 2007中的工作原理?
SPLongOperation是要使用的類。它有2個重要的方法
開始和結束;
長時間運行的所有代碼都放置在開始和結束之間。
下面是一個示例類。
這幾乎是簡單的,只是工作:-)
using System;
using System.Web;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
namespace CreateLongOperation
{
public class LongRun : System.Web.UI.Page
{
protected Button buttonOk;
protected void Page_Load(object sender, EventArgs e)
{
buttonOk.Click += new EventHandler(buttonOk_Click);
}
void buttonOk_Click(object sender, EventArgs e)
{
SPLongOperation operation = new SPLongOperation(this.Page);
operation.Begin();
// do long operation code here...
System.Threading.Thread.Sleep(6000);
operation.End("http://sps/_layouts/Mynewpage.aspx");
}
}
}
感謝您分享您的解決方案,拉爾斯。我可能會堅持使用Publishing Infrastructure選項,因爲它是我們可用的最低成本選項。 – 2009-04-21 12:34:04