| | |
| | | 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)
|
| | |
| | | this.listview = tableContr.InitControl(bodyFrameLayout, Language.StringByID(R.MyInternationalizationString.uInfoEditor), 369, 1368);
|
| | |
|
| | | //图片
|
| | | var btnPic = new DeviceInfoIconControl(listNewDevice[0]);
|
| | | var btnPic = new DeviceInfoIconControl();
|
| | | btnPic.Y = Application.GetRealHeight(92);
|
| | | btnPic.Gravity = Gravity.CenterHorizontal;
|
| | | bodyFrameLayout.AddChidren(btnPic);
|
| | | btnPic.InitControl();
|
| | | btnPic.InitControl(listNewDevice[0]);
|
| | |
|
| | | //设备备注
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uDeviceNote);
|
| | |
| | | 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传感器专用)
|
| | | this.AddPirSensorBindRow();
|
| | | //添加【方向与限位】行(开合帘,卷帘专用)
|
| | | this.AddDirectionAndLimitRow();
|
| | | //添加【手拉控制】行(开合帘专用)
|
| | | this.AddHandPullControlRow();
|
| | | //添加【按键设置】行(面板专用)
|
| | | this.AddPanelSettionRow();
|
| | | //添加【功能设置】行
|
| | |
| | | btnRow.AddRightArrow();
|
| | | //底线
|
| | | btnRow.AddBottomLine();
|
| | | btnRow.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | };
|
| | | var doorLock = this.listNewDevice[0] as ZigBee.Device.DoorLock;
|
| | | 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();
|
| | | }
|
| | | };
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | //底线
|
| | | btnRow.AddBottomLine();
|
| | |
|
| | | btnswitch.ButtonClickEvent += (sender, e) =>
|
| | | var doorLock = (ZigBee.Device.DoorLock)listNewDevice[0];
|
| | | if (string.IsNullOrEmpty(doorLock.RemoteUnlockPassword) == false)
|
| | | {
|
| | | btnswitch.IsSelected = !btnswitch.IsSelected;
|
| | | };
|
| | | btnswitch.IsSelected = true;
|
| | | }
|
| | |
|
| | | 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.AddRightArrow();
|
| | | //底线
|
| | | btnRow.AddBottomLine();
|
| | | btnRow.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | };
|
| | | var doorLock = this.listNewDevice[0] as ZigBee.Device.DoorLock;
|
| | | 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));
|
| | | }
|
| | | }
|
| | | };
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | btnFunction.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new DevicePanel.PanelButtonSettionForm();
|
| | | form.AddForm(listNewDevice[0].DeviceAddr);
|
| | | form.AddForm(listNewDevice[0]);
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 功能设置(通用)_____________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加【功能设置】行
|
| | | /// </summary>
|
| | | private void AddFunctionSettionRow()
|
| | | {
|
| | | //功能设置
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uFunctionSettingUp);
|
| | | var btnFunction = new FrameRowControl(listview.rowSpace / 2);
|
| | | listview.AddChidren(btnFunction);
|
| | | btnFunction.AddLeftCaption(caption, 600);
|
| | | //向右图标
|
| | | btnFunction.AddRightArrow();
|
| | | //底线
|
| | | btnFunction.AddBottomLine();
|
| | | btnFunction.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //河东的面板设备
|
| | | if (deviceEnumInfo.BeloneType == DeviceBeloneType.A按键面板 && deviceEnumInfo.IsHdlDevice == true)
|
| | | {
|
| | | var form = new DevicePanel.PanelFunctionSettionForm();
|
| | | form.AddForm(listNewDevice[0].DeviceAddr);
|
| | | }
|
| | | else
|
| | | {
|
| | | var form = new DeviceRelay.DeviceFunctionSettionForm();
|
| | | form.AddForm(listNewDevice[0].DeviceAddr);
|
| | | }
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion;
|
| | |
|
| | | #region ■ 干接点设置(干接点)_________________
|
| | |
|
| | |
| | | btnBackLight.AddBottomLine();
|
| | | btnBackLight.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var form = new DeviceRelay.DeviceDryContactSettionForm();
|
| | | var form = new DeviceDryContactSettionForm();
|
| | | form.AddForm(listNewDevice[0]);
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 绑定目标(pir传感器专用)____________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加【绑定目标】行(pir传感器专用)
|
| | | /// </summary>
|
| | | private void AddPirSensorBindRow()
|
| | | {
|
| | | if (this.deviceEnumInfo.ConcreteType != DeviceConcreteType.Sensor_Pir)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //绑定目标
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uBindTargets);
|
| | | 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 DevicePirSensor.PirSensorBindTargetSettionForm();
|
| | | form.AddForm((IASZone)this.listNewDevice[0]);
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion;
|
| | |
|
| | | #region ■ 功能设置(通用)_____________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加【功能设置】行
|
| | | /// </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);
|
| | | listview.AddChidren(btnFunction);
|
| | | btnFunction.AddLeftCaption(caption, 600);
|
| | | //向右图标
|
| | | btnFunction.AddRightArrow();
|
| | | //底线
|
| | | btnFunction.AddBottomLine();
|
| | | btnFunction.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //河东的面板设备
|
| | | if (deviceEnumInfo.BeloneType == DeviceBeloneType.A按键面板 && deviceEnumInfo.IsHdlDevice == true)
|
| | | {
|
| | | var form = new DevicePanel.PanelFunctionSettionForm();
|
| | | form.AddForm(listNewDevice[0]);
|
| | | }
|
| | | else
|
| | | {
|
| | | var form = new DeviceFunctionSettionForm();
|
| | | form.AddForm(listNewDevice[0], false);
|
| | | }
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion;
|
| | |
|
| | | #region ■ 方向与限位(窗帘)___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加【方向与限位】行(窗帘专用)
|
| | | /// </summary>
|
| | | private void AddDirectionAndLimitRow()
|
| | | {
|
| | | if (deviceEnumInfo.BeloneType != DeviceBeloneType.A窗帘)
|
| | | {
|
| | | return;
|
| | | }
|
| | | var deviceCurtain = (Rollershade)this.listNewDevice[0];
|
| | | if (deviceCurtain.WcdType != 4 && deviceCurtain.WcdType != 0)
|
| | | {
|
| | | //开合帘,卷帘专用
|
| | | return;
|
| | | }
|
| | |
|
| | | //方向与限位
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uDirectionAndLimit);
|
| | | var btnFunction = new FrameRowControl(listview.rowSpace / 2);
|
| | | listview.AddChidren(btnFunction);
|
| | | btnFunction.AddLeftCaption(caption, 600);
|
| | | //向右图标
|
| | | btnFunction.AddRightArrow();
|
| | | //底线
|
| | | btnFunction.AddBottomLine();
|
| | | btnFunction.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (deviceCurtain.WcdType == 4)
|
| | | {
|
| | | var form = new DeviceCurtain.AutoOpenDirectionAndLimitSettionForm();
|
| | | form.AddForm(deviceCurtain);
|
| | | }
|
| | | else if (deviceCurtain.WcdType == 0)
|
| | | {
|
| | | var form = new DeviceCurtain.SiphonateDirectionAndLimitSettionForm();
|
| | | form.AddForm(deviceCurtain);
|
| | | }
|
| | | };
|
| | | }
|
| | |
|
| | | #endregion;
|
| | |
|
| | | #region ■ 手拉控制(开合帘)___________________
|
| | |
|
| | | /// <summary>
|
| | | /// 添加【手拉控制】行(开合帘专用)
|
| | | /// </summary>
|
| | | private void AddHandPullControlRow()
|
| | | {
|
| | | if (deviceEnumInfo.BeloneType != DeviceBeloneType.A窗帘)
|
| | | {
|
| | | return;
|
| | | }
|
| | | var deviceCurtain = (Rollershade)this.listNewDevice[0];
|
| | | if (deviceCurtain.WcdType != 4)
|
| | | {
|
| | | //开合帘专用
|
| | | return;
|
| | | }
|
| | |
|
| | | //手拉控制
|
| | | string caption = Language.StringByID(R.MyInternationalizationString.uHandPullControl);
|
| | | var btnFunction = new FrameRowControl(listview.rowSpace / 2);
|
| | | btnFunction.UseClickStatu = false;
|
| | | listview.AddChidren(btnFunction);
|
| | | btnFunction.AddLeftCaption(caption, 600);
|
| | | //开关图标
|
| | | var btnSwitch = btnFunction.AddMostRightSwitchIcon();
|
| | | //底线
|
| | | btnFunction.AddBottomLine();
|
| | | btnSwitch.ButtonClickEvent += async (sender, e) =>
|
| | | {
|
| | | //切换模式
|
| | | var result = await HdlDeviceCurtainLogic.Current.SetHandPullControl(deviceCurtain, !btnSwitch.IsSelected);
|
| | | if (result == true)
|
| | | {
|
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected;
|
| | | }
|
| | | };
|
| | |
|
| | | //添加属性上报监听
|
| | | string mainkeys = LocalDevice.Current.GetDeviceMainKeys(this.listNewDevice[0]);
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("HandPullControl", ReceiveComandDiv.A设备属性上报, (device) =>
|
| | | {
|
| | | string checkKey = LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | if (mainkeys != checkKey || device.DeviceStatusReport.CluterID != 258)
|
| | | {
|
| | | return;
|
| | | }
|
| | | foreach (var attriBute in device.DeviceStatusReport.AttriBute)
|
| | | {
|
| | | if (attriBute.AttributeId == 23)
|
| | | {
|
| | | //手拉控制
|
| | | if (0 < (attriBute.AttriButeData & 0x04))
|
| | | {
|
| | | btnSwitch.IsSelected = true;
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | //发送命令
|
| | | deviceCurtain.ReadCurtainDirectionAndMode();
|
| | | }
|
| | |
|
| | | #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);
|
| | | };
|
| | | }
|
| | |
| | | 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();
|
| | |
| | | {
|
| | | menuCount = 2;
|
| | | }
|
| | | var frame = new TopRightMenuControl(this, menuCount);
|
| | | var frame = new TopRightMenuControl(menuCount);
|
| | | if (canTest == true)
|
| | | {
|
| | | //定位
|
| | |
| | | /// </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()
|
| | | {
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("HandPullControl");
|
| | | //移除获取设备硬件信息的监听线程
|
| | | HdlDeviceHardInfoLogic.Current.RemoveDeviceHardInfoThread(listNewDevice[0]);
|
| | |
|
| | | base.CloseForm();
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | | #endregion
|