From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 14 十二月 2020 09:59:01 +0800 Subject: [PATCH] 请合并代码,完成晾衣架最终功能。 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceSimpleSelectControl.cs | 134 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 134 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceSimpleSelectControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceSimpleSelectControl.cs new file mode 100755 index 0000000..4c36649 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceSimpleSelectControl.cs @@ -0,0 +1,134 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 鍋氭垚涓�涓畝鍗曡澶囬�夋嫨鐨勮鎺т欢 + /// </summary> + public class DeviceSimpleSelectControl : FrameRowControl + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 璁惧瀵硅薄 + /// </summary> + public CommonDevice device + { + get { return Common.LocalDevice.Current.GetDevice(MainKeys); } + } + /// <summary> + /// 閫夋嫨鎺т欢 + /// </summary> + private MostRightIconControl btnSelect = null; + + /// <summary> + /// 閫夋嫨鐨勭姸鎬佹槸鍚﹁兘澶熷彇娑� + /// </summary> + public bool SelectCancel = true; + /// <summary> + /// 鐘舵�� + /// </summary> + private StatuMode Statu = StatuMode.UN_SELECT; + /// <summary> + /// 鏄惁澶勪簬閫夋嫨鐘舵�� + /// </summary> + public bool IsSelected + { + get { return Statu == StatuMode.SELECT; } + set + { + if (value == false) + { + if (SelectCancel == true) + { + this.SetUnselectStatu(); + } + } + else + { + this.SetSelectStatu(); + } + } + } + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鍋氭垚涓�涓畝鍗曡澶囬�夋嫨鐨勮鎺т欢 + /// </summary> + /// <param name="i_device">璁惧瀵硅薄</param> + /// <param name="autoSelect">褰撶偣鍑绘鎺т欢鏃�,鏄惁鑷姩璁剧疆閫夋嫨鐘舵��</param> + /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param> + public DeviceSimpleSelectControl(CommonDevice i_device, bool autoSelect, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis) + { + this.MainKeys = Common.LocalDevice.Current.GetDeviceMainKeys(i_device); + if (autoSelect == true) + { + this.ButtonClickEvent += (sender, e) => + { + this.IsSelected = Statu == StatuMode.SELECT ? false : true; + }; + } + } + + /// <summary> + /// 鍒濆鍖栧唴閮ㄦ帶浠� + /// </summary> + public void InitControl() + { + //鍥炬爣 + var btnIcon = this.AddLeftIcon(); + Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, device); + + //璁惧 + string eName = Common.LocalDevice.Current.GetDeviceEpointName(device); + this.AddLeftCaption(eName, 850); + + btnSelect = this.AddMostRightEmptyIcon(58, 58); + btnSelect.Visible = false; + btnSelect.UnSelectedImagePath = "Item/ItemSelected.png"; + } + + #endregion + + #region 鈻� 閫夋嫨鐘舵�乢__________________________ + + /// <summary> + /// 璁惧畾閫夋嫨鐘舵�� + /// </summary> + private void SetSelectStatu() + { + if (Statu == StatuMode.SELECT) + { + return; + } + btnSelect.Visible = true; + //鐘舵�佸彉鏇� + Statu = StatuMode.SELECT; + } + + /// <summary> + /// 璁剧疆闈為�夋嫨鐘舵�� + /// </summary> + private void SetUnselectStatu() + { + if (Statu == StatuMode.UN_SELECT) + { + return; + } + btnSelect.Visible = false; + //鐘舵�佸彉鏇� + Statu = StatuMode.UN_SELECT; + } + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + #endregion + } +} -- Gitblit v1.8.0