|
using hmlib.Web.UI.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Services;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebTest.ProgressBarTest
{
public partial class ProgressBar_AlternateProgress : System.Web.UI.Page
{
[WebMethod]
public static object getProgress(string progressId)
{
return Progress.GetResponse(progressId);
}
protected void btnStart_Click(object sender, EventArgs e)
{
Progress progress = ProgressBar1.Progress;
Thread thread = new Thread(() => Start(progress));
thread.Start();
btnStart.Enabled = false;
}
private void Start(Progress progress)
{
double max = 500;
for (int i = 0; i < max; i++)
{
Thread.Sleep(10);
progress.SetProgress(i / max);
}
progress.SetProgress(1);
}
protected void ProgressBar1_Complete(object sender, EventArgs e)
{
var progressBar = (ProgressBar)sender;
//var mydata = (MyDataType)progressBar.Progress.State;
btnStart.Enabled = true;
Label1.Text = DateTime.Now.ToString();
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.