| | |
| | | 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)
|
| | |
| | | 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);
|
| | | }
|
| | | };
|
| | |
|
| | |
| | | {
|
| | | 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)
|
| | |
| | | Room.CurrentRoom.ChangedRoom(device, roomKeys);
|
| | | }
|
| | | }
|
| | | //保存设备房间索引
|
| | | Common.LocalDevice.Current.SaveRealDeviceRoomId(this.listNewDevice, roomKeys);
|
| | | };
|
| | |
|
| | | //添加全部菜单
|
| | |
| | | this.AddDoorLocksTimeRow();
|
| | | }
|
| | | }
|
| | | else if (deviceEnumInfo.ConcreteType == DeviceConcreteType.AirConditioner_ZbGateway)
|
| | | {
|
| | | //添加【室内机设置】行(空调专用)
|
| | | this.AddIndoorUnitSettionRow();
|
| | | }
|
| | | else
|
| | | {
|
| | | //添加【绑定目标】行(pir传感器专用)
|
| | |
| | | //底线
|
| | | 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();
|
| | | }
|
| | | };
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | 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));
|
| | | }
|
| | | }
|
| | | };
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | //底线
|
| | | 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));
|
| | | }
|
| | | }
|
| | | };
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | /// </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);
|
| | |
| | | //手拉控制
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uHandPullControl);
|
| | | var btnFunction = new FrameRowControl(listview.rowSpace / 2);
|
| | | btnFunction.UseClickStatu = false;
|
| | | listview.AddChidren(btnFunction);
|
| | | btnFunction.AddLeftCaption(caption, 600);
|
| | | //开关图标
|
| | |
| | |
|
| | | //添加属性上报监听
|
| | | 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)
|
| | |
| | | }
|
| | |
|
| | | #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 ■ 通用信息___________________________
|
| | |
|
| | |
| | | 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) =>
|
| | |
| | | /// 设备重命名
|
| | | /// </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();
|
| | |
| | | /// </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
|
| | |
|
| | |
| | | /// <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
|