From 9904031f5291daaf56985146bb671f25e18ebbdf Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 02 四月 2020 19:51:31 +0800 Subject: [PATCH] 最新代码 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs | 87 ++++++++++++++++++++++++++----------------- 1 files changed, 53 insertions(+), 34 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs index b53b1c9..4593695 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightMenuControl.cs @@ -5,7 +5,7 @@ namespace Shared.Phone.UserCenter { /// <summary> - /// 鍋氭垚涓�涓瓨鍦ㄤ簬鍙充笂瑙掔殑鑿滃崟鎺т欢 + /// 鍋氭垚涓�涓瓨鍦ㄤ簬鍙充笂瑙掔殑鑿滃崟鎺т欢(闈炴ゼ灞傝彍鍗�,閮藉彲浠ヤ娇鐢�) /// </summary> public class TopRightMenuControl : FrameLayout { @@ -16,9 +16,9 @@ /// </summary> private VerticalListControl listView = null; /// <summary> - /// 鍓嶅洖閫夋嫨鐨勮 + /// 鑳屾櫙瀹瑰櫒鎺т欢 /// </summary> - private FrameRowControl oldRowFrame = null; + private FrameLayout frameBack = null; /// <summary> /// 琛岄珮搴� /// </summary> @@ -37,7 +37,7 @@ #region 鈻� 鍒濆鍖朹____________________________ /// <summary> - /// 鍋氭垚涓�涓瓨鍦ㄤ簬鍙充笂瑙掔殑鑿滃崟鎺т欢 + /// 鍋氭垚涓�涓瓨鍦ㄤ簬鍙充笂瑙掔殑鑿滃崟鎺т欢(闈炴ゼ灞傝彍鍗�,閮藉彲浠ヤ娇鐢�) /// </summary> /// <param name="i_RowCount">涓�鍏辨湁鍑犺(涓嶅惈鏍囬)</param> /// <param name="i_widthType">杩欎釜鑿滃崟鐨勫搴︽ā寮�,鐩墠鍙敮鎸� @@ -87,7 +87,7 @@ } //鑳屾櫙 - var frameBack = new FrameLayout(); + this.frameBack = new FrameLayout(); frameBack.X = Application.GetRealWidth(662 - (RowWidth - 395)); frameBack.Y = Application.GetRealHeight(161); frameBack.Width = Application.GetRealWidth(RowWidth); @@ -131,20 +131,22 @@ #region 鈻� 娣诲姞鑿滃崟___________________________ /// <summary> - /// 娣诲姞鑿滃崟琛� + /// 娣诲姞鑿滃崟琛�(UI濂囪懇鍙樻洿浜�,鏆楄壊鍥剧墖涓洪�変腑,榛戣壊鍥剧墖涓洪潪閫変腑) /// </summary> /// <param name="TextValue">鏄剧ず鐨勬枃瀛�</param> - /// <param name="unSelectPic">鍥剧墖</param> - /// <param name="selectPic">鍥剧墖</param> + /// <param name="selectPic">鍥剧墖(鏆楄壊鍥剧墖)</param> + /// <param name="unSelectPic">鍥剧墖(榛戣壊鍥剧墖)</param> /// <param name="action">鍗曞嚮鑿滃崟鎵ц鐨勪簨浠�</param> /// <param name="closeOnClick">鍗曞嚮鐨勬椂鍊欙紝鍏抽棴鑿滃崟</param> - public void AddRowMenu(string TextValue, string unSelectPic, string selectPic, Action action, bool closeOnClick = true) + public void AddRowMenu(string TextValue, string selectPic, string unSelectPic, Action action, bool closeOnClick = true) { var rowFrame = new FrameRowControl(); rowFrame.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft; rowFrame.Height = Application.GetRealHeight(RowHeight); listView.AddChidren(rowFrame); rowFrame.MainKeys = listView.ChildrenCount.ToString(); + //杩欓噷鐗规畩锛岀Щ闄ゆ帀鑷韩鐨勫崟鍑讳簨浠� + rowFrame.RemoveBaseClickEvent(); //鍥炬爣 var btnIcon = rowFrame.AddLeftIcon(81); btnIcon.UnSelectedImagePath = unSelectPic; @@ -159,39 +161,43 @@ btnLine.X = Application.GetRealWidth(81); } - if (listView.ChildrenCount == 1) - { - //绗竴涓彍鍗曢粯璁よ缃负閫夋嫨鐘舵�� - this.SetRowSelectStatu(rowFrame, true); - this.oldRowFrame = rowFrame; - } - else - { - //鍏朵粬鑿滃崟涓虹伆鑹� - btnIcon.IsSelected = false; - btnText.TextColor = UserCenterColor.Current.TextGrayColor1; - } + //鍒濆鐘舵�佸叏涓洪潪閫変腑鐘舵�� + this.SetRowSelectStatu(rowFrame, false); - //閫夋嫨鐘舵�� + bool happenMove = false; + //閫夋嫨鐘舵��(閲嶅啓搴曞眰鏁堟灉) rowFrame.SelectStatuEvent += (statu) => { - //false涓烘帶浠惰嚜韬嚜鍔ㄦ墽琛�,杩欓噷涓嶉渶瑕佽繕鍘� + //false涓虹姸鎬佽繕鍘�,浣嗘槸鐘舵�佽繕鍘熸斁鍦ㄩ紶鏍囧脊璧蜂簨浠堕噷闈� if (statu == true) { //璁剧疆涓洪�夋嫨鐘舵�� this.SetRowSelectStatu(rowFrame, true); - this.oldRowFrame = rowFrame; + happenMove = false; } }; - //鎸夐敭鐐瑰嚮 rowFrame.ButtonClickEvent += (sender, e) => { + //璁剧疆涓洪潪閫夋嫨鐘舵�� + this.SetRowSelectStatu(rowFrame, false); + if (closeOnClick == true) { this.RemoveFromParent(); } action?.Invoke(); + }; + + //寮�濮嬭Е鍙戠Щ鍔ㄤ簨浠�(杩欎釜浜嬩欢浼氶绻佺殑瑙﹀彂) + btnIcon.ButtonHappenMoveEvent += () => + { + if (happenMove == false) + { + //璁剧疆涓洪潪閫夋嫨鐘舵�� + this.SetRowSelectStatu(rowFrame, false); + } + happenMove = true; }; } #endregion @@ -215,17 +221,30 @@ var btnText = (NormalViewControl)frame.GetChildren(1); if (btnText != null) { - btnText.TextColor = select == true ? UserCenterColor.Current.TextColor1 : UserCenterColor.Current.TextGrayColor1; - btnText.IsBold = select; + btnText.TextColor = select == true ? UserCenterColor.Current.TextGrayColor1 : UserCenterColor.Current.TextColor1; + btnText.IsBold = !select; } - //鍓嶅洖閫夋嫨鐨勮彍鍗曚负null,鎴栬�呮槸鐩稿悓鐨勪笢瑗�,鍒欎笉澶勭悊 - if (this.oldRowFrame == null || this.oldRowFrame.MainKeys == frame.MainKeys) - { - return; - } + } - //鍓嶅洖閫夋嫨鐨勮杩樺師 - this.SetRowSelectStatu(this.oldRowFrame, false); + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 閲嶆柊璁剧疆鐧借壊閮ㄥ垎鐨勫潗鏍� + /// </summary> + /// <param name="XX">鐪熷疄鍊�(涓嶆敼鍙樼殑璇濆~-1)</param> + /// <param name="YY">鐪熷疄鍊�(涓嶆敼鍙樼殑璇濆~-1)</param> + public void SetLocation(int XX = -1, int YY = -1) + { + if (XX != -1) + { + frameBack.X = XX; + } + if (YY != -1) + { + frameBack.Y = YY; + } } #endregion -- Gitblit v1.8.0