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/CompoundControls/TopRightFloorMenuControl.cs | 518 +++++++++++++++++++++++++++++---------------------------- 1 files changed, 262 insertions(+), 256 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightFloorMenuControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightFloorMenuControl.cs old mode 100755 new mode 100644 index 9238cc3..22699d1 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightFloorMenuControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/TopRightFloorMenuControl.cs @@ -1,257 +1,263 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; - -namespace Shared.Phone.UserCenter -{ - /// <summary> - /// 鍋氭垚涓�涓瓨鍦ㄤ簬鍙充笂瑙掔殑妤煎眰鑿滃崟鎺т欢 - /// </summary> - public class TopRightFloorMenuControl : FrameLayout - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - /// <summary> - /// 鍒楄〃鎺т欢 - /// </summary> - private VerticalListControl listView = null; - /// <summary> - /// 鍓嶅洖閫夋嫨鐨勮 - /// </summary> - private FrameRowControl oldRowFrame = null; - /// <summary> - /// 鑳屾櫙瀹瑰櫒鎺т欢 - /// </summary> - private FrameLayout frameBack = null; - /// <summary> - /// 琛岄珮搴� - /// </summary> - private int RowHeight = 150; - /// <summary> - /// 琛屽搴� - /// </summary> - private int RowWidth = 395; - /// <summary> - /// 琛屾暟 - /// </summary> - private int RowCount = 0; - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - /// <summary> - /// 鍋氭垚涓�涓瓨鍦ㄤ簬鍙充笂瑙掔殑妤煎眰鑿滃崟鎺т欢 - /// </summary> - /// <param name="i_RowCount">涓�鍏辨湁鍑犺(涓嶅惈鏍囬)</param> - /// <param name="i_widthType">杩欎釜鑿滃崟鐨勫搴︽ā寮�,鐩墠鍙敮鎸� - /// <para>1: 395瀹藉害</para> - /// <para>2: 449瀹藉害</para> - /// </param> - /// <param name="titleText">鏍囬鏂囨湰(濡傛灉涓嶄负绌�,鑿滃崟妯″紡鍙樻洿涓烘嫢鏈夋爣棰樼殑妯″紡)</param> - public TopRightFloorMenuControl(int i_RowCount, int i_widthType, string titleText = null) - { - this.RowCount = i_RowCount; - if (i_widthType == 1) - { - this.RowWidth = 395; - } - else if (i_widthType == 2) - { - this.RowWidth = 449; - } - //鍒濆鍖栫敾闈㈢殑鎺т欢 - this.InitFormControl(titleText, i_widthType); - } - - /// <summary> - /// 鍒濆鍖栫敾闈㈢殑鎺т欢 - /// </summary> - private void InitFormControl(string titleText, int i_widthType) - { - this.BackgroundColor = UserCenterColor.Current.DialogBackColor; - this.MouseUpEventHandler += (sender2, e2) => - { - //鍏抽棴鑷韩 - this.RemoveFromParent(); - }; - var frame = (FrameLayout)UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1); - frame.AddChidren(this); - - //鏈�澶ф樉绀�5涓� - int rowCount = this.RowCount > 5 ? 5 : this.RowCount; - if (titleText != null) - { - //449瀹藉害鐨勬椂鍊欙紝鍗充娇鏄庣粏宸茬粡瓒呰繃浜�5涓紝浣嗘槸杩樻槸鍙互+1鐨�,鍥犱负杩欎釜妯″紡澶氫簡涓�寮犲浘鐗� - if (rowCount < 5 || i_widthType == 2) - { - //鑿滃崟+1 - rowCount++; - } - } - - //鑳屾櫙 - this.frameBack = new FrameLayout(); - frameBack.X = Application.GetRealWidth(662 - (RowWidth - 395)); - frameBack.Y = Application.GetRealHeight(161); - frameBack.Width = Application.GetRealWidth(RowWidth); - frameBack.Height = Application.GetRealHeight(RowHeight * rowCount + 16); - frameBack.BackgroundImagePath = "MenuGroud/TopRightMenu" + i_widthType + "_" + rowCount + ".png"; - this.AddChidren(frameBack); - - var frameTable = new FrameLayout(); - frameTable.Y = Application.GetRealHeight(16); - frameTable.Height = Application.GetRealHeight(RowHeight * rowCount); - frameBack.AddChidren(frameTable); - - if (titleText != null) - { - var btnTitle = new NormalViewControl(frameBack.Width - Application.GetRealWidth(81), Application.GetRealHeight(58), false); - btnTitle.X = Application.GetRealWidth(81); - btnTitle.Y = Application.GetRealHeight(58 + 16); - btnTitle.Text = titleText; - frameTable.AddChidren(btnTitle); - } - - //鍒楄〃鎺т欢 - this.listView = new VerticalListControl(); - listView.Radius = (uint)Application.GetRealHeight(17); - if (titleText != null) - { - //鎷ユ湁鏍囬 - listView.Y = Application.GetRealHeight(RowHeight); - listView.Height = frameTable.Height - Application.GetRealHeight(RowHeight); - } - else - { - //娌℃湁鏍囬 - listView.Height = frameTable.Height; - } - frameTable.AddChidren(listView); - } - - #endregion - - #region 鈻� 娣诲姞鑿滃崟___________________________ - - /// <summary> - /// 娣诲姞鑿滃崟琛� - /// </summary> - /// <param name="floorId">妤煎眰id</param> - /// <param name="action">鍗曞嚮鑿滃崟鎵ц鐨勪簨浠�</param> - /// <param name="closeOnClick">鍗曞嚮鐨勬椂鍊欙紝鍏抽棴鑿滃崟</param> - public void AddRowMenu(string floorId, 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(); - //鍥炬爣 - var btnIcon = rowFrame.AddLeftIcon(81); - btnIcon.UnSelectedImagePath = "Floor/Floor.png"; - btnIcon.SelectedImagePath = "Floor/FloorSelected.png"; - //鏄剧ず鏂囧瓧 - string TextValue = HdlResidenceLogic.Current.GetFloorNameById(floorId); - var btnText = rowFrame.AddLeftCaption(TextValue, RowWidth - 173); - btnText.X = Application.GetRealWidth(173); - //搴曠嚎 - if (listView.ChildrenCount != this.RowCount) - { - var btnLine = rowFrame.AddBottomLine(); - btnLine.X = Application.GetRealWidth(81); - } - - if (floorId == Common.Config.Instance.Home.CurrentFloorId) - { - //褰撳墠妤煎眰榛樿璁剧疆涓洪�夋嫨鐘舵�� - this.SetRowSelectStatu(rowFrame, true); - this.oldRowFrame = rowFrame; - } - else - { - //鍏朵粬鑿滃崟涓虹伆鑹� - btnIcon.IsSelected = false; - btnText.TextColor = UserCenterColor.Current.TextGrayColor1; - } - - //閫夋嫨鐘舵�� - rowFrame.SelectStatuEvent += (statu) => - { - //false涓烘帶浠惰嚜韬嚜鍔ㄦ墽琛�,杩欓噷涓嶉渶瑕佽繕鍘� - if (statu == true) - { - //璁剧疆涓洪�夋嫨鐘舵�� - this.SetRowSelectStatu(rowFrame, true); - this.oldRowFrame = rowFrame; - } - }; - - //鎸夐敭鐐瑰嚮 - rowFrame.ButtonClickEvent += (sender, e) => - { - if (closeOnClick == true) - { - this.RemoveFromParent(); - } - action?.Invoke(); - }; - } - #endregion - - #region 鈻� 璁剧疆閫夋嫨鐘舵�乢______________________ - - /// <summary> - /// 璁剧疆閫夋嫨鐘舵�� - /// </summary> - /// <param name="frame">琛屾帶浠�</param> - /// <param name="select">閫夋嫨鐨勭姸鎬�</param> - private void SetRowSelectStatu(FrameRowControl frame, bool select) - { - //鍥炬爣 - var btnIcon = (IconViewControl)frame.GetChildren(0); - if (btnIcon != null) - { - btnIcon.IsSelected = select; - } - //鏂囨湰 - var btnText = (NormalViewControl)frame.GetChildren(1); - if (btnText != null) - { - btnText.TextColor = select == true ? UserCenterColor.Current.TextColor1 : UserCenterColor.Current.TextGrayColor1; - 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 - } +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 鍋氭垚涓�涓瓨鍦ㄤ簬鍙充笂瑙掔殑妤煎眰鑿滃崟鎺т欢 + /// </summary> + public class TopRightFloorMenuControl : FrameLayout + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 鍒楄〃鎺т欢 + /// </summary> + private VerticalListControl listView = null; + /// <summary> + /// 鍓嶅洖閫夋嫨鐨勮 + /// </summary> + private FrameRowControl oldRowFrame = null; + /// <summary> + /// 鑳屾櫙瀹瑰櫒鎺т欢 + /// </summary> + private FrameLayout frameBack = null; + /// <summary> + /// 琛岄珮搴� + /// </summary> + private int RowHeight = 150; + /// <summary> + /// 琛屽搴� + /// </summary> + private int RowWidth = 395; + /// <summary> + /// 琛屾暟 + /// </summary> + private int RowCount = 0; + /// <summary> + /// 褰撳墠妤煎眰id + /// </summary> + private string nowFloorId = string.Empty; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍋氭垚涓�涓瓨鍦ㄤ簬鍙充笂瑙掔殑妤煎眰鑿滃崟鎺т欢 + /// </summary> + /// <param name="i_RowCount">涓�鍏辨湁鍑犺(涓嶅惈鏍囬)</param> + /// <param name="i_widthType">杩欎釜鑿滃崟鐨勫搴︽ā寮�,鐩墠鍙敮鎸� + /// <para>1: 395瀹藉害</para> + /// <para>2: 449瀹藉害</para> + /// </param> + /// <param name="i_floorId">褰撳墠閫夋嫨鐨勬ゼ灞侷D</param> + /// <param name="titleText">鏍囬鏂囨湰(濡傛灉涓嶄负绌�,鑿滃崟妯″紡鍙樻洿涓烘嫢鏈夋爣棰樼殑妯″紡)</param> + public TopRightFloorMenuControl(int i_RowCount, int i_widthType,string i_floorId, string titleText = null) + { + this.nowFloorId = i_floorId; + this.RowCount = i_RowCount; + if (i_widthType == 1) + { + this.RowWidth = 395; + } + else if (i_widthType == 2) + { + this.RowWidth = 449; + } + //鍒濆鍖栫敾闈㈢殑鎺т欢 + this.InitFormControl(titleText, i_widthType); + } + + /// <summary> + /// 鍒濆鍖栫敾闈㈢殑鎺т欢 + /// </summary> + private void InitFormControl(string titleText, int i_widthType) + { + this.BackgroundColor = UserCenterColor.Current.DialogBackColor; + this.MouseUpEventHandler += (sender2, e2) => + { + //鍏抽棴鑷韩 + this.RemoveFromParent(); + }; + var frame = (FrameLayout)UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1); + frame.AddChidren(this); + + //鏈�澶ф樉绀�5涓� + int rowCount = this.RowCount > 5 ? 5 : this.RowCount; + if (titleText != null) + { + //449瀹藉害鐨勬椂鍊欙紝鍗充娇鏄庣粏宸茬粡瓒呰繃浜�5涓紝浣嗘槸杩樻槸鍙互+1鐨�,鍥犱负杩欎釜妯″紡澶氫簡涓�寮犲浘鐗� + if (rowCount < 5 || i_widthType == 2) + { + //鑿滃崟+1 + rowCount++; + } + } + + //鑳屾櫙 + this.frameBack = new FrameLayout(); + frameBack.X = Application.GetRealWidth(662 - (RowWidth - 395)); + frameBack.Y = Application.GetRealHeight(161); + frameBack.Width = Application.GetRealWidth(RowWidth); + frameBack.Height = Application.GetRealHeight(RowHeight * rowCount + 16); + frameBack.BackgroundImagePath = "MenuGroud/TopRightMenu" + i_widthType + "_" + rowCount + ".png"; + this.AddChidren(frameBack); + + var frameTable = new FrameLayout(); + frameTable.Y = Application.GetRealHeight(16); + frameTable.Height = Application.GetRealHeight(RowHeight * rowCount); + frameBack.AddChidren(frameTable); + + if (titleText != null) + { + var btnTitle = new NormalViewControl(frameBack.Width - Application.GetRealWidth(81), Application.GetRealHeight(58), false); + btnTitle.X = Application.GetRealWidth(81); + btnTitle.Y = Application.GetRealHeight(58 + 16); + btnTitle.Text = titleText; + frameTable.AddChidren(btnTitle); + } + + //鍒楄〃鎺т欢 + this.listView = new VerticalListControl(); + listView.Radius = (uint)Application.GetRealHeight(17); + if (titleText != null) + { + //鎷ユ湁鏍囬 + listView.Y = Application.GetRealHeight(RowHeight); + listView.Height = frameTable.Height - Application.GetRealHeight(RowHeight); + } + else + { + //娌℃湁鏍囬 + listView.Height = frameTable.Height; + } + frameTable.AddChidren(listView); + } + + #endregion + + #region 鈻� 娣诲姞鑿滃崟___________________________ + + /// <summary> + /// 娣诲姞鑿滃崟琛� + /// </summary> + /// <param name="floorId">妤煎眰id</param> + /// <param name="action">鍗曞嚮鑿滃崟鎵ц鐨勪簨浠�</param> + /// <param name="closeOnClick">鍗曞嚮鐨勬椂鍊欙紝鍏抽棴鑿滃崟</param> + public void AddRowMenu(string floorId, 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(); + //鍥炬爣 + var btnIcon = rowFrame.AddLeftIcon(81); + btnIcon.UnSelectedImagePath = "Floor/Floor.png"; + btnIcon.SelectedImagePath = "Floor/FloorSelected.png"; + //鏄剧ず鏂囧瓧 + string TextValue = HdlResidenceLogic.Current.GetFloorNameById(floorId); + var btnText = rowFrame.AddLeftCaption(TextValue, RowWidth - 173); + btnText.X = Application.GetRealWidth(173); + //搴曠嚎 + if (listView.ChildrenCount != this.RowCount) + { + var btnLine = rowFrame.AddBottomLine(); + btnLine.X = Application.GetRealWidth(81); + } + + if (this.nowFloorId == floorId) + { + //褰撳墠妤煎眰榛樿璁剧疆涓洪�夋嫨鐘舵�� + this.SetRowSelectStatu(rowFrame, true); + this.oldRowFrame = rowFrame; + } + else + { + //鍏朵粬鑿滃崟涓虹伆鑹� + btnIcon.IsSelected = false; + btnText.TextColor = UserCenterColor.Current.TextGrayColor1; + } + + //閫夋嫨鐘舵�� + rowFrame.SelectStatuEvent += (statu) => + { + //false涓烘帶浠惰嚜韬嚜鍔ㄦ墽琛�,杩欓噷涓嶉渶瑕佽繕鍘� + if (statu == true) + { + //璁剧疆涓洪�夋嫨鐘舵�� + this.SetRowSelectStatu(rowFrame, true); + this.oldRowFrame = rowFrame; + } + }; + + //鎸夐敭鐐瑰嚮 + rowFrame.ButtonClickEvent += (sender, e) => + { + if (closeOnClick == true) + { + this.RemoveFromParent(); + } + action?.Invoke(); + }; + } + #endregion + + #region 鈻� 璁剧疆閫夋嫨鐘舵�乢______________________ + + /// <summary> + /// 璁剧疆閫夋嫨鐘舵�� + /// </summary> + /// <param name="frame">琛屾帶浠�</param> + /// <param name="select">閫夋嫨鐨勭姸鎬�</param> + private void SetRowSelectStatu(FrameRowControl frame, bool select) + { + //鍥炬爣 + var btnIcon = (IconViewControl)frame.GetChildren(0); + if (btnIcon != null) + { + btnIcon.IsSelected = select; + } + //鏂囨湰 + var btnText = (NormalViewControl)frame.GetChildren(1); + if (btnText != null) + { + btnText.TextColor = select == true ? UserCenterColor.Current.TextColor1 : UserCenterColor.Current.TextGrayColor1; + 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 + } } \ No newline at end of file -- Gitblit v1.8.0