From 944b87b6bcccb095cd73f13f4410fb20faf48f74 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期三, 25 十二月 2019 11:21:06 +0800 Subject: [PATCH] 2019.12.25 --- ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs | 233 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 173 insertions(+), 60 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs index 553133f..5759c49 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceMacInfoEditorForm.cs @@ -42,15 +42,6 @@ public void ShowForm(string deviceMac) { this.listNewDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); - //鎺掑簭 - this.listNewDevice.Sort((obj1, obj2) => - { - if (obj1.DeviceEpoint > obj2.DeviceEpoint) - { - return 1; - } - return -1; - }); this.listDeviceType.Clear(); foreach (var device in listNewDevice) @@ -104,14 +95,14 @@ btnNote.txtInput.FinishInputEvent += () => { string oldName = Common.LocalDevice.Current.GetDeviceMacName(listNewDevice[0]); - if (btnNote.Text.Trim() == string.Empty) + if (btnNote.Text == string.Empty) { btnNote.Text = oldName; } - if (oldName != btnNote.Text.Trim()) + if (oldName != btnNote.Text) { //淇敼鍚嶅瓧 - this.DeviceReName(btnNote.Text.Trim(), false); + this.DeviceReName(btnNote.Text, false); } }; @@ -137,9 +128,6 @@ { foreach (var device in this.listNewDevice) { - //淇濆瓨杩欎釜璁惧灞炰簬鍝釜鍖哄煙 - device.DeviceRoomId = roomKeys; - device.ReSave(); var room = Room.CurrentRoom.GetRoomByDevice(device); string mainKeys = LocalDevice.Current.GetDeviceMainKeys(device); if (room == null) @@ -154,6 +142,8 @@ Room.CurrentRoom.ChangedRoom(device, roomKeys); } } + //淇濆瓨璁惧鎴块棿绱㈠紩 + Common.LocalDevice.Current.SaveRealDeviceRoomId(this.listNewDevice, roomKeys); }; //娣诲姞鍏ㄩ儴鑿滃崟 @@ -210,6 +200,11 @@ this.AddDoorLocksTimeRow(); } } + else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.AirConditioner_ZbGateway) + { + //娣诲姞銆愬鍐呮満璁剧疆銆戣(绌鸿皟涓撶敤) + this.AddIndoorUnitSettionRow(); + } else { //娣诲姞銆愮粦瀹氱洰鏍囥�戣(pir浼犳劅鍣ㄤ笓鐢�) @@ -257,13 +252,54 @@ //搴曠嚎 btnRow.AddBottomLine(); var doorLock = this.listNewDevice[0] as ZigBee.Device.DoorLock; - btnRow.ButtonClickEvent += (sender, e) => - { - var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock); - Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - userManagement.Show(); - }; + btnRow.ButtonClickEvent += async (sender, e) => + { + if (UserCenterResourse.UserInfo.AuthorityNo == 1) + { + Action action = null; + Action actionNone = null; + action = () => + { + var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock); + Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + userManagement.Show(); + }; + actionNone = () => + { + Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock, action); + }; + HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone); + } + else + { + CommonPage.Loading.Start(""); + var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid); + if (result == false) + { + Action action = null; + Action actionNone = null; + action = () => + { + var userManagement = new Shared.Phone.UserCenter.DoorLock.UserManagement(doorLock); + Shared.Phone.UserView.HomePage.Instance.AddChidren(userManagement); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + userManagement.Show(); + }; + actionNone = () => + { + Shared.Phone.UserCenter.DoorLock.DoorLockCommonLayout.SecurityRequest(doorLock, action); + }; + HdlCheckLogic.Current.CheckSecondarySecurity(action, actionNone); + + } + else + { + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AccountIsFreezed)); + } + CommonPage.Loading.Hide(); + } + }; } } @@ -289,24 +325,56 @@ var btnswitch = btnRow.AddMostRightSwitchIcon(); //搴曠嚎 btnRow.AddBottomLine(); - if (string.IsNullOrEmpty(ZigBee.Device.DoorLock.RemoteUnlockPassword) == false) + + var doorLock = (ZigBee.Device.DoorLock)listNewDevice[0]; + if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword) == false) { btnswitch.IsSelected = true; } - var doorLock= (ZigBee.Device.DoorLock)listNewDevice[0]; - btnswitch.ButtonClickEvent += (sender, e) => - { - if (btnswitch.IsSelected == true) - { - btnswitch.IsSelected = false; - ZigBee.Device.DoorLock.RemoteUnlockPassword = string.Empty; - return; - } - var frame = new DoorLock.DoorLockCommonLayout(); - frame.RemotePasswordDialog((ZigBee.Device.DoorLock)listNewDevice[0], btnswitch.btnIcon); - frame = null; - }; + btnswitch.ButtonClickEvent += async (sender, e) => + { + if (UserCenterResourse.UserInfo.AuthorityNo == 1) + { + if (btnswitch.IsSelected == true) + { + btnswitch.IsSelected = false; + doorLock.RemoteUnlockPassword = string.Empty; + return; + } + var frame = new DoorLock.DoorLockCommonLayout(); + frame.RemotePasswordDialog((ZigBee.Device.DoorLock)listNewDevice[0], btnswitch.btnIcon); + frame = null; + } + else + { + var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid); + if (result == false) + { + var result1 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockUnlockAccess(doorLock, Shared.Common.Config.Instance.Guid); + if (result1 == true) + { + if (btnswitch.IsSelected == true) + { + btnswitch.IsSelected = false; + doorLock.RemoteUnlockPassword = string.Empty; + return; + } + var frame = new DoorLock.DoorLockCommonLayout(); + frame.RemotePasswordDialog((ZigBee.Device.DoorLock)listNewDevice[0], btnswitch.btnIcon); + frame = null; + } + else + { + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NoAccess)); + } + } + else + { + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AccountIsFreezed)); + } + } + }; } } @@ -332,13 +400,31 @@ //搴曠嚎 btnRow.AddBottomLine(); var doorLock = this.listNewDevice[0] as ZigBee.Device.DoorLock; - btnRow.ButtonClickEvent += (sender, e) => - { - var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "DoorLockTime"); - Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - tempPage.Show(); - }; + btnRow.ButtonClickEvent += async (sender, e) => + { + if (UserCenterResourse.UserInfo.AuthorityNo == 1) + { + var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "DoorLockTime"); + Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + tempPage.Show(); + } + else + { + var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid); + if (result == false) + { + var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "DoorLockTime"); + Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); + Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + tempPage.Show(); + } + else + { + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.AccountIsFreezed)); + } + } + }; } } @@ -447,6 +533,12 @@ /// </summary> private void AddFunctionSettionRow() { + //鍙湁鍥炶矾鏁板ぇ浜�1鎵嶈兘鏈夎繖涓彍鍗� + if (Common.LocalDevice.Current.GetDevicesCountByMac(listNewDevice[0].DeviceAddr) == 1) + { + return; + } + //鍔熻兘璁剧疆 string caption = Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp); var btnFunction = new FrameRowControl(listview.rowSpace / 2); @@ -539,6 +631,7 @@ //鎵嬫媺鎺у埗 string caption = Language.StringByID(R.MyInternationalizationString.uHandPullControl); var btnFunction = new FrameRowControl(listview.rowSpace / 2); + btnFunction.UseClickStatu = false; listview.AddChidren(btnFunction); btnFunction.AddLeftCaption(caption, 600); //寮�鍏冲浘鏍� @@ -557,7 +650,7 @@ //娣诲姞灞炴�т笂鎶ョ洃鍚� string mainkeys = LocalDevice.Current.GetDeviceMainKeys(this.listNewDevice[0]); - HdlDeviceAttributeLogic.Current.AddAttributeEvent("HandPullControl", "DeviceStatusReport", (device) => + HdlGatewayReceiveLogic.Current.AddAttributeEvent("HandPullControl", ReceiveComandDiv.A璁惧灞炴�т笂鎶�, (device) => { string checkKey = LocalDevice.Current.GetDeviceMainKeys(device); if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258) @@ -581,6 +674,35 @@ } #endregion; + + #region 鈻� 瀹ゅ唴鏈鸿缃�(绌鸿皟)___________________ + + /// <summary> + /// 娣诲姞銆愬鍐呮満璁剧疆銆戣(绌鸿皟涓撶敤) + /// </summary> + private void AddIndoorUnitSettionRow() + { + if (this.deviceEnumInfo.ConcreteType != DeviceConcreteType.AirConditioner_ZbGateway) + { + return; + } + //瀹ゅ唴鏈鸿缃� + string caption = Language.StringByID(R.MyInternationalizationString.uIndoorUnitSettion); + var btnFunction = new FrameRowControl(listview.rowSpace / 2); + listview.AddChidren(btnFunction); + btnFunction.AddLeftCaption(caption, 600); + //鍚戝彸鍥炬爣 + btnFunction.AddRightArrow(); + //搴曠嚎 + btnFunction.AddBottomLine(); + btnFunction.ButtonClickEvent += (sender, e) => + { + var form = new DeviceAirConditioner.IndoorUnitListForm(); + form.AddForm(listNewDevice[0].DeviceAddr); + }; + } + + #endregion #region 鈻� 閫氱敤淇℃伅___________________________ @@ -635,7 +757,7 @@ btnNewVersion.UnSelectedImagePath = "Item/NewVersion.png"; btnNewVersion.Visible = false; btnNewVersion.X = Application.GetRealWidth(242); - btnNewVersion.Y= Application.GetRealHeight(23); + btnNewVersion.Y = Application.GetRealHeight(23); rowUpDate.AddChidren(btnNewVersion, ChidrenBindMode.BindEventOnly); rowUpDate.ButtonClickEvent += (sender, e) => @@ -705,7 +827,7 @@ /// 璁惧閲嶅懡鍚� /// </summary> /// <param name="i_deviceName">deviceName.</param> - private async void DeviceReName(string i_deviceName,bool closeForm) + private async void DeviceReName(string i_deviceName, bool closeForm) { //寮�鍚繘搴︽潯 this.ShowProgressBar(); @@ -798,23 +920,14 @@ /// </summary> private async void DoDeleteDevice() { - //寮�鍚繘搴︽潯 - this.ShowProgressBar(); //鍒犻櫎璁惧 bool result = await Common.LocalDevice.Current.DeleteDevice(listNewDevice); - - this.CloseProgressBar(); - if (result == false) { return; } - - Application.RunOnMainThread(() => - { - //鍏抽棴鐣岄潰 - this.CloseForm(); - }); + //鍏抽棴鐣岄潰 + this.CloseForm(); } #endregion @@ -823,13 +936,13 @@ /// <summary> /// 鐢婚潰鍏抽棴 /// </summary> - public override void CloseForm() + public override void CloseFormBefore() { - HdlDeviceAttributeLogic.Current.RemoveEvent("HandPullControl"); + HdlGatewayReceiveLogic.Current.RemoveEvent("HandPullControl"); //绉婚櫎鑾峰彇璁惧纭欢淇℃伅鐨勭洃鍚嚎绋� HdlDeviceHardInfoLogic.Current.RemoveDeviceHardInfoThread(listNewDevice[0]); - base.CloseForm(); + base.CloseFormBefore(); } #endregion -- Gitblit v1.8.0