黄学彪
2020-06-18 2450c12c825ad4d78d1572da2fa421706db2df2f
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs
@@ -49,6 +49,14 @@
        /// 进度值改变,如果要设置初始进度值,此变量要在设置初始进度值之前进行设置(第一个参数0:滑动的时候,1:手指弹起的时候)
        /// </summary>
        public Action<int, int> ProgressChangedEvent = null;
        /// <summary>
        /// 进度条事件的触发时间间隔(默认没有间隔,单位为毫秒)
        /// </summary>
        public int EventWaitTime = -1;
        /// <summary>
        /// 前回时间
        /// </summary>
        private DateTime oldTime = DateTime.Now;
        #endregion
@@ -62,10 +70,14 @@
        {
            this.Width = Application.GetRealWidth(i_width);
            this.Height = Application.GetRealHeight(84);
            //圆球的宽度
            this.ThumbImageHeight = Application.GetRealHeight(84);
            this.ThumbImagePath = "Item/SeekBarIcon.png";
            //进度条的宽度
            this.SeekBarViewHeight = Application.GetRealHeight(10);
            //进度条背景色
            this.SeekBarBackgroundColor = 0xfff5f5f5;
            //上方是否显示文本
            this.IsProgressTextShow = false;
            this.MaxValue = 100;
            this.Gravity = Gravity.CenterHorizontal;
@@ -92,6 +104,13 @@
                this.OnProgressChangedEvent -= this.MyProgressChangedEvent;
                return;
            }
            //时间间隔
            if (EventWaitTime != -1)
            {
                if ((DateTime.Now - oldTime).TotalMilliseconds < EventWaitTime) { return; }
                oldTime = DateTime.Now;
            }
            this.ProgressChangedEvent(0, value);
        }
@@ -107,6 +126,7 @@
                this.OnStopTrackingTouchEvent -= this.MyStopTrackingTouchEvent;
                return;
            }
            //弹起事件不需要判断时间
            this.ProgressChangedEvent(1, value);
        }