//Implement IController.InitializeResources public string InitializeAndStartProcess() { progressCollector = new ProgressCollector(Session); progressCollector.FlushSessionData(); Session["InnerBGWorker"] = null; Session["OuterBGWorker"] = null; bgWorker1 = new BackgroundWorker(); bgWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(StartProcessAsynchronously); bgWorker1.RunWorkerAsync(); return("<script>window.onload=function(){ShowProgressbar();}</script>"); }
public void GetProgress() { progressCollector = new ProgressCollector(Session); Progress currentProgress = progressCollector.GetCurrentStatusFromSession(); if (currentProgress.ProgressPercentage == 111) { Response.Write(currentProgress.ProgressPercentage + "$" + currentProgress.ProgressMessage + "$"); } else { Response.Write(currentProgress.ProgressPercentage + "$" + currentProgress.ProgressMessage + " : " + currentProgress.ProgressPercentage + "%" + "$"); } }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); if (!IsPostBack) { try { ProgressCollector pCollector = new ProgressCollector(Session); List <Progress> progressList = pCollector.GetAllProgresses(); GenerateHtml(progressList); } catch {} } }
protected void btn_SubmitaJob_click(object sender, EventArgs e) { progressCollector = new ProgressCollector(Session); progressCollector.FlushSessionData(); Session["InnerWorker_MH"] = null; Session["InnerWorker_NS"] = null; Session["InnerWorker_HAR"] = null; Session["OuterWorker"] = null; bgWorker1 = new BackgroundWorker(); bgWorker1.WorkerSupportsCancellation = true; bgWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(DO_Operation); //bgWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(CompleteLongProcess); bgWorker1.RunWorkerAsync(); //Response.Write("<script>window.onload=function(){ShowProgressbar();}</script>"); ClientScript.RegisterStartupScript(typeof(Page), "keyOne", "<script type=\"text/javascript\"> ShowProgressbar(); </script>", false); }