From 6bca8fcd37a48808a0b9c9342fc1be0adddfece6 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期五, 08 五月 2020 17:46:44 +0800 Subject: [PATCH] 请合并最新代码,优化绑定信息 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs | 185 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 185 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs new file mode 100755 index 0000000..fbc6aeb --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs @@ -0,0 +1,185 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 搴曢儴寮圭獥椤圭洰閫夋嫨鐣岄潰(鍒楄〃鏁板敖鍙兘鍒紕閭d箞澶�) + /// </summary> + public class BottomItemSelectForm : DialogCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 瀹屾垚閫夋嫨鐨勪簨浠�(鍙傛暟涓洪�夋嫨鐨勬槸鍒楄〃鐨勭鍑犺,浠�0寮�濮�) + /// </summary> + public Action<int> FinishSelectEvent = null; + /// <summary> + /// 鍓嶅洖閫夋嫨鐨勬帶浠� + /// </summary> + private NormalSelectControl oldSelectContr = null; + /// <summary> + /// 閫夋嫨鍙栨秷(涓嶆槸宸︿笂瑙�),骞朵笖鎸変笅纭畾閿椂,鏄惁璋冪敤鍥炶皟鍑芥暟(璋冪敤鏃朵紶閫掔殑鍙傛暟鏄� -1,榛樿涓嶅洖璋�) + /// </summary> + public bool CancelCallEvent = false; + /// <summary> + /// 閫夋嫨鐨勮鑳藉惁鍙栨秷 + /// </summary> + public bool SelectRowCanCancel = true; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_topText">澶撮儴鏍囬</param> + /// <param name="i_listText">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅(鍒楄〃鏁板敖鍙兘鍒紕閭d箞澶�)</param> + /// <param name="i_selectNo">璁剧疆鍝釜鏂囨湰涓洪粯璁ら�夋嫨(涓嶈缃~-1)</param> + public void ShowForm(string i_topText, List<string> i_listText, int i_selectNo) + { + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(i_topText, i_listText, i_selectNo); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + /// <param name="i_topText">澶撮儴鏍囬</param> + /// <param name="i_listText">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅</param> + /// <param name="i_selectNo">榛樿閫夋嫨</param> + private void InitMiddleFrame(string i_topText, List<string> i_listText, int i_selectNo) + { + //寮у害鐨勫渾鐨勪竴鍗婄殑楂樺害(鍥哄畾) + int halfRoundHeigth = Application.GetRealHeight(116) / 2; + //澶撮儴楂樺害 + int topHeight = Application.GetRealHeight(195); + //搴曢儴楂樺害 + int bottomHeight = Application.GetRealHeight(57); + //鏄庣粏楂樺害 + int detailHeight = (ControlCommonResourse.ListViewRowHeight + Application.GetRealHeight(12)) * i_listText.Count; + + //鎼炰竴涓�忔槑鐨勬 + var frameTransparent = new FrameLayout(); + frameTransparent.Y = bodyFrameLayout.Height - topHeight - bottomHeight - detailHeight; + frameTransparent.Height = topHeight + bottomHeight + detailHeight + halfRoundHeigth * 2;//楂樺害灏辨槸瑕佸畠瓒呰繃锛岄殢渚挎悶鐨� + frameTransparent.BackgroundColor = UserCenterColor.Current.Transparent; + bodyFrameLayout.AddChidren(frameTransparent); + + //鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙(瀹冧笌瀹為檯楂樺害灏忎簡鍗婁釜寮у害鐨勫渾) + var detailBackFrame = new FrameLayout(); + detailBackFrame.Y = halfRoundHeigth; + detailBackFrame.Height = frameTransparent.Height; + detailBackFrame.BackgroundColor = UserCenterColor.Current.White; + frameTransparent.AddChidren(detailBackFrame); + + //寮у害鐨勫渾 + var rowRound = new FrameLayout(); + rowRound.Width = bodyFrameLayout.Width; + rowRound.Height = halfRoundHeigth * 2; + rowRound.BackgroundColor = UserCenterColor.Current.White; + rowRound.Radius = (uint)halfRoundHeigth; + frameTransparent.AddChidren(rowRound); + + //澶撮儴淇℃伅 + var btnTitle = new NormalViewControl(detailBackFrame.Width, Application.GetRealHeight(63), false); + btnTitle.Y = Application.GetRealHeight(35); + btnTitle.Text = i_topText; + btnTitle.TextColor = UserCenterColor.Current.TextColor4; + btnTitle.TextSize = 16; + btnTitle.TextAlignment = TextAlignment.Center; + rowRound.AddChidren(btnTitle); + + //鍙栨秷 + var btnCancel = new NormalViewControl(200, 58, true); + btnCancel.X = Application.GetRealWidth(81); + btnCancel.Y = Application.GetRealHeight(40); + btnCancel.TextColor = UserCenterColor.Current.TextGrayColor1; + btnCancel.TextID = R.MyInternationalizationString.uCancel; + rowRound.AddChidren(btnCancel); + btnCancel.ButtonClickEvent += (sender, e) => + { + this.CloseForm(); + }; + + //瀹屾垚 + var btnFinish = new NormalViewControl(200, 58, true); + btnFinish.X = Application.GetRealWidth(800); + btnFinish.Y = Application.GetRealHeight(40); + btnFinish.TextAlignment = TextAlignment.CenterRight; + btnFinish.TextColor = 0xfffb744a; + btnFinish.TextID = R.MyInternationalizationString.uFinish; + rowRound.AddChidren(btnFinish); + btnFinish.ButtonClickEvent += (sender, e) => + { + if (FinishSelectEvent != null && oldSelectContr != null) + { + //鍥炶皟鍑芥暟 + FinishSelectEvent.Invoke(Convert.ToInt32(oldSelectContr.MainKeys)); + } + else if (FinishSelectEvent != null && this.CancelCallEvent == true) + { + //鍥炶皟鍑芥暟 + FinishSelectEvent.Invoke(-1); + } + this.CloseForm(); + }; + + //绾� + var btnLine = new NormalViewControl(detailBackFrame.Width, ControlCommonResourse.BottomLineHeight, false); + btnLine.Y = Application.GetRealHeight(138) - ControlCommonResourse.BottomLineHeight - halfRoundHeigth; + btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + detailBackFrame.AddChidren(btnLine); + + //鍒楄〃鎺т欢 + var listView = new FrameListControl(12); + listView.Height = detailHeight + bottomHeight; + listView.Y = topHeight - halfRoundHeigth; + detailBackFrame.AddChidren(listView); + for (int i = 0; i < i_listText.Count; i++) + { + var btnRow = new NormalSelectControl(i_listText[i], listView.rowSpace / 2); + btnRow.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft;//鍚戝彸鍋忕Щ + btnRow.RightOffset = ControlCommonResourse.XXLeft - Application.GetRealWidth(81);//鍚戝乏鍋忕Щ + listView.AddChidren(btnRow); + btnRow.InitControl(); + btnRow.MainKeys = i.ToString(); + btnRow.ButtonClickEvent += (sender, e) => + { + //鍙栨秷閫夋嫨 + if (btnRow.IsSelected == true) + { + //鍏佽鍙栨秷鐨勬椂鍊�,鎵嶈兘鍙栨秷 + if (this.SelectRowCanCancel == true) + { + btnRow.IsSelected = false; + oldSelectContr = null; + } + return; + } + if (oldSelectContr != null) + { + oldSelectContr.IsSelected = false; + } + btnRow.IsSelected = true; + oldSelectContr = btnRow; + }; + //榛樿閫夋嫨 + if (i == i_selectNo) + { + btnRow.IsSelected = true; + oldSelectContr = btnRow; + } + if (i != i_listText.Count - 1) + { + //搴曠嚎 + btnRow.AddBottomLine(); + } + } + } + + #endregion + } +} -- Gitblit v1.8.0