From 00ab3ddb140ba8bb88b5cf572b004a85e1da85e9 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期四, 02 一月 2020 19:51:56 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into DEV_GXC --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs | 144 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 144 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs new file mode 100755 index 0000000..a293155 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/SeekBarControl.cs @@ -0,0 +1,144 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 宸﹀彸婊戝姩鐨勮繘搴︽潯鎺т欢 + /// </summary> + public class SeekBarControl : DiyImageSeekBar + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + private uint nowProgressBarColor = 0; + /// <summary> + /// 鎺т欢鑳藉惁浣跨敤 + /// </summary> + public new bool Enable + { + set + { + this.IsClickable = value; + if (value == true) + { + //鍘熸潵鐨勯鑹� + base.ProgressBarColor = nowProgressBarColor; + } + else + { + //鐏拌壊 + base.ProgressBarColor = 0xffe8e8e8; + } + } + } + + /// <summary> + /// 杩涘害鏉¢鑹� + /// </summary> + public new uint ProgressBarColor + { + set + { + nowProgressBarColor = value; + base.ProgressBarColor = value; + } + } + + /// <summary> + /// 杩涘害鍊兼敼鍙�,濡傛灉瑕佽缃垵濮嬭繘搴﹀��,姝ゅ彉閲忚鍦ㄨ缃垵濮嬭繘搴﹀�间箣鍓嶈繘琛岃缃�(绗竴涓弬鏁�0:婊戝姩鐨勬椂鍊�,1:鎵嬫寚寮硅捣鐨勬椂鍊�) + /// </summary> + public Action<int, int> ProgressChangedEvent = null; + /// <summary> + /// 杩涘害鏉′簨浠剁殑瑙﹀彂鏃堕棿闂撮殧(榛樿娌℃湁闂撮殧) + /// </summary> + public int EventWaitTime = -1; + /// <summary> + /// 鍓嶅洖鏃堕棿 + /// </summary> + private DateTime oldTime = DateTime.Now; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 宸﹀彸婊戝姩鐨勮繘搴︽潯鎺т欢 + /// </summary> + /// <param name="i_width">瀹藉害,闈炵湡瀹炲��</param> + public SeekBarControl(int i_width = 962) + { + 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; + + //杩涘害鏉″�兼敼鍙樹簨浠� + this.OnProgressChangedEvent += this.MyProgressChangedEvent; + //鎵嬫寚寮硅捣浜嬩欢 + this.OnStopTrackingTouchEvent += this.MyStopTrackingTouchEvent; + } + + #endregion + + #region 鈻� 浜嬩欢_______________________________ + + /// <summary> + /// 杩涘害鏉″�兼敼鍙樹簨浠� + /// </summary> + /// <param name="sender"></param> + /// <param name="value"></param> + private void MyProgressChangedEvent(object sender, int value) + { + if (this.ProgressChangedEvent == null) + { + this.OnProgressChangedEvent -= this.MyProgressChangedEvent; + return; + } + //鏃堕棿闂撮殧 + if (EventWaitTime != -1) + { + if ((DateTime.Now - oldTime).TotalMilliseconds < EventWaitTime) { return; } + oldTime = DateTime.Now; + } + + this.ProgressChangedEvent(0, value); + } + + /// <summary> + /// 鎵嬫寚寮硅捣浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="value"></param> + private void MyStopTrackingTouchEvent(object sender, int value) + { + if (this.ProgressChangedEvent == null) + { + this.OnStopTrackingTouchEvent -= this.MyStopTrackingTouchEvent; + return; + } + //寮硅捣浜嬩欢涓嶉渶瑕佸垽鏂椂闂� + this.ProgressChangedEvent(1, value); + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鎺т欢鎽ф瘉 + /// </summary> + public override void RemoveFromParent() + { + this.ProgressChangedEvent = null; + base.RemoveFromParent(); + } + + #endregion + } +} -- Gitblit v1.8.0