protected virtual void OnIntervalReached(TimerEventArgs e) { if (IntervalReached != null) { IntervalReached(this, e); } }
protected virtual void OnTimeOutOccurred(TimerEventArgs e) { if (TimeOutOccurred != null) { TimeOutOccurred(this, e); } }
protected void Timer1_TimeOutOccurred(object sender, CodeControls.TimerEventArgs e) { string qr = "insert into result values(" + Session["TestId"] + "," + Session["User_id"] + "," + Session["true"] + "," + Session["false"] + ")"; SqlCommand cmd = new SqlCommand(qr, con); cmd.ExecuteNonQuery(); Response.Redirect("Test_Result.aspx"); }
//protected override void OnInit(EventArgs e) //{ // AutoStart(); // // base.OnLoad(e); //} #region Load Timer private void AutoStart() { //Is Not Page Request A Call Back? if (!this.Page.IsCallback && Enabled && (IsAutoStart || IsManualStart)) { //First Request or Page Refresh? if (!Page.IsPostBack) { TimeLeft = TimeOut; CreateTimerCookie(false); //Load the Timer Script for the Post Back/Page Load LoadTimer(); } else { //Update lastIntervalTime cookie for this PostBack UpdateTimerCookie(); if (IsPostBackOnTimeOut) { TimeLeft = 0; TimerEventArgs eArgs = new TimerEventArgs(0); if (TimeOutOccurred != null) { TimeOutOccurred(this, eArgs); } this.Text = "0:0:0.0"; IsManualStart = false; //...Halt Timer } else { //Load the Timer Script for the Post Back/Page Load LoadTimer(); } } } else { //If the request is a Call Back then update the Timer Settings // UpdateTimerCookie(); } }
// Define method that processes the callbacks on server. public void RaiseCallbackEvent(String eventArgument) { Int32.TryParse(eventArgument, out iTimeLeft); //Raise an Page Event From a Custom Control TimerEventArgs e = new TimerEventArgs(TimeLeft); if (iTimeLeft != TimeOut && iTimeLeft >= 0) { if (IntervalReached != null) { IntervalReached(this, e); } } if (iTimeLeft < 0) { IsManualStart = false; if (TimeOutOccurred != null) { TimeOutOccurred(this, e); } } }
protected void Timer1_IntervalReached(object sender, CodeControls.TimerEventArgs e) { }
protected void Timer1_TimeOutOccurred(object sender, CodeControls.TimerEventArgs e) { Response.Redirect("LoginPage.aspx"); }