曾经有过如何微软创建漂亮的长时间运行的窗口在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