From d978b68da978982b35dd7d7da27217925cf8d788 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 29 四月 2020 09:34:28 +0800 Subject: [PATCH] 完整版的虚拟设备功能 --- ZigbeeApp/Shared/Common/CommonPage.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs | 134 ---------- ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs | 7 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs | 2 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs | 151 ----------- ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs | 138 +---------- ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs | 134 ---------- ZigbeeApp/Shared/R.cs | 5 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs | 128 ++++++---- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 10 10 files changed, 138 insertions(+), 573 deletions(-) diff --git a/ZigbeeApp/Shared/Common/CommonPage.cs b/ZigbeeApp/Shared/Common/CommonPage.cs index febcb6a..ef10edc 100755 --- a/ZigbeeApp/Shared/Common/CommonPage.cs +++ b/ZigbeeApp/Shared/Common/CommonPage.cs @@ -57,7 +57,7 @@ /// <summary> /// 鐗堟湰鍙� /// </summary> - public static string CodeIDString = "1.0.20042701"; + public static string CodeIDString = "1.0.20042801"; /// <summary> /// 娉ㄥ唽鏉ユ簮(0:HDL On 1:Zigbee) /// </summary> diff --git a/ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs b/ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs index 3e38a1c..8bec1a6 100755 --- a/ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs +++ b/ZigbeeApp/Shared/Phone/MainPage/DeviceDetailInfoForm.cs @@ -272,105 +272,19 @@ /// </summary> private void AddFunctionTypeRowByAdmin(NormalViewControl btnBelongType) { - //濡傛灉鏄户鐢靛櫒,绌烘皵寮�鍏�,璋冨厜鍣ㄧ殑璇� - if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.DimmableLight - || device.Type == DeviceType.ColorDimmableLight || device.Type == DeviceType.AirSwitch) + //鑷畾涔夊姛鑳界被鍨嬫帶浠� + var rowFunction = new DeviceFunctionTypeRowControl(device, listview.rowSpace / 2); + if (rowFunction.CanShowRow == true) { - //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛� - int nowSelectNo = 1; - string strType = string.Empty; - if (this.device.DfunctionType == DeviceFunctionType.A鐏厜) - { - strType = Language.StringByID(R.MyInternationalizationString.uLight); - nowSelectNo = 1; - } - else if (this.device.DfunctionType == DeviceFunctionType.A寮�鍏�) - { - strType = Language.StringByID(R.MyInternationalizationString.uSwitch); - nowSelectNo = 0; - } - else if (this.device.DfunctionType == DeviceFunctionType.A鎻掑骇) - { - strType = Language.StringByID(R.MyInternationalizationString.uSocket1); - nowSelectNo = 2; - } - //鍔熻兘绫诲瀷 - var btnFunction = new FrameCaptionViewControl(Language.StringByID(R.MyInternationalizationString.uFunctionType), strType, listview.rowSpace / 2); - btnFunction.UseClickStatu = false; - listview.AddChidren(btnFunction); - btnFunction.InitControl(); + listview.AddChidren(rowFunction); + rowFunction.InitControl(); //搴曠嚎 - btnFunction.AddBottomLine(); - //濡傛灉鏄┖姘斿紑鍏冲拰缁х數鍣�,鎵嶈兘淇敼 - if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.AirSwitch) + rowFunction.AddBottomLine(); + rowFunction.FinishSelectEvent += (index) => { - //鍙崇澶� - btnFunction.AddRightArrow(); - btnFunction.ButtonClickEvent += (sender, e) => - { - //鏄剧ず鍒楄〃 - var listText = new List<string>(); - listText.Add(Language.StringByID(R.MyInternationalizationString.uSwitch));//寮�鍏� - listText.Add(Language.StringByID(R.MyInternationalizationString.uLight));//鐏厜 - listText.Add(Language.StringByID(R.MyInternationalizationString.uSocket1));//鎻掑骇 - //鏍囬:閫夋嫨鍔熻兘绫诲瀷 - var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType); - - var form = new BottomItemSelectForm(); - form.SelectRowCanCancel = false;//閫夋嫨鐨勪笉鑳藉彇娑� - form.AddForm(title, listText, nowSelectNo); - form.FinishSelectEvent += (selectNo) => - { - btnFunction.Text = listText[selectNo]; - //褰撶被鍨嬪彉鏇存椂,澶翠笂鐨勭被鍨嬩篃涓�璧峰彉鏇� - btnBelongType.Text = listText[selectNo]; - nowSelectNo = selectNo; - //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� - if (selectNo == 0) - { - this.device.DfunctionType = DeviceFunctionType.A寮�鍏�; - if (this.device.IsCustomizeImage == false) - { - //閲嶆柊璁剧疆鍥剧墖 - this.device.IconPath = "Device/Switch.png"; - } - } - else if (selectNo == 1) - { - this.device.DfunctionType = DeviceFunctionType.A鐏厜; - if (this.device.IsCustomizeImage == false) - { - //閲嶆柊璁剧疆鍥剧墖 - this.device.IconPath = "Device/Light.png"; - } - } - else - { - this.device.DfunctionType = DeviceFunctionType.A鎻掑骇; - if (this.device.IsCustomizeImage == false) - { - //閲嶆柊璁剧疆鍥剧墖 - this.device.IconPath = "Device/Socket1.png"; - } - } - this.device.ReSave(); - }; - }; - } - } - - //濡傛灉鏄柊椋� - if (device.Type == DeviceType.FreshAir) - { - //鍔熻兘绫诲瀷 - string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType); - string strType = Language.StringByID(R.MyInternationalizationString.FreshAir); - var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2); - btnFunction.UseClickStatu = false; - listview.AddChidren(btnFunction); - btnFunction.InitControl(); - //搴曠嚎 - btnFunction.AddBottomLine(); + //褰撶被鍨嬪彉鏇存椂,澶翠笂鐨勭被鍨嬩篃涓�璧峰彉鏇� + btnBelongType.Text = rowFunction.Text; + }; } } @@ -379,32 +293,16 @@ /// </summary> private void AddFunctionTypeRowByMember() { - //濡傛灉鏄户鐢靛櫒,绌烘皵寮�鍏�,璋冨厜鍣ㄧ殑璇� - if (device.Type == DeviceType.OnOffOutput || device.Type == DeviceType.DimmableLight - || device.Type == DeviceType.ColorDimmableLight || device.Type == DeviceType.AirSwitch) + //鑷畾涔夊姛鑳界被鍨嬫帶浠� + var rowFunction = new DeviceFunctionTypeRowControl(device, listview.rowSpace / 2); + if (rowFunction.CanShowRow == true) { - //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛� - string strType = string.Empty; - if (this.device.DfunctionType == DeviceFunctionType.A鐏厜) - { - strType = Language.StringByID(R.MyInternationalizationString.uLight); - } - else if (this.device.DfunctionType == DeviceFunctionType.A寮�鍏�) - { - strType = Language.StringByID(R.MyInternationalizationString.uSwitch); - } - else if (this.device.DfunctionType == DeviceFunctionType.A鎻掑骇) - { - strType = Language.StringByID(R.MyInternationalizationString.uSocket1); - } - - //鍔熻兘绫诲瀷 - var btnFunction = new FrameCaptionViewControl(Language.StringByID(R.MyInternationalizationString.uFunctionType), strType, listview.rowSpace / 2); - btnFunction.UseClickStatu = false; - listview.AddChidren(btnFunction); - btnFunction.InitControl(); + //寮哄埗骞叉秹涓嶈兘閫夋嫨 + rowFunction.SetCanSelect = false; + listview.AddChidren(rowFunction); + rowFunction.InitControl(); //搴曠嚎 - btnFunction.AddBottomLine(); + rowFunction.AddBottomLine(); } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs index d907473..5b46b5e 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/RowLayoutControls/DeviceFunctionTypeRowControl.cs @@ -13,11 +13,27 @@ #region 鈻� 鍙橀噺澹版槑___________________________ /// <summary> - /// 鍒ゆ柇璇ユ帶浠惰兘鍚︽樉绀�(鏈�濂界‘淇濊澶囧璞′笉涓簄ull) + /// 缁撴潫閫夋嫨鐨勪簨浠� value:绱㈠紩(浠�0寮�濮�) 鏂囨湰淇℃伅璇风敤Text鑾峰彇 + /// </summary> + public Action<int> FinishSelectEvent = null; + /// <summary> + /// 鍒ゆ柇璇ユ帶浠惰兘鍚︽樉绀� /// </summary> public bool CanShowRow { get { return this.CheckCanShowRow(); } + } + + private bool m_SetCanSelect = true; + /// <summary> + /// 寮哄埗璁剧疆鑳藉惁杩涜閫夋嫨(鍙缁х數鍣ㄥ拰绌烘皵寮�鍏虫湁鏁�,涓埆鐣岄潰闇�瑕佽繖绉嶆搷浣�) + /// </summary> + public bool SetCanSelect + { + set + { + m_SetCanSelect = value; + } } /// <summary> /// 璁惧瀵硅薄 @@ -33,7 +49,7 @@ #region 鈻� 鍒濆鍖朹____________________________ /// <summary> - /// 璁惧鍔熻兘绫诲瀷鐨勮嚜瀹氫箟琛屾帶浠�(姝ゆ柟娉曢�夋嫨涔嬪悗,鏃犳潯浠剁洿鎺ュ彉鏇寸被鍨�) + /// 璁惧鍔熻兘绫诲瀷鐨勮嚜瀹氫箟琛屾帶浠�(閫夋嫨鍔熻兘涔嬪悗,鏃犳潯浠剁洿鎺ュ彉鏇寸被鍨�) /// </summary> /// <param name="i_device">璁惧鐨勫璞�</param> /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param> @@ -53,25 +69,23 @@ //鍒濆鍖栧簳灞傛暟鎹� base.InitControl(); - if (this.device == null) - { - //姝ゆ帶浠堕噰鐢ㄧ殑鏄彟澶栦竴绉嶅垵濮嬪寲鏂瑰紡 - return; - } - //绌烘皵寮�鍏冲拰缁х數鍣ㄥ彲浠ラ�夋嫨鍔熻兘绫诲瀷 if (this.device.Type == DeviceType.AirSwitch || this.device.Type == DeviceType.OnOffOutput) { - this.UseClickStatu = true; - //鍙崇澶� - this.AddRightArrow(); - - this.ButtonClickEvent += (sender, e) => + //娌¤寮哄埗骞叉秹鐨勮瘽 + if (m_SetCanSelect == true) { - //鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷鐨勭晫闈� - this.ShowSelectDeviceFunctionListForm(); - }; + this.UseClickStatu = true; + //鍙崇澶� + this.AddRightArrow(); + + this.ButtonClickEvent += (sender, e) => + { + //鏄剧ず閫夋嫨璁惧鍔熻兘绫诲瀷鐨勭晫闈� + this.ShowSelectDeviceFunctionListForm(); + }; + } } } @@ -103,6 +117,9 @@ //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� this.RefreshDfunctionType(); + + //璋冪敤鍥炶皟鍑芥暟 + this.FinishSelectEvent?.Invoke(nowSelectNo); }; } #endregion @@ -117,12 +134,7 @@ //鏍囬锛氬姛鑳界被鍨� this.btnCaption.Text = Language.StringByID(R.MyInternationalizationString.uFunctionType); - var myFunType = DeviceFunctionType.A鏈畾涔�; - if (this.device != null) - { - myFunType = this.device.DfunctionType; - } - + var myFunType = this.device.DfunctionType; //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛� string strType = string.Empty; if (myFunType == DeviceFunctionType.A鐏厜) @@ -141,35 +153,38 @@ nowSelectNo = 2; } - //濡傛灉璁惧涓嶄负null - if (this.device != null) + if (this.device.Type == DeviceType.ColorDimmableLight + || this.device.Type == DeviceType.DimmableLight) { - if (this.device.Type == DeviceType.ColorDimmableLight - || this.device.Type == DeviceType.DimmableLight) - { - //鐏厜绫诲浐瀹氫负 鐏厜 - strType = Language.StringByID(R.MyInternationalizationString.uLight); - nowSelectNo = 1; - } - else if (this.device.Type == DeviceType.WindowCoveringDevice) - { - //绐楀笜鍥哄畾涓� 閬槼 - strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100); - nowSelectNo = -1; - } - else if (this.device.Type == DeviceType.Thermostat) - { - //绌鸿皟鍥哄畾涓� 绌鸿皟 - strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId3600); - nowSelectNo = -1; - } - else if (this.device.Type == DeviceType.DoorLock) - { - //闂ㄩ攣鍥哄畾涓� 闂ㄩ攣 - strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2800); - nowSelectNo = -1; - } + //鐏厜绫诲浐瀹氫负 鐏厜 + strType = Language.StringByID(R.MyInternationalizationString.uLight); + nowSelectNo = 1; } + else if (this.device.Type == DeviceType.WindowCoveringDevice) + { + //绐楀笜鍥哄畾涓� 閬槼 + strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100); + nowSelectNo = -1; + } + else if (this.device.Type == DeviceType.Thermostat) + { + //绌鸿皟鍥哄畾涓� 绌鸿皟 + strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId3600); + nowSelectNo = -1; + } + else if (this.device.Type == DeviceType.DoorLock) + { + //闂ㄩ攣鍥哄畾涓� 闂ㄩ攣 + strType = Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2800); + nowSelectNo = -1; + } + else if (this.device.Type == DeviceType.DoorLock) + { + //鏂伴鍥哄畾涓� 鏂伴 + strType = Language.StringByID(R.MyInternationalizationString.FreshAir); + nowSelectNo = -1; + } + //鏄剧ず鏂囨湰 this.txtView.Text = strType; } @@ -192,6 +207,7 @@ || this.device.Type == DeviceType.DoorLock//闂ㄩ攣 || this.device.Type == DeviceType.OnOffOutput//缁х數鍣� || this.device.Type == DeviceType.Thermostat//绌鸿皟 + || this.device.Type == DeviceType.FreshAir//鏂伴 || this.device.Type == DeviceType.WindowCoveringDevice)//绐楀笜 { return true; @@ -201,6 +217,20 @@ #endregion + #region 鈻� 鎺т欢鎽ф瘉___________________________ + + /// <summary> + /// 鎺т欢鎽ф瘉 + /// </summary> + public override void RemoveFromParent() + { + this.FinishSelectEvent = null; + + base.RemoveFromParent(); + } + + #endregion + #region 鈻� 涓�鑸柟娉昣__________________________ /// <summary> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs index 99c9608..56207a7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/HdlDeviceDoorLockLogic.cs @@ -38,7 +38,7 @@ /// 娣诲姞鍘嗗彶璁板綍 /// </summary> /// <param name="i_doorLock">闂ㄩ攣瀵硅薄</param> - /// <param name="OtherOpenLockMode">鍏朵粬寮�閿佹柟寮� 9001:甯稿紑鎵撳紑 9002:甯稿紑鍙栨秷 9003:甯稿紑鎸佺画</param> + /// <param name="OtherOpenLockMode">鍏朵粬寮�閿佹柟寮� 9001:甯稿紑鎵撳紑 9002:甯稿紑鍙栨秷 9003:甯稿紑鎸佺画 9004:甯稿紑鑷姩鍖栨墜鍔ㄥ彇娑�</param> /// <param name="NormallyOpenContinuedTime">甯稿紑鎸佺画鏃堕棿(1~72灏忔椂 OtherOpenLockMode=9003鐨勬椂鍊欐湁鏁�)</param> public void AddDoorHistoryLog(ZigBee.Device.DoorLock i_doorLock, int OtherOpenLockMode, string NormallyOpenContinuedTime) { diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs index bf36e95..6b79eb0 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceFunctionSettionForm.cs @@ -41,10 +41,6 @@ /// </summary> private Dictionary<int, string> dicDeviceSaveName = new Dictionary<int, string>(); /// <summary> - /// 璁惧闇�瑕佷繚瀛樼殑璁惧鍔熻兘 - /// </summary> - private Dictionary<int, DeviceFunctionType> dicDeviceFuncType = new Dictionary<int, DeviceFunctionType>(); - /// <summary> /// 淇℃伅缂栬緫鎺т欢 /// </summary> private InformationEditorControl tableContr = null; @@ -108,8 +104,6 @@ { //璁板綍璧峰綋鍓嶆鍦ㄦ搷浣滅殑鍥炶矾鍚嶅瓧 dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim(); - //寮�鍚繘搴︽潯 - this.ShowProgressBar(); foreach (var epoint in dicDeviceSaveName.Keys) { var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); @@ -126,45 +120,10 @@ var result = await Common.LocalDevice.Current.ReName(device, newName); if (result == false) { - //鍏抽棴 - this.CloseProgressBar(); return; } } } - foreach (var epoint in dicDeviceFuncType.Keys) - { - var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); - if (device == null) - { - continue; - } - //璁剧疆鍔熻兘绫诲瀷 - device.DfunctionType = dicDeviceFuncType[epoint]; - if (device.IsCustomizeImage == true) - { - continue; - } - //閲嶆柊璁剧疆鍥剧墖 - if (device.DfunctionType == DeviceFunctionType.A寮�鍏�) - { - device.IconPath = "Device/Switch.png"; - } - else if (device.DfunctionType == DeviceFunctionType.A鎻掑骇) - { - device.IconPath = "Device/Socket1.png"; - } - else if (device.DfunctionType == DeviceFunctionType.A鐏厜) - { - device.IconPath = "Device/Light.png"; - } - else - { - device.IconPath = "Device/RelayEpoint.png"; - } - device.ReSave(); - } - this.CloseProgressBar(); //鍏抽棴鑷韩 this.CloseForm(); }; @@ -295,110 +254,16 @@ /// </summary> private void AddFunctionTypeRow() { - //濡傛灉鏄户鐢靛櫒鍜岃皟鍏夊櫒鐨勮瘽 - if (nowSelectDevice.Type == DeviceType.OnOffOutput || nowSelectDevice.Type == DeviceType.DimmableLight - || nowSelectDevice.Type == DeviceType.ColorDimmableLight) + //鑷畾涔夊姛鑳界被鍨嬫帶浠� + var rowFunction = new DeviceFunctionTypeRowControl(nowSelectDevice, listview.rowSpace / 2); + if (rowFunction.CanShowRow == false) { - //鍔熻兘绫诲瀷 - string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType); - var DfunctionType = nowSelectDevice.DfunctionType; - if (this.dicDeviceFuncType.ContainsKey(nowSelectDevice.DeviceEpoint) == true) - { - DfunctionType = this.dicDeviceFuncType[nowSelectDevice.DeviceEpoint]; - } - - //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛� - int nowSelectNo = 1; - string strType = string.Empty; - if (DfunctionType == DeviceFunctionType.A鐏厜) - { - strType = Language.StringByID(R.MyInternationalizationString.uLight); - nowSelectNo = 1; - } - else if (DfunctionType == DeviceFunctionType.A寮�鍏�) - { - strType = Language.StringByID(R.MyInternationalizationString.uSwitch); - nowSelectNo = 0; - } - else if (DfunctionType == DeviceFunctionType.A鎻掑骇) - { - strType = Language.StringByID(R.MyInternationalizationString.uSocket1); - nowSelectNo = 2; - } - - var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2); - btnFunction.UseClickStatu = false; - listview.AddChidren(btnFunction); - btnFunction.InitControl(); - //搴曠嚎 - btnFunction.AddBottomLine(); - - //濡傛灉鏄户鐢靛櫒鎵嶈兘澶熸洿鏀硅繖涓姛鑳界被鍨� - if (nowSelectDevice.Type == DeviceType.OnOffOutput) - { - btnFunction.UseClickStatu = true; - //鍙崇澶� - btnFunction.AddRightArrow(); - btnFunction.ButtonClickEvent += (sender, e) => - { - //鏄剧ず鍒楄〃 - var listText = new List<string>(); - listText.Add(Language.StringByID(R.MyInternationalizationString.uSwitch));//寮�鍏� - listText.Add(Language.StringByID(R.MyInternationalizationString.uLight));//鐏厜 - listText.Add(Language.StringByID(R.MyInternationalizationString.uSocket1));//鎻掑骇 - //鏍囬:閫夋嫨鍔熻兘绫诲瀷 - var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType); - - var form = new BottomItemSelectForm(); - form.CancelCallEvent = true;//鍏佽鍙栨秷 - form.AddForm(title, listText, nowSelectNo); - form.FinishSelectEvent += (selectNo) => - { - if (selectNo == -1) - { - //鍙栨秷閫夋嫨 - btnFunction.Text = string.Empty; - } - else - { - btnFunction.Text = listText[selectNo]; - } - nowSelectNo = selectNo; - //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� - if (selectNo == 0) - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A寮�鍏�; - } - else if (selectNo == 1) - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鐏厜; - } - else if (selectNo == 2) - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鎻掑骇; - } - else - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鏈畾涔�; - } - }; - }; - } + return; } - - //濡傛灉鏄柊椋� - if (nowSelectDevice.Type == DeviceType.FreshAir) - { - //鍔熻兘绫诲瀷 - string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType); - string strType = Language.StringByID(R.MyInternationalizationString.FreshAir); - var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2); - btnFunction.UseClickStatu = false; - listview.AddChidren(btnFunction); - btnFunction.InitControl(); - //搴曠嚎 - btnFunction.AddBottomLine(); - } + listview.AddChidren(rowFunction); + rowFunction.InitControl(); + //搴曠嚎 + rowFunction.AddBottomLine(); } #endregion diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs index e7b18cf..bab6b42 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs @@ -901,9 +901,15 @@ /// </summary> private void AddAirSwitchFunctionTypeRow() { - if (this.deviceEnumInfo.BeloneType != DeviceBeloneType.A鏅鸿兘绌哄紑) + //2020.04.28鍙樻洿:鏈変釜鍒澶囧畠闄や簡缁х數鍣ㄥ洖璺紝浠�涔堥兘娌℃湁浜�, + //杩欎釜鏃跺�欎篃瑕佺幇瀹炲嚭鏉� + if (this.listNewDevice.Count != 1) { - //涓嶆槸绌烘皵寮�鍏� + return; + } + if (this.listNewDevice[0].Type != DeviceType.OnOffOutput + && this.listNewDevice[0].Type != DeviceType.AirSwitch) + { return; } //鑷畾涔夊姛鑳界被鍨嬫帶浠� diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs index 3879f6e..3d6b287 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DoorLock/DoorLockHistoryLogForm.cs @@ -395,6 +395,11 @@ //甯稿紑妯″紡鍚敤{0}灏忔椂 btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uNormallyOpenModeOpenSomeTime).Replace("{0}", historyInfo.NormallyOpenContinuedTime); } + else if (historyInfo.OtherOpenLockMode == 9004) + { + //甯稿紑鑷姩鍖栨墜鍔ㄥ彇娑� + btnMsg.Text = Language.StringByID(R.MyInternationalizationString.uNormallyOpenLogicManualClose); + } else { //涓婇潰鏄疉pp鎵嬪姩鎺ㄩ��,杩欓噷鏄綉鍏虫垨鑰呴棬閿佽嚜宸辨帹閫� @@ -1104,7 +1109,7 @@ /// </summary> public string CloudAccountId = string.Empty; /// <summary> - /// 鍏朵粬寮�閿佹柟寮�(OpenLockMode=9000鏃舵湁鏁�) 9001:甯稿紑鎵撳紑 9002:甯稿紑鍙栨秷 9003:甯稿紑鎸佺画 + /// 鍏朵粬寮�閿佹柟寮�(OpenLockMode=9000鏃舵湁鏁�) 9001:甯稿紑鎵撳紑 9002:甯稿紑鍙栨秷 9003:甯稿紑鎸佺画 9004:甯稿紑鑷姩鍖栨墜鍔ㄥ彇娑� /// </summary> public int? OtherOpenLockMode = -1; /// <summary> diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs index 82f7f96..cdd9f59 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFangyueFunctionSettionForm.cs @@ -37,10 +37,6 @@ /// </summary> private Dictionary<int, string> dicDeviceSaveName = new Dictionary<int, string>(); /// <summary> - /// 璁惧闇�瑕佷繚瀛樼殑璁惧鍔熻兘 - /// </summary> - private Dictionary<int, DeviceFunctionType> dicDeviceFuncType = new Dictionary<int, DeviceFunctionType>(); - /// <summary> /// 淇℃伅缂栬緫鎺т欢 /// </summary> private InformationEditorControl tableContr = null; @@ -94,8 +90,6 @@ { //璁板綍璧峰綋鍓嶆鍦ㄦ搷浣滅殑鍥炶矾鍚嶅瓧 dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim(); - //寮�鍚繘搴︽潯 - this.ShowProgressBar(); foreach (var epoint in dicDeviceSaveName.Keys) { var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); @@ -112,45 +106,10 @@ var result = await Common.LocalDevice.Current.ReName(device, newName); if (result == false) { - //鍏抽棴 - this.CloseProgressBar(); return; } } } - foreach (var epoint in dicDeviceFuncType.Keys) - { - var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); - if (device == null) - { - continue; - } - //璁剧疆鍔熻兘绫诲瀷 - device.DfunctionType = dicDeviceFuncType[epoint]; - if (device.IsCustomizeImage == true) - { - continue; - } - //閲嶆柊璁剧疆鍥剧墖 - if (device.DfunctionType == DeviceFunctionType.A寮�鍏�) - { - device.IconPath = "Device/Switch.png"; - } - else if (device.DfunctionType == DeviceFunctionType.A鎻掑骇) - { - device.IconPath = "Device/Socket1.png"; - } - else if (device.DfunctionType == DeviceFunctionType.A鐏厜) - { - device.IconPath = "Device/Light.png"; - } - else - { - device.IconPath = "Device/RelayEpoint.png"; - } - device.ReSave(); - } - this.CloseProgressBar(); //鍏抽棴鑷韩 this.CloseForm(); }; @@ -281,95 +240,14 @@ /// </summary> private void AddFunctionTypeRow() { - //濡傛灉鏄户鐢靛櫒鍜岃皟鍏夊櫒鐨勮瘽 - if (nowSelectDevice.Type == DeviceType.OnOffOutput || nowSelectDevice.Type == DeviceType.DimmableLight - || nowSelectDevice.Type == DeviceType.ColorDimmableLight) + //鑷畾涔夊姛鑳界被鍨嬫帶浠� + var rowFunction = new DeviceFunctionTypeRowControl(nowSelectDevice, listview.rowSpace / 2); + if (rowFunction.CanShowRow == true) { - //鍔熻兘绫诲瀷 - string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType); - var DfunctionType = nowSelectDevice.DfunctionType; - if (this.dicDeviceFuncType.ContainsKey(nowSelectDevice.DeviceEpoint) == true) - { - DfunctionType = this.dicDeviceFuncType[nowSelectDevice.DeviceEpoint]; - } - - //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛� - int nowSelectNo = 1; - string strType = string.Empty; - if (DfunctionType == DeviceFunctionType.A鐏厜) - { - strType = Language.StringByID(R.MyInternationalizationString.uLight); - nowSelectNo = 1; - } - else if (DfunctionType == DeviceFunctionType.A寮�鍏�) - { - strType = Language.StringByID(R.MyInternationalizationString.uSwitch); - nowSelectNo = 0; - } - else if (DfunctionType == DeviceFunctionType.A鎻掑骇) - { - strType = Language.StringByID(R.MyInternationalizationString.uSocket1); - nowSelectNo = 2; - } - - var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2); - btnFunction.UseClickStatu = false; - listview.AddChidren(btnFunction); - btnFunction.InitControl(); + listview.AddChidren(rowFunction); + rowFunction.InitControl(); //搴曠嚎 - btnFunction.AddBottomLine(); - - //濡傛灉鏄户鐢靛櫒鎵嶈兘澶熸洿鏀硅繖涓姛鑳界被鍨� - if (nowSelectDevice.Type == DeviceType.OnOffOutput) - { - btnFunction.UseClickStatu = true; - //鍙崇澶� - btnFunction.AddRightArrow(); - btnFunction.ButtonClickEvent += (sender, e) => - { - //鏄剧ず鍒楄〃 - var listText = new List<string>(); - listText.Add(Language.StringByID(R.MyInternationalizationString.uSwitch));//寮�鍏� - listText.Add(Language.StringByID(R.MyInternationalizationString.uLight));//鐏厜 - listText.Add(Language.StringByID(R.MyInternationalizationString.uSocket1));//鎻掑骇 - //鏍囬:閫夋嫨鍔熻兘绫诲瀷 - var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType); - - var form = new BottomItemSelectForm(); - form.CancelCallEvent = true;//鍏佽鍙栨秷 - form.AddForm(title, listText, nowSelectNo); - form.FinishSelectEvent += (selectNo) => - { - if (selectNo == -1) - { - //閫夋嫨鍙栨秷 - btnFunction.Text = string.Empty; - } - else - { - btnFunction.Text = listText[selectNo]; - } - nowSelectNo = selectNo; - //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� - if (selectNo == 0) - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A寮�鍏�; - } - else if (selectNo == 1) - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鐏厜; - } - else if (selectNo == 2) - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鎻掑骇; - } - else - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鏈畾涔�; - } - }; - }; - } + rowFunction.AddBottomLine(); } } diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs index 3a46d58..7f44d16 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Panel/PanelFunctionSettionForm.cs @@ -37,10 +37,6 @@ /// </summary> private Dictionary<int, string> dicDeviceSaveName = new Dictionary<int, string>(); /// <summary> - /// 璁惧闇�瑕佷繚瀛樼殑璁惧鍔熻兘 - /// </summary> - private Dictionary<int, DeviceFunctionType> dicDeviceFuncType = new Dictionary<int, DeviceFunctionType>(); - /// <summary> /// 淇℃伅缂栬緫鎺т欢 /// </summary> private InformationEditorControl tableContr = null; @@ -94,8 +90,6 @@ { //璁板綍璧峰綋鍓嶆鍦ㄦ搷浣滅殑鍥炶矾鍚嶅瓧 dicDeviceSaveName[nowSelectDevice.DeviceEpoint] = btnDeviceName.Text.Trim(); - //寮�鍚繘搴︽潯 - this.ShowProgressBar(); foreach (var epoint in dicDeviceSaveName.Keys) { var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); @@ -112,45 +106,10 @@ var result = await Common.LocalDevice.Current.ReName(device, newName); if (result == false) { - //鍏抽棴 - this.CloseProgressBar(); return; } } } - foreach (var epoint in dicDeviceFuncType.Keys) - { - var device = Common.LocalDevice.Current.GetDevice(deviceObj.DeviceAddr, epoint); - if (device == null) - { - continue; - } - //璁剧疆鍔熻兘绫诲瀷 - device.DfunctionType = dicDeviceFuncType[epoint]; - if (device.IsCustomizeImage == true) - { - continue; - } - //閲嶆柊璁剧疆鍥剧墖 - if (device.DfunctionType == DeviceFunctionType.A寮�鍏�) - { - device.IconPath = "Device/Switch.png"; - } - else if (device.DfunctionType == DeviceFunctionType.A鎻掑骇) - { - device.IconPath = "Device/Socket1.png"; - } - else if (device.DfunctionType == DeviceFunctionType.A鐏厜) - { - device.IconPath = "Device/Light.png"; - } - else - { - device.IconPath = "Device/RelayEpoint.png"; - } - device.ReSave(); - } - this.CloseProgressBar(); //鍏抽棴鑷韩 this.CloseForm(); }; @@ -281,95 +240,14 @@ /// </summary> private void AddFunctionTypeRow() { - //濡傛灉鏄户鐢靛櫒鍜岃皟鍏夊櫒鐨勮瘽 - if (nowSelectDevice.Type == DeviceType.OnOffOutput || nowSelectDevice.Type == DeviceType.DimmableLight - || nowSelectDevice.Type == DeviceType.ColorDimmableLight) + //鑷畾涔夊姛鑳界被鍨嬫帶浠� + var rowFunction = new DeviceFunctionTypeRowControl(nowSelectDevice, listview.rowSpace / 2); + if (rowFunction.CanShowRow == true) { - //鍔熻兘绫诲瀷 - string caption = Language.StringByID(R.MyInternationalizationString.uFunctionType); - var DfunctionType = nowSelectDevice.DfunctionType; - if (this.dicDeviceFuncType.ContainsKey(nowSelectDevice.DeviceEpoint) == true) - { - DfunctionType = this.dicDeviceFuncType[nowSelectDevice.DeviceEpoint]; - } - - //鍔熻兘绫诲瀷鐨勭炕璇戝悕瀛� - int nowSelectNo = 1; - string strType = string.Empty; - if (DfunctionType == DeviceFunctionType.A鐏厜) - { - strType = Language.StringByID(R.MyInternationalizationString.uLight); - nowSelectNo = 1; - } - else if (DfunctionType == DeviceFunctionType.A寮�鍏�) - { - strType = Language.StringByID(R.MyInternationalizationString.uSwitch); - nowSelectNo = 0; - } - else if (DfunctionType == DeviceFunctionType.A鎻掑骇) - { - strType = Language.StringByID(R.MyInternationalizationString.uSocket1); - nowSelectNo = 2; - } - - var btnFunction = new FrameCaptionViewControl(caption, strType, listview.rowSpace / 2); - btnFunction.UseClickStatu = false; - listview.AddChidren(btnFunction); - btnFunction.InitControl(); + listview.AddChidren(rowFunction); + rowFunction.InitControl(); //搴曠嚎 - btnFunction.AddBottomLine(); - - //濡傛灉鏄户鐢靛櫒鎵嶈兘澶熸洿鏀硅繖涓姛鑳界被鍨� - if (nowSelectDevice.Type == DeviceType.OnOffOutput) - { - btnFunction.UseClickStatu = true; - //鍙崇澶� - btnFunction.AddRightArrow(); - btnFunction.ButtonClickEvent += (sender, e) => - { - //鏄剧ず鍒楄〃 - var listText = new List<string>(); - listText.Add(Language.StringByID(R.MyInternationalizationString.uSwitch));//寮�鍏� - listText.Add(Language.StringByID(R.MyInternationalizationString.uLight));//鐏厜 - listText.Add(Language.StringByID(R.MyInternationalizationString.uSocket1));//鎻掑骇 - //鏍囬:閫夋嫨鍔熻兘绫诲瀷 - var title = Language.StringByID(R.MyInternationalizationString.uSelectFunctionType); - - var form = new BottomItemSelectForm(); - form.CancelCallEvent = true;//鍏佽鍙栨秷 - form.AddForm(title, listText, nowSelectNo); - form.FinishSelectEvent += (selectNo) => - { - if (selectNo == -1) - { - //閫夋嫨鍙栨秷 - btnFunction.Text = string.Empty; - } - else - { - btnFunction.Text = listText[selectNo]; - } - nowSelectNo = selectNo; - //璁板綍璧峰綋鍓嶉�夋嫨鐨勫姛鑳界被鍨� - if (selectNo == 0) - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A寮�鍏�; - } - else if (selectNo == 1) - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鐏厜; - } - else if (selectNo == 2) - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鎻掑骇; - } - else - { - dicDeviceFuncType[nowSelectDevice.DeviceEpoint] = DeviceFunctionType.A鏈畾涔�; - } - }; - }; - } + rowFunction.AddBottomLine(); } } diff --git a/ZigbeeApp/Shared/R.cs b/ZigbeeApp/Shared/R.cs index 49e7bfe..e488250 100755 --- a/ZigbeeApp/Shared/R.cs +++ b/ZigbeeApp/Shared/R.cs @@ -5726,6 +5726,11 @@ /// 鐏叏鍏� /// </summary> public const int uAllLightClose = 16114; + /// <summary> + /// 甯稿紑鑷姩鍖栨墜鍔ㄥ彇娑� + /// </summary> + public const int uNormallyOpenLogicManualClose = 16115; + //鈽呪槄鈽呪槄涓嬮潰杩欎簺鏄帴鍙g殑杩斿洖淇℃伅缈昏瘧,浠�18000寮�濮嬧槄鈽呪槄鈽� /// <summary> -- Gitblit v1.8.0