From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期二, 21 七月 2020 09:46:53 +0800 Subject: [PATCH] 请合并最新多功能面板代码 --- ZigbeeApp/Shared/Phone/Device/CommonForm/LeftIconButtonRow.cs | 180 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 180 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/LeftIconButtonRow.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/LeftIconButtonRow.cs new file mode 100755 index 0000000..8dc6a90 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/LeftIconButtonRow.cs @@ -0,0 +1,180 @@ +锘縰sing System; +using Shared.Common; +namespace Shared.Phone.Device.CommonForm +{ + public class LeftIconButtonRow: FrameLayout + { + #region 鈼� 鍙橀噺__________________________ + /// <summary> + /// 鍥剧墖 + /// </summary> + public Button IconButton; + /// <summary> + /// 鏍囬 + /// </summary> + public Button TitleButton; + /// <summary> + /// 涓嬪垝绾� + /// </summary> + public FrameLayout Line; + /// <summary> + /// 鐐瑰嚮浜嬩欢 + /// </summary> + public Action<LeftIconButtonRow, MouseEventArgs> ButtonClickEvent; + /// <summary> + /// ClickBtn + /// </summary> + public Button ClickBtn; + /// <summary> + /// v_Selected + /// </summary> + private bool v_Selected; + + public bool IsSelected + { + set + { + v_Selected = value; + try + { + SetStatu(v_Selected); + } + catch { }; + } + get + { + return v_Selected; + } + } + + #endregion + + public LeftIconButtonRow(int width = 449, int height = 150, int x = 0, int y = 0) + { + X = x; + Y = y; + Width = Application.GetRealWidth(width); + Height = Application.GetRealHeight(height); + } + + #region 鈼� 鍒濆鍖朹_________________________ + + /// <summary> + /// Init + /// </summary> + /// <param name="iconPath">Icon path.</param> + /// <param name="iconSelectedPath">Icon selected path.</param> + /// <param name="title">Title.</param> + public void Init(string iconPath, string iconSelectedPath, string title, bool hadLine = true) + { + IconButton = new Button() + { + X = Application.GetRealWidth(80), + Height = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(80), + Width = UserCenter.HdlControlLogic.Current.GetPictrueRealSize(80), + UnSelectedImagePath = iconPath, + SelectedImagePath = iconSelectedPath, + Gravity = Gravity.CenterVertical, + Tag = this.Tag + }; + AddChidren(IconButton); + + TitleButton = new Button() + { + X = Application.GetRealWidth(173), + Height = Application.GetRealHeight(80), + Width = Application.GetRealWidth(220), + TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor, + SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor, + Text = title, + TextAlignment = TextAlignment.CenterLeft, + Gravity = Gravity.CenterVertical, + Tag = this.Tag, + TextSize=14 + }; + AddChidren(TitleButton); + + Line = new FrameLayout() + { + X = Application.GetRealWidth(80), + Y = this.Height - 1, + Width = Application.GetRealWidth(369), + Height = 1, + BackgroundColor = Common.ZigbeeColor.Current.GXCGrayLineColor2 + }; + if (hadLine) + { + AddChidren(Line); + } + + IconButton.MouseUpEventHandler += Button_MouseUpEventHandler; + TitleButton.MouseUpEventHandler += Button_MouseUpEventHandler; + } + #endregion + + #region 鈼� 閫変腑鐘舵�乢_________________________ + + /// <summary> + /// 璁剧疆鐘舵�� + /// </summary> + /// <param name="statu"></param> + private void SetStatu(bool statu) + { + IconButton.IsSelected = statu; + TitleButton.IsSelected = statu; + TitleButton.IsBold = statu; + } + /// <summary> + /// 閫変腑 + /// </summary> + public void SetSelectedStatu() + { + SetStatu(true); + } + /// <summary> + /// 涓嶉�変腑 + /// </summary> + public void SetUnSelectedStatu() + { + SetStatu(false); + } + /// <summary> + /// HidenLine + /// </summary> + /// <param name="statu"></param> + public void HidenLine(bool statu) + { + Line.Visible = !statu; + } + /// <summary> + /// 璁剧疆鏍囬棰滆壊 + /// </summary> + /// <param name="color"></param> + /// <param name="selectedColor"></param> + public void SetTitleColor(uint color,uint selectedColor) + { + TitleButton.TextColor = color; + TitleButton.SelectedTextColor = selectedColor; + } + #endregion + + #region 鈼� 鐐瑰嚮浜嬩欢_________________________ + + /// <summary> + /// 鐐瑰嚮浜嬩欢 + /// </summary> + /// <param name="sender"></param> + /// <param name="e"></param> + private void Button_MouseUpEventHandler(object sender, MouseEventArgs e) + { + try + { + this.ButtonClickEvent?.Invoke(this, e); + } + catch (Exception ex) + { + } + } + #endregion + } +} -- Gitblit v1.8.0