From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期五, 10 七月 2020 10:52:13 +0800 Subject: [PATCH] 2020-07-10-01 --- ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs | 160 +++++++++++++++++++++++++++++++++------------------- 1 files changed, 101 insertions(+), 59 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs index 6b3fb19..ff1fb33 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Gateway/Manage/GatewayInfoEditorForm.cs @@ -15,7 +15,7 @@ /// <summary> /// 鍒楄〃鎺т欢 /// </summary> - private VerticalListControl listview = null; + private FrameListControl listview = null; /// <summary> /// 褰撳墠閫夋嫨鐨勭綉鍏� /// </summary> @@ -51,15 +51,19 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); + var listBackControl = new VerticalFrameControl(); + listBackControl.Height = bodyFrameLayout.Height; + bodyFrameLayout.AddChidren(listBackControl); + //鍒濆鍖栨甯� var tableContr = new InformationEditorControl(); - this.listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 369, 1368); + this.listview = tableContr.InitControl(listBackControl.frameTable, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 1368); //鍥剧墖 var btnPic = new DeviceInfoIconControl(); btnPic.Y = Application.GetRealHeight(92); btnPic.Gravity = Gravity.CenterHorizontal; - bodyFrameLayout.AddChidren(btnPic); + listBackControl.frameTable.AddChidren(btnPic); btnPic.InitControl(this.zbGateway); //璁惧澶囨敞 @@ -84,15 +88,69 @@ } }; - //璁惧绫诲瀷 + //璁惧绫诲瀷 (鍥哄畾鏅鸿兘缃戝叧) caption = Language.StringByID(R.MyInternationalizationString.uDeviceType); - var btnType = new FrameCaptionViewControl(caption, nameValue, listview.rowSpace / 2); + var btnType = new FrameCaptionViewControl(caption, Language.StringByID(60004), listview.rowSpace / 2); btnType.UseClickStatu = false; listview.AddChidren(btnType); btnType.InitControl(); - HdlGatewayLogic.Current.SetGatewayImageText(btnType.txtView, this.zbGateway); //鍒掔嚎 btnType.AddBottomLine(); + + //瀹夎浣嶇疆 + var rowBeloneArea = new BelongAreaControl(listview.rowSpace / 2); + listview.AddChidren(rowBeloneArea); + rowBeloneArea.InitControl(Language.StringByID(R.MyInternationalizationString.uInstallationLocation), this.zbGateway); + //搴曠嚎 + rowBeloneArea.AddBottomLine(); + rowBeloneArea.SelectRoomEvent += (roomKeys) => + { + //鍙樻洿缃戝叧鎴块棿 + HdlGatewayLogic.Current.ChangedGatewayRoom(this.zbGateway, roomKeys); + }; + + //鎵�灞炰綇瀹� + caption = Language.StringByID(R.MyInternationalizationString.uBelongResidence); + var btnBeloneArea = new FrameCaptionViewControl(caption, Common.Config.Instance.Home.Name, listview.rowSpace / 2); + btnBeloneArea.UseClickStatu = false; + listview.AddChidren(btnBeloneArea); + btnBeloneArea.InitControl(); + //鍒掔嚎 + 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(); + rowFunction.frameTable.ButtonClickEvent += (sender, e) => + { + var form = new DeviceLight.MiniNightLightFunctionSettionForm(); + form.AddForm(miniDevice); + }; + } + } //鏁版嵁涓婁紶涓庝笅杞� var rowData = new RowLayoutControl(listview.rowSpace / 2); @@ -104,6 +162,8 @@ rowData.frameTable.AddBottomLine(); rowData.frameTable.ButtonClickEvent += (sender, e) => { + var form = new GatewayUploadAndDownLoadForm(); + form.AddForm(this.zbGateway.GwId); }; //閫氱敤淇℃伅 @@ -134,14 +194,16 @@ 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; + var form = new GatewayUpdate.GatewayFirmwareUpdateForm(); + form.AddForm(zbGateway); }; //鍒濆鍖栨甯冨畬鎴� - tableContr.FinishInitControl(bodyFrameLayout, this.listview); + tableContr.FinishInitControl(); tableContr = null; //淇濆瓨 @@ -158,7 +220,7 @@ if (oldName != btnNote.Text) { //淇敼鍚嶅瓧 - this.SetGatewayName(btnNote.Text, false); + this.SetGatewayName(btnNote.Text, true); } else { @@ -170,7 +232,7 @@ HdlThreadLogic.Current.RunThread(() => { //妫�娴嬫柊鐗堟湰 - this.CheckNewVersion(btnNewVersion, btnType); + this.CheckNewVersion(btnNewVersion); }); } @@ -200,7 +262,7 @@ private void ShowTopRightMenu() { bool flage = UserCenterResourse.DicActionForm.ContainsKey("NewGateWayMenuSelectForm"); - var frame = new TopRightMenuControl(flage == true ? 1 : 3); + var frame = new TopRightMenuControl(flage == true ? 1 : 3, 1); //瀹氫綅 string MenuName = Language.StringByID(R.MyInternationalizationString.uFixedPosition); frame.AddRowMenu(MenuName, "Item/FixedPosition.png", "Item/FixedPositionSelected.png", () => @@ -216,7 +278,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); @@ -264,8 +326,7 @@ /// 妫�娴嬫柊鐗堟湰 /// </summary> /// <param name="btnNewVersion">鎻愮ず鏈夋柊鐗堟湰鐨勬帶浠�</param> - /// <param name="btnType">缃戝叧绫诲瀷鎺т欢</param> - private async void CheckNewVersion(PicViewControl btnNewVersion, FrameCaptionViewControl btnType) + private async void CheckNewVersion(PicViewControl btnNewVersion) { //鑾峰彇缃戝叧鐗堟湰淇℃伅 var result = await HdlGatewayLogic.Current.GetGatewayAllNewVersion(this.zbGateway); @@ -277,7 +338,6 @@ { if (this.Parent != null) { - HdlGatewayLogic.Current.SetGatewayImageText(btnType.txtView, this.zbGateway); if (result[0] != null || result[1] != null || result[2] != null) { //鎻愮ず鏈夋柊鐗堟湰 @@ -285,34 +345,6 @@ } } }); - } - - #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); } #endregion @@ -349,8 +381,7 @@ /// <param name="online"></param> private async void DoSwitchGateway() { - string gatewayId = HdlGatewayLogic.Current.GetGatewayId(zbGateway); - var result = await HdlGatewayLogic.Current.DoSwitchGateway(gatewayId); + var result = await HdlGatewayLogic.Current.DoSwitchGateway(zbGateway.GwId); if (result == false) { return; @@ -362,7 +393,7 @@ this.CloseForm(); //鍏抽棴鎸囧畾鐣岄潰(缃戝叧鎼滅储) - this.CloseFormByFormName("WiredGatewayListForm"); + this.CloseFormByFormName("GatewaySearchListForm"); this.CloseFormByFormName("NewGateWayMenuSelectForm"); //鍏抽棴鎸囧畾鐣岄潰(缃戝叧缂栬緫) @@ -377,7 +408,7 @@ else { //鍒锋柊涓荤敾闈�(涓嶉噸鏂拌幏鍙栬澶囩姸鎬�) - this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame", false); + this.LoadFormMethodByName("DeviceListMainForm", "InitMiddleFrame"); } }); } @@ -391,21 +422,32 @@ /// </summary> /// <param name="strWayId"></param> /// <param name="row"></param> - private async void DeleteGateway(string strWayId) + private void DeleteGateway(string strWayId) { - //鍒犻櫎浜戠缃戝叧 - bool result = await HdlGatewayLogic.Current.DeleteGateway(strWayId); - if (result == false) + HdlThreadLogic.Current.RunThread(async () => { - return; - } + //鎵撳紑杩涘害鏉� + this.ShowProgressBar(); - if (strWayId == GatewayResourse.AppOldSelectGatewayId) - { - HdlGatewayLogic.Current.SaveGatewayIdToLocation(string.Empty); - } - //鍏抽棴鑷韩 - this.CloseForm(); + //鍒犻櫎浜戠缃戝叧 + bool result = await HdlGatewayLogic.Current.DeleteGateway(strWayId); + //鍏抽棴杩涘害鏉� + this.CloseProgressBar(); + if (result == false) + { + return; + } + + if (strWayId == GatewayResourse.AppOldSelectGatewayId) + { + HdlGatewayLogic.Current.SaveGatewayIdToLocation(string.Empty); + } + HdlThreadLogic.Current.RunMain(() => + { + //鍏抽棴鑷韩 + this.CloseForm(); + }); + }); } #endregion -- Gitblit v1.8.0