Exemplo n.º 1
0
        private void lnkbtnPrevious_Click(object sender, EventArgs e)
        {
            PageIndex -= 1;

            if (PageIndex <= 0)
            {
                PageIndex = 1;
            }

            //实例化自定义扩展类PageIndexChangedEventArgs
            pce = new PageIndexChangedEventArgs(this.PageIndex);
            OnNewOnPageIndexChanged(pce);
            Bind();
        }
Exemplo n.º 2
0
 /// <summary>
 /// 截取键盘Enter(回车)事件,跳转到某页
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void nudPageIndex_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)13)
     {
         this.PageIndex = Convert.ToInt32(nudPageIndex.Value);
         pce = new PageIndexChangedEventArgs(this.PageIndex);
         OnNewOnPageIndexChanged(pce);
         Bind();
     }
 }
Exemplo n.º 3
0
 private void lnkbtnNext_Click(object sender, EventArgs e)
 {
     this.PageIndex += 1;
     if (PageIndex > PageCount)
     {
         PageIndex = PageCount;
     }
     //实例化自定义扩展类PageIndexChangedEventArgs
     pce = new PageIndexChangedEventArgs(this.PageIndex);
     OnNewOnPageIndexChanged(pce);
     Bind();
 }
Exemplo n.º 4
0
        private void lnkbtnFirst_Click(object sender, EventArgs e)
        {
            PageIndex = 1;

            //实例化自定义扩展类PageIndexChangedEventArgs
            pce = new PageIndexChangedEventArgs(this.PageIndex);
            OnNewOnPageIndexChanged(pce);
            Bind();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 页码下拉框选中项发生改变时引发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbxPageSize_SelectedIndexChanged(object sender, EventArgs e)
        {
            ////DHGateAssistantConfig.Instance.PageSize = this.PageSize;
            ////DHGateAssistantConfig.Instance.Save();

            PageIndex = 1;

            //实例化自定义扩展类PageIndexChangedEventArgs
            pce = new PageIndexChangedEventArgs(this.PageIndex);
            OnNewOnPageIndexChanged(pce);
            Bind();

            if (this.OnPageSizeChanged != null)
                OnPageSizeChanged(this, e);
        }
Exemplo n.º 6
0
 private void btnGo_Click(object sender, EventArgs e)
 {
     this.PageIndex = Convert.ToInt32(nudPageIndex.Value);
     pce = new PageIndexChangedEventArgs(this.PageIndex);
     OnNewOnPageIndexChanged(pce);
     Bind();
 }
Exemplo n.º 7
0
        /// <summary>
        /// 声明负责引发事件的方法
        /// </summary>
        /// <param name="e"></param>
        protected virtual void OnNewOnPageIndexChanged(PageIndexChangedEventArgs e)
        {
            //处于线程安全的考虑,现将委托字段的引用复制到一个临时字段中
            EventHandler<PageIndexChangedEventArgs> args =
                Interlocked.CompareExchange(ref OnPageIndexChanged, null, null);

            //任何方法登记了对我们事件的关注,就通知他们
            if (args != null)
            {
                args(this, e);
            }
        }