From 99253403b560f761d5f9af8b4f5140496996433a Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期五, 20 十一月 2020 16:49:50 +0800 Subject: [PATCH] 新云端的代码Ver1.0 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs | 282 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 141 insertions(+), 141 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs index 51e3ab6..c79cefc 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Direction/AddDeviceTypeListForm.cs @@ -16,8 +16,8 @@ /// 鍒楄〃鎺т欢 /// </summary> private VerticalListControl listView = null; - /// <summary> - /// 褰撳墠缃戝叧瀵硅薄 + /// <summary> + /// 褰撳墠缃戝叧瀵硅薄 /// </summary> private ZbGateway zbGateway = null; @@ -31,12 +31,12 @@ public void ShowForm() { //璁惧畾鏍囬 - base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceType)); - - //鍒濆鍖栦腑閮ㄦ帶浠� - this.InitMiddleFrame(); - - this.zbGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.AppOldSelectGatewayId); + base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uDeviceType)); + + //鍒濆鍖栦腑閮ㄦ帶浠� + this.InitMiddleFrame(); + + this.zbGateway = HdlGatewayLogic.Current.GetLocalGateway(HdlGatewayResourse.AppOldSelectGatewayId); } /// <summary> @@ -81,13 +81,13 @@ //鏂规偊鍙屽紑鍥涙帶闈㈡澘 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName5); unSelectPic = "Device/ButtonPanelFangyueFour.png"; - this.AddMenuRow(objectText, unSelectPic, "PanelFangyueFourButtonDirectionForm"); - - //鏂规偊鍥涘紑鍏帶闈㈡澘 + this.AddMenuRow(objectText, unSelectPic, "PanelFangyueFourButtonDirectionForm"); + + //鏂规偊鍥涘紑鍏帶闈㈡澘 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName6); unSelectPic = "Device/ButtonPanelFangyueEight.png"; - this.AddMenuRow(objectText, unSelectPic, "PanelFangyueEightButtonDirectionForm"); - + this.AddMenuRow(objectText, unSelectPic, "PanelFangyueEightButtonDirectionForm"); + //鏂规偊鏂伴灏忔ā鍧�,鍥剧墖鍜�3璺户鐢靛櫒灏忔ā鍧楃浉鍚� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName7); unSelectPic = "Device/RelayThreeLoad.png"; @@ -104,12 +104,12 @@ objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName29); unSelectPic = "Device/ButtonPanelSimpleEnvironment.png"; this.AddMenuRow(objectText, unSelectPic, "PanelSimpleEnvironmentDirectionForm"); - //鏂规偊鐜闈㈡澘 + //鏂规偊鐜闈㈡澘 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName9); unSelectPic = "Device/ButtonPanelFangyueEnvironment.png"; - this.AddMenuRow(objectText, unSelectPic, "PanelFangyueEnvironmentDirectionForm"); - - //绐楀笜闈㈡澘 + this.AddMenuRow(objectText, unSelectPic, "PanelFangyueEnvironmentDirectionForm"); + + //绐楀笜闈㈡澘 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName10); unSelectPic = "Device/ButtonPanelCurtain.png"; this.AddMenuRow(objectText, unSelectPic, "PanelCurtainDirectionForm"); @@ -126,15 +126,15 @@ //Zigbee鏅鸿兘寮�鍚堝笜鐢垫満 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName13); - unSelectPic = "Device/CurtainAutoOpen.png"; - this.AddMenuRow(objectText, unSelectPic, "CurtainAutoOpenDirectionForm"); - - //Zigbee鏅鸿兘绠$姸鐢垫満 + unSelectPic = "Device/CurtainAutoOpen.png"; + this.AddMenuRow(objectText, unSelectPic, "CurtainAutoOpenDirectionForm"); + + //Zigbee鏅鸿兘绠$姸鐢垫満 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName14); unSelectPic = "Device/CurtainSiphonate.png"; - this.AddMenuRow(objectText, unSelectPic, "CurtainSiphonateDirectionForm"); - - //绌鸿皟 + this.AddMenuRow(objectText, unSelectPic, "CurtainSiphonateDirectionForm"); + + //绌鸿皟 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName15); unSelectPic = "Device/AirConditionerZbGateway.png"; this.AddMenuRow(objectText, unSelectPic, "AirConditionerZbGatewayDirectionForm"); @@ -142,64 +142,64 @@ //鏅鸿兘闂ㄩ攣 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName16); unSelectPic = "Device/IntelligentLocksH06C.png"; - this.AddMenuRow(objectText, unSelectPic, "IntelligentLocksH06cDirectionForm"); - - //PIR浼犳劅鍣� + this.AddMenuRow(objectText, unSelectPic, "IntelligentLocksH06cDirectionForm"); + + //PIR浼犳劅鍣� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName17); unSelectPic = "Device/SensorPir.png"; - this.AddMenuRow(objectText, unSelectPic, "SensorPirDirectionForm"); - - //绾㈠浼犳劅鍣� + this.AddMenuRow(objectText, unSelectPic, "SensorPirDirectionForm"); + + //绾㈠浼犳劅鍣� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName18); unSelectPic = "Device/SensorInfrared.png"; - this.AddMenuRow(objectText, unSelectPic, "SensorInfraredDirectionForm"); - - //鐕冩皵浼犳劅鍣� + this.AddMenuRow(objectText, unSelectPic, "SensorInfraredDirectionForm"); + + //鐕冩皵浼犳劅鍣� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName19); unSelectPic = "Device/SensorCarbonMonoxide.png"; - this.AddMenuRow(objectText, unSelectPic, "SensorCarbonMonoxideDirectionForm"); - - //鍚搁《鐕冩皵浼犳劅鍣� + this.AddMenuRow(objectText, unSelectPic, "SensorCarbonMonoxideDirectionForm"); + + //鍚搁《鐕冩皵浼犳劅鍣� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName26); unSelectPic = "Device/SensorCarbonMonoxide.png"; - this.AddMenuRow(objectText, unSelectPic, "SensorCeilingGasDirectionForm"); - - //鐑熼浘浼犳劅鍣� + this.AddMenuRow(objectText, unSelectPic, "SensorCeilingGasDirectionForm"); + + //鐑熼浘浼犳劅鍣� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName20); unSelectPic = "Device/SensorFire.png"; - this.AddMenuRow(objectText, unSelectPic, "SensorFireDirectionForm"); - - //姘存蹈浼犳劅鍣� + this.AddMenuRow(objectText, unSelectPic, "SensorFireDirectionForm"); + + //姘存蹈浼犳劅鍣� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName21); unSelectPic = "Device/SensorWater.png"; - this.AddMenuRow(objectText, unSelectPic, "SensorWaterDirectionForm"); - - //闂ㄧ獥浼犳劅鍣� + this.AddMenuRow(objectText, unSelectPic, "SensorWaterDirectionForm"); + + //闂ㄧ獥浼犳劅鍣� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName22); unSelectPic = "Device/SensorDoorWindow.png"; - this.AddMenuRow(objectText, unSelectPic, "SensorDoorWindowDirectionForm"); - - //娓╂箍搴︿紶鎰熷櫒 + this.AddMenuRow(objectText, unSelectPic, "SensorDoorWindowDirectionForm"); + + //娓╂箍搴︿紶鎰熷櫒 objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName23); unSelectPic = "Device/SensorTemperatureHumidity.png"; - this.AddMenuRow(objectText, unSelectPic, "SensorTemperatureHumidityForm"); - - //鐞冨瀷绉诲姩浼犳劅鍣� + this.AddMenuRow(objectText, unSelectPic, "SensorTemperatureHumidityForm"); + + //鐞冨瀷绉诲姩浼犳劅鍣� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName30); unSelectPic = "Device/SensorSphericalMotion.png"; - this.AddMenuRow(objectText, unSelectPic, "SensorSphericalMotionDirectionForm"); + this.AddMenuRow(objectText, unSelectPic, "SensorSphericalMotionDirectionForm"); //PM2.5绌烘皵璐ㄩ噺浼犳劅鍣� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName27); unSelectPic = "Device/SensorPMTwoPointFive.png"; this.AddMenuRow(objectText, unSelectPic, "SensorPMTwoPointFiveForm"); - - //涓户鍣� + + //涓户鍣� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName24); unSelectPic = "Device/RepeaterZigbee.png"; - this.AddMenuRow(objectText, unSelectPic, "RepeaterZigbeeDirectionForm"); - - //绌烘皵寮�鍏� + this.AddMenuRow(objectText, unSelectPic, "RepeaterZigbeeDirectionForm"); + + //绌烘皵寮�鍏� objectText = Language.StringByID(R.MyInternationalizationString.uDeviceDirectionName25); unSelectPic = "Device/AirSwitchCloudContr.png"; this.AddMenuRow(objectText, unSelectPic, "AirSwitchCloudContrDirectionForm"); @@ -209,80 +209,80 @@ unSelectPic = "Device/ThirdPartyDevice.png"; var rowThrid = this.AddMenuRow(objectText, unSelectPic, string.Empty, false); rowThrid.ButtonClickEvent += (sender, e) => - { - rowThrid.CanClick = false; - HdlThreadLogic.Current.RunThread(() => - { - //妫�娴嬬綉鍏� - var errorMsg = this.CheckGateway(); - HdlThreadLogic.Current.RunMain(() => - { - rowThrid.CanClick = true; - if (errorMsg != null) - { - this.ShowMassage(ShowMsgType.Tip, errorMsg); - } - else - { - var form = new Device.DeviceSearchForm(); - form.AddForm(string.Empty); - } - }); + { + rowThrid.CanClick = false; + HdlThreadLogic.Current.RunThread(() => + { + //妫�娴嬬綉鍏� + var errorMsg = this.CheckGateway(); + HdlThreadLogic.Current.RunMain(() => + { + rowThrid.CanClick = true; + if (errorMsg != null) + { + this.ShowMassage(ShowMsgType.Tip, errorMsg); + } + else + { + var form = new Device.DeviceSearchForm(); + form.AddForm(string.Empty); + } + }); }); }; //璋冩暣鍒楄〃鎺т欢鐨勯珮搴� listView.AdjustRealHeight(Application.GetRealHeight(23)); - } - - #endregion - - #region 鈻� 妫�娴嬬綉鍏砡__________________________ - - /// <summary> - /// 妫�娴嬬綉鍏�(杩斿洖閿欒淇℃伅,null浠h〃娌¢棶棰�) - /// </summary> - private string CheckGateway() - { - if (zbGateway != null && zbGateway.LinuxImageType == 11) - { - //mini澶滅伅鍙兘闄愬埗鍔犲叆16鍜岃澶� - this.ShowProgressBar(); - - int statu = 0; - //閲嶆柊鑾峰彇璁惧鍒楄〃 - var listDevice = Common.LocalDevice.Current.GetDeviceListFromGateway(zbGateway.GwId, ref statu, true, ShowErrorMode.NO); - if (statu != 1) - { - //濡傛灉 - listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(zbGateway.GwId); - } - //妫�娴媘ini缃戝叧鐨勮澶囨暟 - var listMac = new HashSet<string>(); - foreach (var device in listDevice) - { - if (listMac.Contains(device.DeviceAddr) == false) - { - listMac.Add(device.DeviceAddr); - } - } - this.CloseProgressBar(); - - bool canAdd = listMac.Count < 16; - if (canAdd == false) - { - //Mini缃戝叧鏈�澶у彧鑳芥坊鍔�16涓澶� - return Language.StringByID(R.MyInternationalizationString.uMiniGatewayMaxDeviceCountMsg); - } - } - - return null; } #endregion - + + #region 鈻� 妫�娴嬬綉鍏砡__________________________ + + /// <summary> + /// 妫�娴嬬綉鍏�(杩斿洖閿欒淇℃伅,null浠h〃娌¢棶棰�) + /// </summary> + private string CheckGateway() + { + if (zbGateway != null && zbGateway.LinuxImageType == 11) + { + //mini澶滅伅鍙兘闄愬埗鍔犲叆16鍜岃澶� + this.ShowProgressBar(); + + int statu = 0; + //閲嶆柊鑾峰彇璁惧鍒楄〃 + var listDevice = HdlDeviceCommonLogic.Current.GetDeviceListFromGateway(zbGateway.GwId, ref statu, true, ShowErrorMode.NO); + if (statu != 1) + { + //濡傛灉 + listDevice = HdlDeviceCommonLogic.Current.GetDeviceByGatewayID(zbGateway.GwId); + } + //妫�娴媘ini缃戝叧鐨勮澶囨暟 + var listMac = new HashSet<string>(); + foreach (var device in listDevice) + { + if (listMac.Contains(device.DeviceAddr) == false) + { + listMac.Add(device.DeviceAddr); + } + } + this.CloseProgressBar(); + + bool canAdd = listMac.Count < 16; + if (canAdd == false) + { + //Mini缃戝叧鏈�澶у彧鑳芥坊鍔�16涓澶� + return Language.StringByID(R.MyInternationalizationString.uMiniGatewayMaxDeviceCountMsg); + } + } + + return null; + } + + #endregion + #region 鈻� 娣诲姞鑿滃崟鏍廮________________________ - + /// <summary> /// 娣诲姞鑿滃崟鏍� /// </summary> @@ -309,25 +309,25 @@ if (formName != string.Empty) { rowLayout.ButtonClickEvent += (sender, e) => - { - rowLayout.CanClick = false; - HdlThreadLogic.Current.RunThread(() => - { - //妫�娴嬬綉鍏� - var errorMsg = this.CheckGateway(); - HdlThreadLogic.Current.RunMain(() => - { - rowLayout.CanClick = true; - if (errorMsg != null) - { - this.ShowMassage(ShowMsgType.Tip, errorMsg); - } - else - { - //鍙嶅皠鐩爣鐣岄潰 - this.LoadFormByFullName("Shared.Phone.UserCenter.DeviceDirection." + formName); - } - }); + { + rowLayout.CanClick = false; + HdlThreadLogic.Current.RunThread(() => + { + //妫�娴嬬綉鍏� + var errorMsg = this.CheckGateway(); + HdlThreadLogic.Current.RunMain(() => + { + rowLayout.CanClick = true; + if (errorMsg != null) + { + this.ShowMassage(ShowMsgType.Tip, errorMsg); + } + else + { + //鍙嶅皠鐩爣鐣岄潰 + this.LoadFormByFullName("Shared.Phone.UserCenter.DeviceDirection." + formName); + } + }); }); }; } -- Gitblit v1.8.0