From dc0309e64f02227d8e1468b7326c07955f804612 Mon Sep 17 00:00:00 2001 From: chenqiyang <1406175257@qq.com> Date: 星期三, 22 六月 2022 11:22:18 +0800 Subject: [PATCH] 修改引用路径 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs | 735 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 366 insertions(+), 369 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs old mode 100755 new mode 100644 index f5da451..32a5655 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutStatuControl.cs @@ -1,369 +1,366 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; - -namespace Shared.Phone.UserCenter -{ - /// <summary> - /// 鍋氭垚涓�涓偣鍑诲悗鑳藉鏄剧ず鐐瑰嚮鐘舵�佺殑鎺т欢(鍩哄眰鎺т欢) - /// </summary> - public class FrameLayoutStatuControl : FrameLayoutBase - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 鍗曞嚮寮硅捣浜嬩欢 - /// </summary> - public Action<object, MouseEventArgs> ButtonClickEvent; - /// <summary> - /// 鐘舵�佽缃殑浜嬩欢(浼氶噸杞藉簳灞傛晥鏋�) - /// </summary> - public Action<bool> SelectStatuEvent; - /// <summary> - /// 鏄惁鍚敤鐐逛寒鍔熻兘(榛樿鍚敤) - /// </summary> - public bool UseClickStatu = true; - /// <summary> - /// 鑳藉惁鐐瑰嚮 - /// </summary> - public bool CanClick = true; - /// <summary> - /// 鍘熸潵鐨勮儗鏅壊 - /// </summary> - private uint oldBackColor = 0; - /// <summary> - /// 褰撳墠鏄惁宸茬粡澶勪簬閫夋嫨鐘舵�� - /// </summary> - private bool IsSelectStatu = false; - /// <summary> - /// 瀛愭帶浠禮杞村亸绉婚噺(鍏遍�氬畾涔夎�屽凡) - /// </summary> - public int chidrenYaxis = 0; - /// <summary> - /// 鍦嗚搴� - /// </summary> - public int RadiusEx - { - set { this.Radius = (uint)Application.GetRealHeight(value); } - } - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - /// <summary> - /// 鍋氭垚涓�涓偣鍑诲悗鑳藉鏄剧ず鐐瑰嚮鐘舵�佺殑鎺т欢 - /// </summary> - /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param> - public FrameLayoutStatuControl(int i_ChidrenYaxis = 0) - { - this.chidrenYaxis = i_ChidrenYaxis; - - this.MouseUpEventHandler += ChildrenUpEvent; - this.MouseDownEventHandler += ChildrenDownEvent; - } - - #endregion - - #region 鈻� 缁戝畾浜嬩欢___________________________ - - /// <summary> - /// 鍙樻洿瀛愭帶浠剁殑缁戝畾妯″紡 - /// </summary> - /// <param name="view">瀛愭帶浠�</param> - /// <param name="chidrenBindMode">鍙樻洿鐨勭粦瀹氭ā寮�</param> - public void ChangedChidrenBindMode(View view, ChidrenBindMode chidrenBindMode) - { - if (view is ButtonBase) - { - //瀛愭帶浠剁Щ闄や簨浠� - ButtonBase button = (ButtonBase)view; - button.ButtonClickEvent -= ChildrenUpEvent; - button.MouseDownEventHandler -= ChildrenDownEvent; - - this.BindChidrenEvent(view, chidrenBindMode); - } - else if (view is ImageView) - { - view.MouseUpEventHandler -= ChildrenUpEvent; - view.MouseDownEventHandler -= ChildrenDownEvent; - - this.BindChidrenEvent(view, chidrenBindMode); - } - else if (view is ViewGroup) - { - ViewGroup groupContr = (ViewGroup)view; - for (int i = 0; i < groupContr.ChildrenCount; i++) - { - var myView = groupContr.GetChildren(i); - if (myView == null) - { - break; - } - if (myView is ButtonBase) - { - //瀛愭帶浠剁Щ闄や簨浠� - ButtonBase button = (ButtonBase)myView; - button.ButtonClickEvent -= ChildrenUpEvent; - button.MouseDownEventHandler -= ChildrenDownEvent; - } - } - //鑷韩绉婚櫎浜嬩欢 - groupContr.MouseUpEventHandler -= ChildrenUpEvent; - groupContr.MouseDownEventHandler -= ChildrenDownEvent; - - this.BindChidrenEvent(view, chidrenBindMode); - } - } - - /// <summary> - /// 缁戝畾瀛愭帶浠朵簨浠�(濡傛灉鏄鍚堟帶浠�,鍦ㄥ垵濮嬪寲瀹屾垚鍚�,璋冪敤ChangedChidrenBindMode) - /// </summary> - /// <param name="view"></param> - /// <param name="chidrenBindMode"></param> - private void BindChidrenEvent(View view, ChidrenBindMode chidrenBindMode) - { - if (chidrenBindMode == ChidrenBindMode.NotBind) - { - return; - } - if (view is ButtonBase) - { - //涓哄瓙鎺т欢娣诲姞浜嬩欢 - ButtonBase button = (ButtonBase)view; - button.ButtonClickEvent -= ChildrenUpEvent; - button.MouseDownEventHandler -= ChildrenDownEvent; - - button.ButtonClickEvent += ChildrenUpEvent; - button.MouseDownEventHandler += ChildrenDownEvent; - } - else if (view is ImageView) - { - //鑷韩涔熸坊鍔犱簨浠� - view.MouseUpEventHandler -= ChildrenUpEvent; - view.MouseDownEventHandler -= ChildrenDownEvent; - - view.MouseUpEventHandler += ChildrenUpEvent; - view.MouseDownEventHandler += ChildrenDownEvent; - } - else if (view is ViewGroup) - { - //涓哄瓙鎺т欢娣诲姞浜嬩欢 - ViewGroup groupContr = (ViewGroup)view; - for (int i = 0; i < groupContr.ChildrenCount; i++) - { - var myView = groupContr.GetChildren(i); - if (myView == null) - { - break; - } - if (myView is ButtonBase) - { - //涓哄瓙鎺т欢娣诲姞浜嬩欢 - ButtonBase button = (ButtonBase)myView; - button.ButtonClickEvent -= ChildrenUpEvent; - button.MouseDownEventHandler -= ChildrenDownEvent; - - button.ButtonClickEvent += ChildrenUpEvent; - button.MouseDownEventHandler += ChildrenDownEvent; - } - } - //鑷韩涔熸坊鍔犱簨浠� - groupContr.MouseUpEventHandler -= ChildrenUpEvent; - groupContr.MouseDownEventHandler -= ChildrenDownEvent; - - groupContr.MouseUpEventHandler += ChildrenUpEvent; - groupContr.MouseDownEventHandler += ChildrenDownEvent; - } - } - - #endregion - - #region 鈻� 娣诲姞瀛愭帶浠禵________________________ - - /// <summary> - /// 娣诲姞瀛愭帶浠� - /// </summary> - /// <param name="view">瀛愭帶浠�</param> - /// <param name="chidrenBindMode">缁戝畾妯″紡</param> - public void AddChidren(View view, ChidrenBindMode chidrenBindMode = ChidrenBindMode.BindAll) - { - this.oldBackColor = this.BackgroundColor; - - base.AddChidren(view); - - //缁戝畾瀛愭帶浠朵簨浠� - this.BindChidrenEvent(view, chidrenBindMode); - } - - #endregion - - #region 鈻� 鎺т欢浜嬩欢___________________________ - - /// <summary> - /// 鐐瑰嚮鎸変笅浜嬩欢(鐐逛寒) - /// </summary> - /// <param name="sender">Sender.</param> - /// <param name="e">E.</param> - private void ChildrenDownEvent(object sender, MouseEventArgs e) - { - if (this.UseClickStatu == false || this.CanClick == false) - { - return; - } - this.StartSelectStatuAppeal(ControlCommonResourse.StatuChangedWaitTime); - } - - /// <summary> - /// 鐐瑰嚮鏉惧紑浜嬩欢 - /// </summary> - /// <param name="sender">Sender.</param> - /// <param name="e">E.</param> - private void ChildrenUpEvent(object sender, MouseEventArgs e) - { - if (this.CanClick == false) - { - //涓嶅厑璁哥偣鍑� - return; - } - if (sender is FrameLayoutStatuControl) - { - //LOG鍑哄姏 - this.WriteLog(); - } - try - { - //璋冪敤濮旀墭 - ButtonClickEvent?.Invoke(sender, e); - } - catch (Exception ex) - { - //鍑虹幇鏈煡閿欒 - var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError)); - alert.Show(); - //Log鍑哄姏 - HdlLogLogic.Current.WriteLog(ex); - } - } - - #endregion - - #region 鈻� 鍗曞嚮鐘舵�佹樉绀篲______________________ - - /// <summary> - /// 璁剧疆鍗曞嚮鍚庣粨鏉熺殑鐘舵�� - /// </summary> - public void SetClickNotSelectStatu() - { - this.IsSelectStatu = false; - if (this.SelectStatuEvent != null) - { - this.SelectStatuEvent(false); - return; - } - - this.BackgroundColor = this.oldBackColor; - } - - /// <summary> - /// 璁剧疆鍗曞嚮鏃剁殑鐘舵�� - /// </summary> - public void SetClickSelectStatu() - { - this.IsSelectStatu = true; - if (this.SelectStatuEvent != null) - { - this.SelectStatuEvent(true); - return; - } - - this.BackgroundColor = UserCenterColor.Current.RowSelectBackColor; - } - - #endregion - - #region 鈻� 涓�鑸柟娉昣__________________________ - - /// <summary> - /// 寮哄埗瀹炴柦鎺т欢閫変腑鐘舵�佺殑鐗规晥 - /// </summary> - /// <param name="waiTime"></param> - public void StartSelectStatuAppeal(int waiTime) - { - if (this.IsSelectStatu == true) - { - return; - } - this.IsSelectStatu = true; - - //璁剧疆閫夋嫨鐘舵�� - this.SetClickSelectStatu(); - HdlThreadLogic.Current.RunThread(() => - { - System.Threading.Thread.Sleep(waiTime); - Application.RunOnMainThread(() => - { - //璁剧疆涓嶉�夋嫨鐘舵�� - this.SetClickNotSelectStatu(); - }); - }); - } - - /// <summary> - /// 绉婚櫎搴曞眰鎺т欢鑷韩鐨勫崟鍑讳簨浠� - /// </summary> - public void RemoveBaseClickEvent() - { - this.MouseUpEventHandler -= ChildrenUpEvent; - this.MouseDownEventHandler -= ChildrenDownEvent; - } - - /// <summary> - /// 鎺т欢鎽ф瘉 - /// </summary> - public override void RemoveFromParent() - { - this.ButtonClickEvent = null; - this.SelectStatuEvent = null; - - base.RemoveFromParent(); - } - - #endregion - - #region 鈻� Log鍑哄姏____________________________ - - /// <summary> - /// 璇ユ帶浠舵墍灞炵殑鐣岄潰鍚嶅瓧 - /// </summary> - private string formName = null; - - /// <summary> - /// Log鍑哄姏 - /// </summary> - private void WriteLog() - { - if (formName == null) - { - formName = string.Empty; - View myView = this.Parent; - for (; ; ) - { - if (myView == null) - { - break; - } - else if (myView is CommonFormBase) - { - formName = ((CommonFormBase)myView).FormID; - break; - } - myView = myView.Parent; - } - } - HdlLogLogic.Current.WriteLog(1, formName + ".FrameLayoutControl 琚偣鍑�"); - } - - #endregion - } -} +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 鍋氭垚涓�涓偣鍑诲悗鑳藉鏄剧ず鐐瑰嚮鐘舵�佺殑鎺т欢(鍩哄眰鎺т欢) + /// </summary> + public class FrameLayoutStatuControl : FrameLayoutBase + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 鐘舵�佽缃殑浜嬩欢(浼氶噸杞藉簳灞傛晥鏋�) + /// </summary> + public Action<bool> SelectStatuEvent; + /// <summary> + /// 鏄惁鍚敤鐐逛寒鍔熻兘(榛樿鍚敤) + /// </summary> + public bool UseClickStatu = true; + /// <summary> + /// 鍘熸潵鐨勮儗鏅壊 + /// </summary> + private uint oldBackColor = 0; + /// <summary> + /// 褰撳墠鏄惁宸茬粡澶勪簬閫夋嫨鐘舵�� + /// </summary> + private bool IsSelectStatu = false; + /// <summary> + /// 瀛愭帶浠禮杞村亸绉婚噺(鍏遍�氬畾涔夎�屽凡) + /// </summary> + public int chidrenYaxis = 0; + /// <summary> + /// 鍦嗚搴� + /// </summary> + public int RadiusEx + { + set { this.Radius = (uint)Application.GetRealHeight(value); } + } + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍋氭垚涓�涓偣鍑诲悗鑳藉鏄剧ず鐐瑰嚮鐘舵�佺殑鎺т欢 + /// </summary> + /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param> + public FrameLayoutStatuControl(int i_ChidrenYaxis = 0) + { + this.chidrenYaxis = i_ChidrenYaxis; + + //缃┖搴曞眰鐨勪簨浠� + this.MouseUpEventHandler = null; + this.MouseUpEventHandler += ChildrenUpEvent; + this.MouseDownEventHandler += ChildrenDownEvent; + } + + #endregion + + #region 鈻� 缁戝畾浜嬩欢___________________________ + + /// <summary> + /// 鍙樻洿瀛愭帶浠剁殑缁戝畾妯″紡 + /// </summary> + /// <param name="view">瀛愭帶浠�</param> + /// <param name="chidrenBindMode">鍙樻洿鐨勭粦瀹氭ā寮�</param> + public void ChangedChidrenBindMode(View view, ChidrenBindMode chidrenBindMode) + { + if (view is ButtonBase) + { + //瀛愭帶浠剁Щ闄や簨浠� + ButtonBase button = (ButtonBase)view; + button.ButtonClickEvent -= ChildrenUpEvent; + button.MouseDownEventHandler -= ChildrenDownEvent; + + this.BindChidrenEvent(view, chidrenBindMode); + } + else if (view is ImageView) + { + view.MouseUpEventHandler -= ChildrenUpEvent; + view.MouseDownEventHandler -= ChildrenDownEvent; + + this.BindChidrenEvent(view, chidrenBindMode); + } + else if (view is ViewGroup) + { + ViewGroup groupContr = (ViewGroup)view; + for (int i = 0; i < groupContr.ChildrenCount; i++) + { + var myView = groupContr.GetChildren(i); + if (myView == null) + { + break; + } + if (myView is ButtonBase) + { + //瀛愭帶浠剁Щ闄や簨浠� + ButtonBase button = (ButtonBase)myView; + button.ButtonClickEvent -= ChildrenUpEvent; + button.MouseDownEventHandler -= ChildrenDownEvent; + } + } + //鑷韩绉婚櫎浜嬩欢 + groupContr.MouseUpEventHandler -= ChildrenUpEvent; + groupContr.MouseDownEventHandler -= ChildrenDownEvent; + + this.BindChidrenEvent(view, chidrenBindMode); + } + } + + /// <summary> + /// 缁戝畾瀛愭帶浠朵簨浠�(濡傛灉鏄鍚堟帶浠�,鍦ㄥ垵濮嬪寲瀹屾垚鍚�,璋冪敤ChangedChidrenBindMode) + /// </summary> + /// <param name="view"></param> + /// <param name="chidrenBindMode"></param> + private void BindChidrenEvent(View view, ChidrenBindMode chidrenBindMode) + { + if (chidrenBindMode == ChidrenBindMode.NotBind) + { + return; + } + if (view is ButtonBase) + { + //涓哄瓙鎺т欢娣诲姞浜嬩欢 + ButtonBase button = (ButtonBase)view; + button.ButtonClickEvent -= ChildrenUpEvent; + button.MouseDownEventHandler -= ChildrenDownEvent; + + button.ButtonClickEvent += ChildrenUpEvent; + button.MouseDownEventHandler += ChildrenDownEvent; + } + else if (view is ImageView) + { + //鑷韩涔熸坊鍔犱簨浠� + view.MouseUpEventHandler -= ChildrenUpEvent; + view.MouseDownEventHandler -= ChildrenDownEvent; + + view.MouseUpEventHandler += ChildrenUpEvent; + view.MouseDownEventHandler += ChildrenDownEvent; + } + else if (view is ViewGroup) + { + //涓哄瓙鎺т欢娣诲姞浜嬩欢 + ViewGroup groupContr = (ViewGroup)view; + for (int i = 0; i < groupContr.ChildrenCount; i++) + { + var myView = groupContr.GetChildren(i); + if (myView == null) + { + break; + } + if (myView is ButtonBase) + { + //涓哄瓙鎺т欢娣诲姞浜嬩欢 + ButtonBase button = (ButtonBase)myView; + button.ButtonClickEvent -= ChildrenUpEvent; + button.MouseDownEventHandler -= ChildrenDownEvent; + + button.ButtonClickEvent += ChildrenUpEvent; + button.MouseDownEventHandler += ChildrenDownEvent; + } + } + //鑷韩涔熸坊鍔犱簨浠� + groupContr.MouseUpEventHandler -= ChildrenUpEvent; + groupContr.MouseDownEventHandler -= ChildrenDownEvent; + + groupContr.MouseUpEventHandler += ChildrenUpEvent; + groupContr.MouseDownEventHandler += ChildrenDownEvent; + } + } + + #endregion + + #region 鈻� 娣诲姞瀛愭帶浠禵________________________ + + /// <summary> + /// 娣诲姞瀛愭帶浠� + /// </summary> + /// <param name="view">瀛愭帶浠�</param> + /// <param name="chidrenBindMode">缁戝畾妯″紡</param> + public void AddChidren(View view, ChidrenBindMode chidrenBindMode = ChidrenBindMode.BindEvent) + { + this.oldBackColor = this.BackgroundColor; + + base.AddChidren(view); + + //缁戝畾瀛愭帶浠朵簨浠� + this.BindChidrenEvent(view, chidrenBindMode); + } + + /// <summary> + /// 娣诲姞瀛愭帶浠� + /// </summary> + /// <param name="view"></param> + public override void AddChidren(View view) + { + this.AddChidren(view, ChidrenBindMode.NotBind); + } + + #endregion + + #region 鈻� 鎺т欢浜嬩欢___________________________ + + /// <summary> + /// 鐐瑰嚮鎸変笅浜嬩欢(鐐逛寒) + /// </summary> + /// <param name="sender">Sender.</param> + /// <param name="e">E.</param> + private void ChildrenDownEvent(object sender, MouseEventArgs e) + { + if (this.UseClickStatu == false || this.CanClick == false) + { + return; + } + this.StartSelectStatuAppeal(ControlCommonResourse.StatuChangedWaitTime); + } + + /// <summary> + /// 鐐瑰嚮鏉惧紑浜嬩欢 + /// </summary> + /// <param name="sender">Sender.</param> + /// <param name="e">E.</param> + private void ChildrenUpEvent(object sender, MouseEventArgs e) + { + if (this.CanClick == false) + { + //涓嶅厑璁哥偣鍑� + return; + } + if (sender is FrameLayoutStatuControl) + { + //LOG鍑哄姏 + this.WriteLog(); + } + try + { + //璋冪敤濮旀墭 + ButtonClickEvent?.Invoke(sender, e); + } + catch (Exception ex) + { + //鍑虹幇鏈煡閿欒 + var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError)); + alert.Show(); + //Log鍑哄姏 + HdlLogLogic.Current.WriteLog(ex); + } + } + + #endregion + + #region 鈻� 鍗曞嚮鐘舵�佹樉绀篲______________________ + + /// <summary> + /// 璁剧疆鍗曞嚮鍚庣粨鏉熺殑鐘舵�� + /// </summary> + public void SetClickNotSelectStatu() + { + this.IsSelectStatu = false; + if (this.SelectStatuEvent != null) + { + this.SelectStatuEvent(false); + return; + } + + this.BackgroundColor = this.oldBackColor; + } + + /// <summary> + /// 璁剧疆鍗曞嚮鏃剁殑鐘舵�� + /// </summary> + public void SetClickSelectStatu() + { + this.IsSelectStatu = true; + if (this.SelectStatuEvent != null) + { + this.SelectStatuEvent(true); + return; + } + + this.BackgroundColor = UserCenterColor.Current.RowSelectBackColor; + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 寮哄埗瀹炴柦鎺т欢閫変腑鐘舵�佺殑鐗规晥 + /// </summary> + /// <param name="waiTime"></param> + public void StartSelectStatuAppeal(int waiTime) + { + if (this.IsSelectStatu == true) + { + return; + } + this.IsSelectStatu = true; + + //璁剧疆閫夋嫨鐘舵�� + this.SetClickSelectStatu(); + HdlThreadLogic.Current.RunThread(() => + { + System.Threading.Thread.Sleep(waiTime); + HdlThreadLogic.Current.RunMain(() => + { + //璁剧疆涓嶉�夋嫨鐘舵�� + this.SetClickNotSelectStatu(); + }); + }); + } + + /// <summary> + /// 绉婚櫎搴曞眰鎺т欢鑷韩鐨勫崟鍑讳簨浠� + /// </summary> + public void RemoveBaseClickEvent() + { + this.MouseUpEventHandler -= ChildrenUpEvent; + this.MouseDownEventHandler -= ChildrenDownEvent; + } + + /// <summary> + /// 鎺т欢鎽ф瘉 + /// </summary> + public override void RemoveFromParent() + { + this.SelectStatuEvent = null; + + base.RemoveFromParent(); + } + + #endregion + + #region 鈻� Log鍑哄姏____________________________ + + /// <summary> + /// Log鍑哄姏 + /// </summary> + private void WriteLog() + { + if (formName == null) + { + formName = string.Empty; + View myView = this.Parent; + for (; ; ) + { + if (myView == null) + { + break; + } + else if (myView is CommonFormBase) + { + formName = ((CommonFormBase)myView).FormID; + break; + } + myView = myView.Parent; + } + } + HdlLogLogic.Current.WriteLog(1, formName + ".FrameLayoutControl 琚偣鍑�"); + } + + #endregion + } +} -- Gitblit v1.8.0