当前位置导航:炫浪网>>网络学院>>编程开发>>C++教程>>C++进阶与实例

Asp.net定时控件

    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.ComponentModel;

    [assembly:TagPrefix("Beyondbit.App.Web.UI.WebControls", "BBit")]
    namespace Beyondbit.App.Web.UI.WebControls
    {

     #region ElapsedEventArgs  class
     public class ElapsedEventArgs  : EventArgs
     {
      public int SignalTime;
     }
     #endregion

     /// <summary>
     /// 客户端定时器
     /// </summary>
     [DefaultProperty("Enabled"),
      ToolboxData("<{0}:ClientTimer runat=server></{0}:ClientTimer>")]
     public class ClientTimer : System.Web.UI.Control , System.Web.UI.IPostBackEventHandler // , System.Web.UI.IPostBackDataHandler
     {
      public delegate void ElapsedEventHandler( object sender, ElapsedEventArgs e );
      public event ElapsedEventHandler Elapsed;

      protected virtual void OnElapsed( ElapsedEventArgs e)
      {
       if ( Elapsed != null )
        Elapsed(this, e);
      }

      private int signalTime = 0;

      private int interval = 0 ;
      [Description("设置或获取定时时间(毫秒)")]
      public int Interval
      {
       set
       {
        if( value <= 0 )
         throw new ArgumentException( "Interval时间间隔不能小于或等于0" );
        interval = value ;
       }
       get
       {
        return interval ;
       }
      }

      private bool enabled = false ;
      [Description("设置或获取定时器是否启用")]
      public bool Enabled
      {
       set{ enabled = value ; }
       get{ return enabled ;  }
      }

 

共3页 首页 上一页 1 2 3 下一页 尾页 跳转到
相关内容
赞助商链接