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/MainPage/Controls/DeviceSelectUnallocatedControl.cs | 176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 176 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceSelectUnallocatedControl.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceSelectUnallocatedControl.cs new file mode 100755 index 0000000..b513392 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceSelectUnallocatedControl.cs @@ -0,0 +1,176 @@ +锘縰sing Shared.Phone.UserCenter; +using System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.MainPage.Controls +{ + /// <summary> + /// 鏈垎閰嶇晫闈㈢殑璁惧閫夋嫨鎺т欢 + /// </summary> + public class DeviceSelectUnallocatedControl : FrameRowControl + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 璁惧瀵硅薄 + /// </summary> + public CommonDevice device; + /// <summary> + /// 鐘舵�� + /// </summary> + private StatuMode Statu = StatuMode.UN_SELECT; + /// <summary> + /// 鏄惁澶勪簬閫夋嫨鐘舵�� + /// </summary> + public bool IsSelected + { + get { return Statu == StatuMode.SELECT; } + set + { + if (value == false) + { + this.SetUnselectStatu(); + } + else + { + this.SetSelectStatu(); + } + } + } + + /// <summary> + /// 璁惧鍥炬爣鑳屾櫙鎺т欢 + /// </summary> + private FrameLayout frameIconBackGroud = null; + /// <summary> + /// 璁惧鍥炬爣鎺т欢 + /// </summary> + private IconViewControl btnDeviceIcon = null; + /// <summary> + /// 璁惧鍚嶅瓧鎺т欢 + /// </summary> + private NormalViewControl btnDeviceName = null; + /// <summary> + /// 閫夋嫨鎺т欢 + /// </summary> + private MostRightIconControl btnSelect = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鏈垎閰嶇晫闈㈢殑璁惧閫夋嫨鎺т欢 + /// </summary> + /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param> + public DeviceSelectUnallocatedControl(int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) + { + this.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + /// <param name="i_device">璁惧瀵硅薄</param> + public void InitControl(CommonDevice i_device) + { + this.device = i_device; + //璁惧鍥炬爣鑳屾櫙鎺т欢 + this.frameIconBackGroud = new FrameLayout(); + frameIconBackGroud.Height = this.GetPictrueRealSize(112); + frameIconBackGroud.Width = this.GetPictrueRealSize(112); + frameIconBackGroud.Gravity = Gravity.CenterVertical; + frameIconBackGroud.X = Application.GetRealWidth(46); + frameIconBackGroud.Radius = (uint)this.GetPictrueRealSize(112 / 2); + frameIconBackGroud.BackgroundColor = Common.ZigbeeColor.Current.GXCGrayBackgroundColor; + this.AddChidren(frameIconBackGroud, ChidrenBindMode.NotBind); + if (chidrenYaxis != 0) + { + frameIconBackGroud.Y += chidrenYaxis; + } + + //璁惧鍥炬爣鎺т欢 + this.btnDeviceIcon = new IconViewControl(78); + btnDeviceIcon.Gravity = Gravity.Center; + Common.LocalDevice.Current.SetDeviceIconToControl(btnDeviceIcon, i_device); + frameIconBackGroud.AddChidren(btnDeviceIcon); + //閲嶆柊缁戝畾浜嬩欢 + this.ChangedChidrenBindMode(frameIconBackGroud, ChidrenBindMode.BindEvent); + + //璁惧鍚嶅瓧 + this.btnDeviceName = new NormalViewControl(Application.GetRealWidth(600), this.Height, false); + btnDeviceName.X = Application.GetRealWidth(181); + btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device); + btnDeviceName.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor; + btnDeviceName.Gravity = Gravity.CenterVertical; + this.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent); + if (chidrenYaxis != 0) + { + btnDeviceName.Y += chidrenYaxis; + } + + //閫夋嫨鎺т欢 + this.btnSelect = new MostRightIconControl(70, 70); + btnSelect.X = Application.GetRealWidth(895); + btnSelect.UseClickStatu = false; + btnSelect.UnSelectedImagePath = "Room/ItemUnSelected_Black.png"; + btnSelect.SelectedImagePath = "Room/ItemSelected.png"; + this.AddChidren(btnSelect, ChidrenBindMode.NotBind); + btnSelect.InitControl(); + //澶嶅悎鎺т欢闇�瑕佺壒娈婂鐞� + this.ChangedChidrenBindMode(btnSelect, ChidrenBindMode.BindEvent); + if (chidrenYaxis != 0) + { + btnSelect.btnIcon.Y += chidrenYaxis; + } + + //搴曠嚎 + var btnBottomLine = new NormalViewControl(Application.GetRealWidth(835), ControlCommonResourse.BottomLineHeight, false); + btnBottomLine.X = Application.GetRealWidth(181); + btnBottomLine.Y = this.Height - ControlCommonResourse.BottomLineHeight; + btnBottomLine.BackgroundColor = UserCenterColor.Current.ButtomLine; + this.AddChidren(btnBottomLine, ChidrenBindMode.NotBind); + } + + #endregion + + #region 鈻� 閫夋嫨鐘舵�乢__________________________ + + /// <summary> + /// 璁惧畾閫夋嫨鐘舵�� + /// </summary> + private void SetSelectStatu() + { + if (Statu == StatuMode.SELECT) + { + return; + } + btnDeviceIcon.IsSelected = true; + btnDeviceName.IsSelected = true; + frameIconBackGroud.BackgroundColor = Common.ZigbeeColor.Current.GXCSelectedBackgroundColor; + btnSelect.IsSelected = true; + //鐘舵�佸彉鏇� + Statu = StatuMode.SELECT; + } + + /// <summary> + /// 璁剧疆闈為�夋嫨鐘舵�� + /// </summary> + private void SetUnselectStatu() + { + if (Statu == StatuMode.UN_SELECT) + { + return; + } + btnDeviceIcon.IsSelected = false; + btnDeviceName.IsSelected = false; + frameIconBackGroud.BackgroundColor = Common.ZigbeeColor.Current.GXCGrayBackgroundColor; + btnSelect.IsSelected = false; + //鐘舵�佸彉鏇� + Statu = StatuMode.UN_SELECT; + } + #endregion + } +} -- Gitblit v1.8.0