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/Form/BottomItemSelectForm.cs | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 216 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 100644 index 0000000..038c173 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/BottomItemSelectForm.cs @@ -0,0 +1,216 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 搴曢儴寮圭獥椤圭洰閫夋嫨鐣岄潰 + /// </summary> + public class BottomItemSelectForm : DialogCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// <para>瀹屾垚閫夋嫨鐨勪簨浠�(鍙傛暟涓洪�夋嫨鐨勬槸鍒楄〃鐨勭鍑犺,浠�0寮�濮�)</para> + /// <para>褰揅ancelCallEvent=true鏃�,鐐瑰嚮纭鎸夐挳鏃�,鍙傛暟涓�:-1</para> + /// </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">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅</param> + /// <param name="i_listBottomText">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅(搴曢儴),濡傛灉鍙槸鍗曡鏄剧ず,鍒欐鍊艰缃负null(濡傛灉涓嶄负null,浣嗘槸绱㈠紩鎵�鎸囧悜鐨勫�间负null,鍒欒琛屽己鍒跺崟琛屾樉绀�)</param> + /// <param name="i_selectNo">璁剧疆鍝釜鏂囨湰涓洪粯璁ら�夋嫨(涓嶈缃~-1)</param> + public void ShowForm(string i_topText, List<string> i_listText, List<string> i_listBottomText, int i_selectNo) + { + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(i_topText, i_listText, i_listBottomText, i_selectNo); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + /// <param name="i_topText">澶撮儴鏍囬</param> + /// <param name="i_listText">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅</param> + /// <param name="i_listBottomtext">闇�瑕佹樉绀虹殑鍒楄〃淇℃伅(搴曢儴)</param> + /// <param name="i_selectNo">榛樿閫夋嫨</param> + private void InitMiddleFrame(string i_topText, List<string> i_listText, List<string> i_listBottomtext, int i_selectNo) + { + //涓嶈兘澶熸粦鍔ㄧ殑涓滆タ + FrameListControl listDetailView1 = null; + //鑳藉婊戝姩鐨勪笢瑗� + VerticalListControl listDetailView2 = null; + + //鈽呪槄浠庝笅寰�涓婃坊鍔犳帶浠垛槄鈽� + + //鏄庣粏楂樺害(鍒濆鏈�澶氬彧鏄剧ず9琛�) + int detailHeight = ControlCommonResourse.ListViewRowHeight + Application.GetRealHeight(12); + if (i_listText.Count > 9) + { + //63:涓婇儴闂磋窛 58:涓嬮儴闂磋窛 + detailHeight = detailHeight * 9 + Application.GetRealHeight(63 + 58); + listDetailView2 = new VerticalListControl(12); + listDetailView2.Height = detailHeight; + listDetailView2.Gravity = Gravity.BottomCenter; + listDetailView2.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(listDetailView2); + } + else + { + //63:涓婇儴闂磋窛 58:涓嬮儴闂磋窛 + detailHeight = detailHeight * i_listText.Count + Application.GetRealHeight(63 + 58); + listDetailView1 = new FrameListControl(12); + listDetailView1.Height = detailHeight; + listDetailView1.Gravity = Gravity.BottomCenter; + listDetailView1.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(listDetailView1); + } + //绾� + int lineYY = listDetailView1 != null ? listDetailView1.Y : listDetailView2.Y; + var btnLine = new NormalViewControl(bodyFrameLayout.Width, ControlCommonResourse.BottomLineHeight, false); + btnLine.Y = lineYY - ControlCommonResourse.BottomLineHeight; + btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + bodyFrameLayout.AddChidren(btnLine); + + //澶撮儴鐧借壊鑳屾櫙 + var topBackFame = new FrameLayout(); + topBackFame.Y = btnLine.Y - Application.GetRealHeight(138); + topBackFame.BackgroundColor = UserCenterColor.Current.White; + topBackFame.Height = Application.GetRealHeight(138); + topBackFame.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); + bodyFrameLayout.AddChidren(topBackFame); + + //澶撮儴淇℃伅 + var btnTitle = new NormalViewControl(topBackFame.Width, Application.GetRealHeight(65), false); + btnTitle.Y = Application.GetRealHeight(34); + btnTitle.Text = i_topText; + btnTitle.TextColor = UserCenterColor.Current.TextColor4; + btnTitle.TextSize = 16; + btnTitle.TextAlignment = TextAlignment.Center; + topBackFame.AddChidren(btnTitle); + + //鍙栨秷 + var btnCancel = new NormalViewControl(Application.GetRealWidth(200), topBackFame.Height, false); + btnCancel.X = Application.GetRealWidth(81); + btnCancel.TextColor = UserCenterColor.Current.TextGrayColor1; + btnCancel.TextID = R.MyInternationalizationString.uCancel; + topBackFame.AddChidren(btnCancel); + btnCancel.ButtonClickEvent += (sender, e) => + { + this.CloseForm(); + }; + + //瀹屾垚 + var btnFinish = new NormalViewControl(Application.GetRealWidth(200), topBackFame.Height, false); + btnFinish.X = topBackFame.Width - btnCancel.X - Application.GetRealWidth(200); + btnFinish.TextAlignment = TextAlignment.CenterRight; + btnFinish.TextColor = 0xfffb744a; + btnFinish.TextID = R.MyInternationalizationString.uFinish; + topBackFame.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 frameSpace = new FrameLayout(); + frameSpace.Height = Application.GetRealHeight(63); + listDetailView1?.AddChidren(frameSpace); + listDetailView2?.AddChidren(frameSpace); + + //鏄庣粏鍒楄〃鎺т欢 + int rowSpace = listDetailView1 != null ? listDetailView1.rowSpace : listDetailView2.rowSpace; + for (int i = 0; i < i_listText.Count; i++) + { + NormalSelectControl btnRow = null; + if (i_listBottomtext == null || i_listBottomtext[i] == null) + { + //鍙樉绀轰竴琛� + btnRow = new NormalSelectControl(i_listText[i], rowSpace / 2); + } + else + { + //鏄剧ず涓婁笅涓よ + btnRow = new NormalSelectControl(i_listText[i], i_listBottomtext[i], rowSpace / 2); + } + btnRow.LeftOffset = Application.GetRealWidth(81) - ControlCommonResourse.XXLeft;//鍚戝彸鍋忕Щ + btnRow.RightOffset = ControlCommonResourse.XXLeft - Application.GetRealWidth(81);//鍚戝乏鍋忕Щ + listDetailView1?.AddChidren(btnRow); + listDetailView2?.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(); + } + } + + //濡傛灉鏄粦鍔ㄦ帶浠�,鍒欐坊鍔犲簳閮ㄩ棿璺� + if (listDetailView2 != null) + { + var frameSpace2 = new FrameLayout(); + frameSpace2.Height = Application.GetRealHeight(58); + listDetailView2?.AddChidren(frameSpace2); + } + } + + #endregion + } +} -- Gitblit v1.8.0