From 652243206427f35a256400a149a1734085824cb9 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期三, 02 九月 2020 17:35:03 +0800 Subject: [PATCH] 2020-09-02-4 --- ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs | 165 +++++++++++++++++++++++++++++++++--------------------- 1 files changed, 101 insertions(+), 64 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs index 6739b3e..8236ea9 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs @@ -74,23 +74,28 @@ btnNote.InitControl(); //鍒掔嚎 btnNote.AddBottomLine(); - btnNote.txtInput.FinishInputEvent += () => + //濡傛灉鏄睍绀烘ā鏉跨殑璇�,涓嶈兘缂栬緫 + if (Common.Config.Instance.Home.IsShowTemplate == false) { - string oldName = HdlGatewayLogic.Current.GetGatewayName(zbGateway); - if (btnNote.Text == string.Empty) + btnNote.txtInput.FinishInputEvent += () => { - btnNote.Text = oldName; - } - if (oldName != btnNote.Text) - { - //淇敼鍚嶅瓧 - this.SetGatewayName(btnNote.Text, false); - } - }; + string oldName = HdlGatewayLogic.Current.GetGatewayName(zbGateway); + if (btnNote.Text == string.Empty) + { + btnNote.Text = oldName; + } + if (oldName != btnNote.Text) + { + //淇敼鍚嶅瓧 + this.SetGatewayName(btnNote.Text, false); + } + }; + } //璁惧绫诲瀷 (鍥哄畾鏅鸿兘缃戝叧) caption = Language.StringByID(R.MyInternationalizationString.uDeviceType); - var btnType = new FrameCaptionViewControl(caption, Language.StringByID(60004), listview.rowSpace / 2); + var infoContent = Common.LocalDevice.Current.GetDeviceModelIdNameInfo("1"); + var btnType = new FrameCaptionViewControl(caption, infoContent != null ? infoContent.A绫诲瀷鍚嶅瓧 : string.Empty, listview.rowSpace / 2); btnType.UseClickStatu = false; listview.AddChidren(btnType); btnType.InitControl(); @@ -106,8 +111,13 @@ rowBeloneArea.SelectRoomEvent += (roomKeys) => { //鍙樻洿缃戝叧鎴块棿 - HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway, roomKeys); + HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway.GwId, roomKeys); }; + //濡傛灉鏄睍绀烘ā鏉跨殑璇�,涓嶈兘缂栬緫 + if (Common.Config.Instance.Home.IsShowTemplate == true) + { + rowBeloneArea.CanClick = false; + } //鎵�灞炰綇瀹� caption = Language.StringByID(R.MyInternationalizationString.uBelongResidence); @@ -118,6 +128,44 @@ //鍒掔嚎 btnBeloneArea.AddBottomLine(); + //mini缃戝叧鏈変釜鍔熻兘璁剧疆 + var linuxImageType = this.zbGateway.LinuxImageType; + if (linuxImageType == 11) + { + var listDevice = Common.LocalDevice.Current.GetDeviceByGatewayID(this.zbGateway.GwId); + CommonDevice miniDevice = null; + foreach (var device in listDevice) + { + //鑾峰彇杩欎釜缃戝叧涓嬬殑灏忓鐏澶� + if (Common.LocalDevice.Current.IsMiniLight(device) == true) + { + miniDevice = device; + break; + } + } + //濡傛灉鎵惧緱鍒扮殑璇� + if (miniDevice != null) + { + //鍔熻兘璁剧疆 + var rowFunction = new RowLayoutControl(listview.rowSpace / 2); + listview.AddChidren(rowFunction); + rowFunction.frameTable.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp), 700); + //鍙冲浘鏍� + rowFunction.frameTable.AddRightArrow(); + //搴曠嚎 + rowFunction.frameTable.AddBottomLine(); + //濡傛灉鏄睍绀烘ā鏉跨殑璇�,涓嶈兘缂栬緫 + if (Common.Config.Instance.Home.IsShowTemplate == false) + { + rowFunction.frameTable.ButtonClickEvent += (sender, e) => + { + var form = new DeviceLight.MiniNightLightFunctionSettionForm(); + form.AddForm(miniDevice); + }; + } + } + } + //鏁版嵁涓婁紶涓庝笅杞� var rowData = new RowLayoutControl(listview.rowSpace / 2); listview.AddChidren(rowData); @@ -126,11 +174,15 @@ rowData.frameTable.AddRightArrow(); //搴曠嚎 rowData.frameTable.AddBottomLine(); - rowData.frameTable.ButtonClickEvent += (sender, e) => + //濡傛灉鏄睍绀烘ā鏉跨殑璇�,涓嶈兘缂栬緫 + if (Common.Config.Instance.Home.IsShowTemplate == false) { - var form = new GatewayUploadAndDownLoadForm(); - form.AddForm(HdlGatewayLogic.Current.GetGatewayId(this.zbGateway)); - }; + rowData.frameTable.ButtonClickEvent += (sender, e) => + { + var form = new GatewayUploadAndDownLoadForm(); + form.AddForm(this.zbGateway.GwId); + }; + } //閫氱敤淇℃伅 var btnGeneral = new FrameRowControl(listview.rowSpace / 2); @@ -160,7 +212,7 @@ btnNewVersion.Visible = false; btnNewVersion.X = Application.GetRealWidth(242); btnNewVersion.Y = Application.GetRealHeight(23); - rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEventOnly); + rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEvent); rowUpDate.ButtonClickEvent += (sender, e) => { btnNewVersion.Visible = false; @@ -176,6 +228,11 @@ var btnFinish = new BottomClickButton(); btnFinish.TextID = R.MyInternationalizationString.uSave; bodyFrameLayout.AddChidren(btnFinish); + //濡傛灉鏄睍绀烘ā鏉跨殑璇�,涓嶈兘缂栬緫 + if (Common.Config.Instance.Home.IsShowTemplate == true) + { + btnFinish.CanClick = false; + } btnFinish.ButtonClickEvent += (sender, e) => { string oldName = HdlGatewayLogic.Current.GetGatewayName(zbGateway); @@ -186,7 +243,7 @@ if (oldName != btnNote.Text) { //淇敼鍚嶅瓧 - this.SetGatewayName(btnNote.Text, false); + this.SetGatewayName(btnNote.Text, true); } else { @@ -195,11 +252,15 @@ } }; - HdlThreadLogic.Current.RunThread(() => + //濡傛灉鏄睍绀烘ā鏉跨殑璇�,涓嶉渶瑕佹娴� + if (Common.Config.Instance.Home.IsShowTemplate == false) { - //妫�娴嬫柊鐗堟湰 - this.CheckNewVersion(btnNewVersion); - }); + HdlThreadLogic.Current.RunThread(() => + { + //妫�娴嬫柊鐗堟湰 + this.CheckNewVersion(btnNewVersion); + }); + } } #endregion @@ -211,6 +272,11 @@ /// </summary> private void InitTopRightMenu() { + //濡傛灉鏄睍绀烘ā鏉跨殑璇�,涓嶈兘缂栬緫 + if (Common.Config.Instance.Home.IsShowTemplate == true) + { + return; + } var btnIcon = new MostRightIconControl(69, 69); btnIcon.UnSelectedImagePath = "Item/More.png"; topFrameLayout.AddChidren(btnIcon); @@ -244,7 +310,7 @@ //鍒囨崲 MenuName = Language.StringByID(R.MyInternationalizationString.uSwitch1); - string strWayId = HdlGatewayLogic.Current.GetGatewayId(zbGateway); + string strWayId = this.zbGateway.GwId; if (strWayId == GatewayResourse.AppOldSelectGatewayId) { MenuName = Language.StringByID(R.MyInternationalizationString.uRefresh); @@ -292,15 +358,15 @@ /// 妫�娴嬫柊鐗堟湰 /// </summary> /// <param name="btnNewVersion">鎻愮ず鏈夋柊鐗堟湰鐨勬帶浠�</param> - private async void CheckNewVersion(PicViewControl btnNewVersion) + private void CheckNewVersion(PicViewControl btnNewVersion) { //鑾峰彇缃戝叧鐗堟湰淇℃伅 - var result = await HdlGatewayLogic.Current.GetGatewayAllNewVersion(this.zbGateway); + var result = HdlGatewayLogic.Current.GetGatewayAllNewVersion(this.zbGateway, ShowErrorMode.NO); if (result == null) { return; } - Application.RunOnMainThread(() => + HdlThreadLogic.Current.RunMain(() => { if (this.Parent != null) { @@ -310,35 +376,7 @@ btnNewVersion.Visible = true; } } - }); - } - - #endregion - - #region 鈻� 瀹屾垚鎸夐挳鎸変笅_______________________ - - /// <summary> - /// 瀹屾垚鎸夐挳鎸変笅 - /// </summary> - /// <param name="gatewayName">缃戝叧鍚�</param> - private void FinishButtonClick(string gatewayName) - { - if (string.IsNullOrEmpty(gatewayName) == true) - { - //璇疯緭鍏ョ綉鍏冲悕绉� - string msg = Language.StringByID(R.MyInternationalizationString.uGatewayNameMastInput); - this.ShowMassage(ShowMsgType.Error, msg); - return; - } - string nameValue = HdlGatewayLogic.Current.GetGatewayName(zbGateway); - if (nameValue == gatewayName) - { - //鍚屽悕涓嶉渶瑕佸鐞� - this.CloseForm(); - return; - } - //淇敼鍚嶅瓧 - this.SetGatewayName(gatewayName, true); + }, ShowErrorMode.NO); } #endregion @@ -349,10 +387,10 @@ /// 璁剧疆缃戝叧鍚嶅瓧 /// </summary> /// <param name="gatewayName">缃戝叧鍚嶇О</param> - private async void SetGatewayName(string gatewayName, bool closeForm) + private void SetGatewayName(string gatewayName, bool closeForm) { //淇敼缃戝叧鍚� - var result = await HdlGatewayLogic.Current.ReName(zbGateway, gatewayName); + var result = HdlGatewayLogic.Current.ReName(zbGateway, gatewayName); //缃戝叧淇敼澶辫触 if (result == false) { @@ -373,10 +411,9 @@ /// </summary> /// <param name="gatewayId"></param> /// <param name="online"></param> - private async void DoSwitchGateway() + private void DoSwitchGateway() { - string gatewayId = HdlGatewayLogic.Current.GetGatewayId(zbGateway); - var result = await HdlGatewayLogic.Current.DoSwitchGateway(gatewayId); + var result = HdlGatewayLogic.Current.DoSwitchGateway(zbGateway.GwId); if (result == false) { return; @@ -403,7 +440,7 @@ else { //鍒锋柊涓荤敾闈�(涓嶉噸鏂拌幏鍙栬澶囩姸鎬�) - this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame", false); + this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame"); } }); } @@ -419,13 +456,13 @@ /// <param name="row"></param> private void DeleteGateway(string strWayId) { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { //鎵撳紑杩涘害鏉� this.ShowProgressBar(); //鍒犻櫎浜戠缃戝叧 - bool result = await HdlGatewayLogic.Current.DeleteGateway(strWayId); + bool result = HdlGatewayLogic.Current.DeleteGateway(strWayId); //鍏抽棴杩涘害鏉� this.CloseProgressBar(); if (result == false) -- Gitblit v1.8.0