| | |
| | | /// </summary> |
| | | /// <param name="room"></param> |
| | | /// <param name="doorLock"></param> |
| | | public UserDoorLockPage(Shared.Common.Room room, CommonDevice doorLock) |
| | | public UserDoorLockPage(Room room, CommonDevice doorLock) |
| | | { |
| | | //徐梅的门锁界面打开(网关全局接收时使用) |
| | | //ControlCommonResourse.IsDoorLockPageOpen = true; |
| | | this.doorLock = doorLock as ZigBee.Device.DoorLock; |
| | | currentRoom = room; |
| | | deviceUI = doorLock; |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; |
| | | BackgroundColor = ZigbeeColor.Current.GXCTopViewBackgroundColor; |
| | | ZbGateway.StatusList.Add(this); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction += (DoorlockKey, status) => |
| | | { |
| | | var key = doorLock.DeviceAddr; |
| | | if (DoorlockKey == key) |
| | | { |
| | | DoorLockCommonInfo.NormallyOpenModeValue(this.doorLock, status); |
| | | UpdateNomallyOpenStatus(); |
| | | } |
| | | }; |
| | | }); |
| | | } |
| | | |
| | | #region 变量申明 |
| | | /// <summary> |
| | | /// IsDrawerLockMode |
| | | /// </summary> |
| | | public bool IsDrawerLockMode; |
| | | /// <summary>
|
| | | /// 当前门锁 |
| | | /// </summary> |
| | | ZigBee.Device.DoorLock doorLock; |
| | |
| | | /// </summary> |
| | | DateTime waitGetDoorLockPower = DateTime.MaxValue; |
| | | /// <summary> |
| | | /// 逻辑中是否有常开模式
|
| | | /// 逻辑中是否有常开模式 |
| | | /// </summary> |
| | | private bool HaveLogicNormallyOpenMode = false;
|
| | | private bool haveLogicNormallyOpenMode = false; |
| | | |
| | | /// <summary> |
| | | /// 当前电量 |
| | | /// </summary> |
| | | bool canVolume = false; |
| | | /// <summary> |
| | | /// 保留上一次音量 |
| | | /// 是否支持常开 |
| | | /// </summary> |
| | | bool canOpenNormallyMode = false; |
| | | /// <summary> |
| | | /// IsDrawerLockMode[主页左滑] |
| | | /// </summary> |
| | | public bool IsDrawerLockMode; |
| | | /// <summary> |
| | | /// 当前电量 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 中部布局中门锁名称显示 |
| | | /// </summary> |
| | | Button btnDoorLockTitle; |
| | | NormalViewControl btnDoorLockTitle; |
| | | /// <summary> |
| | | /// 分享 |
| | | /// </summary> |
| | |
| | | /// 设置FrameLayout |
| | | /// </summary> |
| | | FrameLayout btnFuncSetFrameLayout; |
| | | FrameLayout progressFrameLayoutMatch; |
| | | /// <summary> |
| | | /// 点击开布局 |
| | | /// </summary> |
| | |
| | | /// 当前音量 |
| | | /// </summary> |
| | | int currentVolume = -1; |
| | | /// <summary> |
| | | /// waitClickTime |
| | | /// </summary> |
| | | DateTime waitClickTime = DateTime.MaxValue; |
| | | /// <summary> |
| | | /// IsClick |
| | | /// </summary> |
| | | bool IsClick = true; |
| | | #endregion |
| | | |
| | | /// <summary>
|
| | | /// UI显示 |
| | | /// <summary> |
| | | /// UI显示 |
| | | /// </summary> |
| | | public void Show() |
| | | {
|
| | | { |
| | | this.TopFrameLayout(this, ""); |
| | | this.MidFrameLayout(this); |
| | | |
| | |
| | | btnFuncSet = new Button |
| | | { |
| | | X = Application.GetRealWidth(103), |
| | | Height = Application.GetRealHeight(69), |
| | | Width = Application.GetRealWidth(69), |
| | | Height = Application.GetMinReal(69), |
| | | Width = Application.GetMinReal(69), |
| | | UnSelectedImagePath = "DoorLock/SettingIcon.png", |
| | | }; |
| | | btnFuncSetFrameLayout.AddChidren(btnFuncSet); |
| | |
| | | |
| | | ClickHandle(); |
| | | |
| | | if (doorLock.IsOnline == 1) |
| | | if (HdlDeviceCommonLogic.Current.CheckDeviceIsOnline(doorLock) == true) |
| | | { |
| | | ReadDoorLockUserInfo(); |
| | | } |
| | | else |
| | | { |
| | | string msg1 = Language.StringByID(R.MyInternationalizationString.DoorLockOffLine); |
| | | this.ShowTipMsg(msg1); |
| | | return; |
| | | } |
| | | } |
| | | |
| | |
| | | }; |
| | | this.midFrameLayout.AddChidren(midTopFrameLayout); |
| | | |
| | | //门锁标题 |
| | | btnDoorLockTitle = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(250), |
| | | Height = Application.GetRealHeight(60), |
| | | X = Application.GetRealWidth(372), |
| | | Y = Application.GetRealHeight(46), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextSize = 15, |
| | | TextAlignment = TextAlignment.Center, |
| | | IsBold = true, |
| | | }; |
| | | //设备名称 |
| | | btnDoorLockTitle = new NormalViewControl(100, 60, true); |
| | | btnDoorLockTitle.Y = Application.GetRealHeight(46); |
| | | btnDoorLockTitle.TextSize = 15; |
| | | btnDoorLockTitle.IsBold = true; |
| | | btnDoorLockTitle.Text = HdlDeviceCommonLogic.Current.GetDeviceMacName(doorLock); |
| | | btnDoorLockTitle.Width = btnDoorLockTitle.GetRealWidthByText(); |
| | | btnDoorLockTitle.TextAlignment = TextAlignment.Center; |
| | | btnDoorLockTitle.Gravity = Gravity.CenterHorizontal; |
| | | midTopFrameLayout.AddChidren(btnDoorLockTitle); |
| | | |
| | | //记录 |
| | |
| | | midTopFrameLayout.AddChidren(btnRecordFrameLayout); |
| | | btnRecord = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(69), |
| | | Height = Application.GetRealHeight(69), |
| | | Width = Application.GetMinReal(69), |
| | | Height = Application.GetMinReal(69), |
| | | X = Application.GetRealWidth(46), |
| | | Y = Application.GetRealHeight(46), |
| | | UnSelectedImagePath = "DoorLock/RecordIcon.png", |
| | |
| | | midTopFrameLayout.AddChidren(btnCollectFrameLayout); |
| | | btnCollect = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(69), |
| | | Height = Application.GetRealHeight(69), |
| | | Width = Application.GetMinReal(69), |
| | | Height = Application.GetMinReal(69), |
| | | X = Application.GetRealWidth(15), |
| | | Y = Application.GetRealHeight(46), |
| | | UnSelectedImagePath = "Item/Collection.png", |
| | | SelectedImagePath = "Item/CollectionSelected.png" |
| | | }; |
| | | btnCollectFrameLayout.AddChidren(btnCollect);
|
| | |
|
| | | //当前状态
|
| | | btnCollectFrameLayout.AddChidren(btnCollect); |
| | | |
| | | //当前状态 |
| | | btnStatus = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(132 + 351), |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | midTopFrameLayout.AddChidren(btnCurrentPowerText); |
| | | #if Android |
| | | btnCurrentPowerText.X = btnStatus.Right + Application.GetRealWidth(20); |
| | | #endif |
| | | |
| | | //门锁开/关图片 |
| | | btnDoorLockPic = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(383), |
| | | Height = Application.GetRealHeight(343), |
| | | Width = Application.GetMinReal(383), |
| | | Height = Application.GetMinReal(343), |
| | | X = Application.GetRealWidth(161), |
| | | Y = Application.GetRealHeight(415), |
| | | UnSelectedImagePath = "DoorLock/DoorLockPicClose.png", |
| | |
| | | }; |
| | | btnFrameLayout.AddChidren(closeFrameLayout); |
| | | |
| | | progressFrameLayoutMatch = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealHeight(84),//639-35 |
| | | Height = Application.GetRealHeight(446), |
| | | X = Application.GetMinReal(51), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | btnFrameLayout.AddChidren(progressFrameLayoutMatch); |
| | | |
| | | var progressFrameLayout = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(9),//639-35 |
| | | Height = Application.GetRealHeight(446), |
| | | X = Application.GetRealWidth(95), |
| | | Y = Application.GetRealHeight(0), |
| | | Width = Application.GetRealHeight(17),//639-35 |
| | | Gravity = Gravity.CenterHorizontal, |
| | | BackgroundColor = ZigbeeColor.Current.XMVerticalSeekBar, |
| | | }; |
| | | btnFrameLayout.AddChidren(progressFrameLayout); |
| | | progressFrameLayoutMatch.AddChidren(progressFrameLayout); |
| | | |
| | | progressButton = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(84),//639-35 |
| | | Height = Application.GetRealHeight(93), |
| | | X = Application.GetRealWidth(58), |
| | | Width = Application.GetMinReal(84),//639-35 |
| | | Height = Application.GetMinReal(93), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(347), |
| | | UnSelectedImagePath = "DoorLock/UnLockButton.png", |
| | | }; |
| | | btnFrameLayout.AddChidren(progressButton); |
| | | progressFrameLayoutMatch.AddChidren(progressButton); |
| | | |
| | | btnDoorOpenPic = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | Width = Application.GetMinReal(81), |
| | | Height = Application.GetMinReal(81), |
| | | X = Application.GetRealWidth(164), |
| | | Y = Application.GetRealHeight(6), |
| | | UnSelectedImagePath = "DoorLock/DoorLockOpen.png", |
| | |
| | | |
| | | btnDoorClosePic = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | Width = Application.GetMinReal(81), |
| | | Height = Application.GetMinReal(81), |
| | | X = Application.GetRealWidth(164), |
| | | Y = Application.GetRealHeight(117), |
| | | UnSelectedImagePath = "DoorLock/DoorLockClose.png", |
| | |
| | | //电量 |
| | | btnPower = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | Width = Application.GetMinReal(81), |
| | | Height = Application.GetMinReal(81), |
| | | X = Application.GetRealWidth(253), |
| | | Y = Application.GetRealHeight(994), |
| | | UnSelectedImagePath = "DoorLock/PowerOffline.png", |
| | |
| | | midTopFrameLayout.AddChidren(btnVolumeFrameLayout); |
| | | btnVolume = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | Width = Application.GetMinReal(81), |
| | | Height = Application.GetMinReal(81), |
| | | X = Application.GetRealWidth(40), |
| | | Y = Application.GetRealHeight(40), |
| | | UnSelectedImagePath = "DoorLock/VolumeIcon.png", |
| | |
| | | midTopFrameLayout.AddChidren(btnNormallyOpenFrameLayout); |
| | | btnNormallyOpen = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | Width = Application.GetMinReal(81), |
| | | Height = Application.GetMinReal(81), |
| | | X = Application.GetRealWidth(40), |
| | | Y = Application.GetRealHeight(40), |
| | | UnSelectedImagePath = "DoorLock/NormallyOpen.png", |
| | |
| | | #region 当前房间 |
| | | var btnCurrentRoomPic = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | Width = Application.GetMinReal(81), |
| | | Height = Application.GetMinReal(81), |
| | | X = Application.GetRealWidth(58), |
| | | Y = Application.GetRealHeight(29), |
| | | UnSelectedImagePath = "DoorLock/RoomPic.png", |
| | |
| | | }; |
| | | flMain.AddChidren(progressBackground); |
| | | |
| | | //var progressValue = (currentVolume * (Convert.ToInt32(((float)100 / 15) * 100))) / 100; |
| | | progressText = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(58), |
| | | Y = Application.GetRealHeight(89), |
| | | TextColor = ZigbeeColor.Current.XMGray2, |
| | | TextAlignment = TextAlignment.Center, |
| | | Text = currentVolume.ToString(), |
| | | Text = currentVolume.ToString() + "%", |
| | | }; |
| | | |
| | | diyImageVerticalSeekBar = new DiyImageVerticalSeekBar() |
| | |
| | | ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor, |
| | | ProgressTextSize = 12,//显示百分比字体大小 |
| | | SeekBarViewHeight = Application.GetRealHeight(17),//进度条的宽度 |
| | | Progress = (currentVolume * (Convert.ToInt32(((float)100 / 15) * 100))) / 100, |
| | | Progress = currentVolume, |
| | | }; |
| | | progressBackground.AddChidren(progressText); |
| | | progressBackground.AddChidren(diyImageVerticalSeekBar); |
| | | diyImageVerticalSeekBar.OnProgressChangedEvent += (sender, e) => |
| | | { |
| | | int curVolume = -1; |
| | | if (e == 0) |
| | | { |
| | | curVolume = 0; |
| | | } |
| | | else if (e == 100) |
| | | { |
| | | curVolume = 14; |
| | | } |
| | | else |
| | | { |
| | | int comandValue = e; |
| | | int comandValueTemp = (comandValue * 100) / (Convert.ToInt32(((float)100 / 15) * 100)); |
| | | curVolume = comandValueTemp; |
| | | } |
| | | curVolume = e; |
| | | currentVolume = curVolume; |
| | | progressText.Text = curVolume.ToString(); |
| | | progressText.Text = e.ToString() + "%"; |
| | | }; |
| | | } |
| | | |
| | |
| | | if (typeTag == "DoorLockProgrammingEventNotificationCommand" && tempDevice != null) |
| | | { |
| | | var tempDoor = (ZigBee.Device.DoorLock)tempDevice; |
| | | if (tempDoor.doorLockOperatingEventNotificationCommand != null) |
| | | if (tempDevice.DeviceEpoint == doorLock.DeviceEpoint |
| | | && tempDevice.DeviceAddr == doorLock.DeviceAddr) |
| | | { |
| | | Application.RunOnMainThread(() => { NomallyOpenModeInvalidDialog(true); }); |
| | | if (tempDoor.doorLockOperatingEventNotificationCommand != null) |
| | | { |
| | | //非主人不弹这个窗口 |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) |
| | | { |
| | | return; |
| | | } |
| | | if (doorLock.IsDoorLockNormallyMode) |
| | | { |
| | | if (canOpenNormallyMode) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | Action<bool> action = (obj) => |
| | | { |
| | | UpdateNomallyOpenStatus(); |
| | | }; |
| | | DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.ServicePush, haveLogicNormallyOpenMode, action); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | currentPower = dataReport.AttriButeData; |
| | | waitGetDoorLockPower = DateTime.MaxValue; |
| | | UpdatePower(); |
| | | }); |
| | | } |
| | |
| | | { |
| | | CommonPage.Loading.Start(""); |
| | | }); |
| | | |
| | | //是否支持常开 |
| | | canOpenNormallyMode = DoorLockCommonInfo.CanNormallyOpen(doorLock); |
| | | if (canOpenNormallyMode) |
| | | { |
| | | //1、获取门锁常开模式 |
| | | var resultRes = await DoorLockCommonInfo.GetNormallyOpenMode(doorLock); |
| | | if (resultRes == null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnNormallyOpen.UnSelectedImagePath = "DoorLock/NormallyOpenOffline.png"; |
| | | btnNormallyOpen.Enable = false; |
| | | string msg = Language.StringByID(R.MyInternationalizationString.GetNormallyOpenModeFailed); |
| | | this.ShowTipMsg(msg); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | var tempRes = false; |
| | | if (resultRes == true) |
| | | { |
| | | tempRes = true; |
| | | } |
| | | else |
| | | { |
| | | tempRes = false; |
| | | } |
| | | DoorLockCommonInfo.NormallyOpenModeValue(doorLock, tempRes); |
| | | |
| | | Application.RunOnMainThread(async () => |
| | | { |
| | | var resTemp = await Shared.Phone.Device.Logic.SkipView.Exist(2, doorLock); |
| | | if (resTemp == 0) |
| | | { |
| | | haveLogicNormallyOpenMode = false; |
| | | } |
| | | else |
| | | { |
| | | haveLogicNormallyOpenMode = true; |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnNormallyOpenFrameLayout.Width = Application.GetRealWidth(0); |
| | | }); |
| | | } |
| | | |
| | | //是否支持音量 |
| | | canVolume = DoorLockCommonInfo.CanVolume(doorLock); |
| | | //读取门锁电量:簇ID:1 属性ID 33 |
| | | if (canVolume) |
| | | { |
| | | //2、读取音量 |
| | | var resultRes = await doorLock.GetVolumeAsync(); |
| | | if (resultRes == null || resultRes.volumeResponseData == null) |
| | | { |
| | | var listDevice = new List<CommonDevice> { }; |
| | | listDevice.Add(doorLock); |
| | | var devTemp = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(listDevice); |
| | | if (devTemp.ConcreteType == DeviceConcreteType.IntelligentLocks_Sone) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var volumeMsg = Language.StringByID(R.MyInternationalizationString.GetVolumeFailed); |
| | | this.ShowTipMsg(volumeMsg); |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | volumeData = resultRes.volumeResponseData; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | UpdateVolume(); |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnVolumeFrameLayout.Width = Application.GetRealWidth(0); |
| | | btnPower.X = Application.GetRealWidth(444); |
| | | }); |
| | | } |
| | | |
| | | //3、读取门锁电量:簇ID:1 属性ID 33 |
| | | doorLock.ReadAttri(Cluster_ID.Power, AttriButeId.DoorLockPower); |
| | | //上报电量等1秒 |
| | | System.Threading.Thread.Sleep(1000); |
| | | //获取门锁常开模式 |
| | | await DoorLockCommonInfo.GetNormallyOpenMode(doorLock); |
| | | //读取音量 |
| | | ReadVolume(); |
| | | } |
| | | catch { } |
| | | catch (Exception ex) |
| | | { |
| | | var mess = ex.Message; |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | |
| | | public void ClickHandle() |
| | | { |
| | | //门锁标题 |
| | | btnDoorLockTitle.Text = Common.LocalDevice.Current.GetDeviceMacName(doorLock); |
| | | btnDoorLockTitle.Text = HdlDeviceCommonLogic.Current.GetDeviceMacName(doorLock); |
| | | |
| | | //返回 |
| | | EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => |
| | |
| | | //设置 |
| | | EventHandler<MouseEventArgs> btnFuncSetHander = (sender, e) => |
| | | { |
| | | var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(doorLock); |
| | | var functionSetting = new Shared.Phone.UserCenter.DoorLock.FunctionSetting(currentRoom, doorLock); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(functionSetting); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | functionSetting.Show(); |
| | | //DoorLockCommonInfo.canShowDialog = false; |
| | | functionSetting.devicNameAction += (deviceRename) => |
| | | { |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | |
| | | //历史记录 ---- stan |
| | | var form = new DeviceDoorLock.DoorLockHistoryLogForm(); |
| | | form.AddForm(this.doorLock.DeviceAddr); |
| | | //DoorLockCommonInfo.canShowDialog = false; |
| | | }; |
| | | btnRecordFrameLayout.MouseDownEventHandler += handerRecord; |
| | | btnRecord.MouseDownEventHandler += handerRecord; |
| | |
| | | btnCollect.IsSelected = !btnCollect.IsSelected; |
| | | if (btnCollect.IsSelected) |
| | | { |
| | | HdlRoomLogic.Current.AddLoveDevice(deviceUI);//收藏 |
| | | //Test |
| | | HaveLogicNormallyOpenMode = true; |
| | | HdlRoomLogic.Current.AddLoveDevice(deviceUI);//收藏 |
| | | } |
| | | else |
| | | { |
| | | HdlRoomLogic.Current.DeleteLoveDevice(deviceUI);//取消收藏 |
| | | //Test |
| | | HaveLogicNormallyOpenMode = false; |
| | | HdlRoomLogic.Current.DeleteLoveDevice(deviceUI);//取消收藏 |
| | | } |
| | | }; |
| | | btnCollectFrameLayout.MouseDownEventHandler += handerCollect; |
| | |
| | | //开锁事件 |
| | | EventHandler<MouseEventArgs> hander1 = async (sender, e) => |
| | | { |
| | | if (DoorLockCommonInfo.IsDoorLockNormallyMode == true) |
| | | if (doorLock.IsDoorLockNormallyMode) |
| | | { |
| | | string msg0 = Language.StringByID(R.MyInternationalizationString.CurrentNormallyOpenMode); |
| | | this.ShowTipMsg(msg0); |
| | | if (canOpenNormallyMode) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | Action<bool> action = (obj) => |
| | | { |
| | | UpdateNomallyOpenStatus(); |
| | | }; |
| | | DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.AppOperate, haveLogicNormallyOpenMode, action); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | OpenDoorLockHandle(progressButton, btnDoorLockPic, btnStatus); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | }; |
| | | openFrameLayout.MouseUpEventHandler += hander1; |
| | | btnDoorOpenPic.MouseUpEventHandler += hander1; |
| | | if (progressButton.Y == Application.GetRealHeight(10)) |
| | | { |
| | | progressFrameLayoutMatch.MouseUpEventHandler += hander1; |
| | | } |
| | | |
| | | //关锁事件 |
| | | EventHandler<MouseEventArgs> hander2 = (sender, e) => |
| | | { |
| | | if (DoorLockCommonInfo.IsDoorLockNormallyMode == true) |
| | | if (canOpenNormallyMode) |
| | | { |
| | | NomallyOpenModeInvalidDialog(); |
| | | if (doorLock.IsDoorLockNormallyMode) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | Action<bool> action = (obj) => |
| | | { |
| | | UpdateNomallyOpenStatus(); |
| | | }; |
| | | DoorLockCommonInfo.NomallyOpenModeInvalidDialog(doorLock, DoorLockCommonInfo.DoorLockMessType.AppOperate, haveLogicNormallyOpenMode, action); |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | VolumeDialog(progressText, diyImageVerticalSeekBar); |
| | | } |
| | | else |
| | | { |
| | | var volumeMsg = Language.StringByID(R.MyInternationalizationString.NoSupport); |
| | | this.ShowTipMsg(volumeMsg); |
| | | } |
| | | }; |
| | | btnVolumeFrameLayout.MouseDownEventHandler += handerVolume; |
| | | btnVolume.MouseDownEventHandler += handerVolume; |
| | |
| | | //常开模式点击事件 |
| | | EventHandler<MouseEventArgs> handerNormallyOpen = (sender, e) => |
| | | { |
| | | if (canOpenNormallyMode) |
| | | { |
| | | btnNormallyOpen.IsSelected = !btnNormallyOpen.IsSelected; |
| | | NomallyOpenDialog(); |
| | | } |
| | | else |
| | | { |
| | | var volumeMsg = Language.StringByID(R.MyInternationalizationString.NoSupport); |
| | | this.ShowTipMsg(volumeMsg); |
| | | } |
| | | NomallyOpenDialog(); |
| | | }; |
| | | btnNormallyOpenFrameLayout.MouseUpEventHandler += handerNormallyOpen; |
| | | btnNormallyOpen.MouseUpEventHandler += handerNormallyOpen; |
| | |
| | | { |
| | | btnPower.UnSelectedImagePath = "DoorLock/Power40.png"; |
| | | } |
| | | else if (currentPower <= 60 && currentPower > 40 || currentPower == 60) |
| | | else if (currentPower <= 60 && currentPower > 40) |
| | | { |
| | | btnPower.UnSelectedImagePath = "DoorLock/Power60.png"; |
| | | } |
| | | else if (currentPower <= 80 && currentPower >= 60) |
| | | else if (currentPower <= 80 && currentPower > 60) |
| | | { |
| | | btnPower.UnSelectedImagePath = "DoorLock/Power80.png"; |
| | | } |
| | | else if (currentPower <= 100 && currentPower >= 80) |
| | | else if (currentPower <= 100 && currentPower > 80) |
| | | { |
| | | btnPower.UnSelectedImagePath = "DoorLock/Power100.png"; |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 音量 |
| | | /// <summary> |
| | | /// 读取音量 |
| | | /// </summary> |
| | | private async void ReadVolume() |
| | | { |
| | | //获取门锁音量 |
| | | if (!canVolume) |
| | | { |
| | | return; |
| | | } |
| | | var resultRes = await doorLock.GetVolumeAsync(); |
| | | |
| | | if (resultRes == null || resultRes.volumeResponseData == null) |
| | | { |
| | | var listDevice = new List<CommonDevice> { }; |
| | | listDevice.Add(doorLock); |
| | | var devTemp = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); |
| | | if (devTemp.ConcreteType == DeviceConcreteType.IntelligentLocks_Sone) |
| | | { |
| | | var volumeMsg = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | this.ShowTipMsg(volumeMsg); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | volumeData = resultRes.volumeResponseData; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | UpdateVolume(); |
| | | }); |
| | | } |
| | | } |
| | | #region 音量 |
| | | /// <summary> |
| | | /// 更新音量 |
| | | /// </summary> |
| | |
| | | return; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | var volumeMsg = Language.StringByID(R.MyInternationalizationString.SetVolumeSuccess); |
| | | this.ShowTipMsg(volumeMsg); |
| | | oldVolume = currentVolume; |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | { |
| | | var volumeMsg = Language.StringByID(R.MyInternationalizationString.SetVolumeSuccess); |
| | | this.ShowTipMsg(volumeMsg); |
| | | oldVolume = currentVolume; |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | /// </summary> |
| | | private async void NomallyOpenDialog() |
| | | { |
| | | if (btnNormallyOpen.IsSelected) |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) |
| | | { |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.OnlyMasterOperate)); |
| | | return; |
| | | } |
| | | |
| | | if (!HdlUserCenterResourse.AccountOption.DoorUnLockByRemote) |
| | | { |
| | | SystemSecondAuthentication(); |
| | | return; |
| | | } |
| | | |
| | | action = () => |
| | | { |
| | | //WJC的代码:系统密码支持操作门锁后,调用温居城的界面【常开自动化】 |
| | | if (doorLock == null) |
| | | { |
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.NoAccess)); |
| | | ///防止抛异常 |
| | | return; |
| | | } |
| | | |
| | | if (!UserCenterResourse.AccountOption.DoorUnLockByRemote) |
| | | ///备注:WJC的 |
| | | Shared.Phone.Device.Logic.Send.CurrentDoorLock = doorLock; |
| | | ///进来刷新一次设备列表; |
| | | Common.Logic.LogicDviceList.Clear(); |
| | | if (Common.Logic.LogicDviceList.Count == 0) |
| | | { |
| | | SystemSecondAuthentication(); |
| | | return; |
| | | Common.Logic.LogicDviceList.AddRange(HdlDeviceCommonLogic.Current.listAllDevice.ToArray()); |
| | | } |
| | | |
| | | action = () => |
| | | { |
| | | string msg = Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n"); |
| | | var confirm = Language.StringByID(R.MyInternationalizationString.Confrim); |
| | | var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, confirm); |
| | | alert.Show(); |
| | | alert.CancelClickEvent += () => |
| | | { |
| | | btnNormallyOpen.IsSelected = false; |
| | | }; |
| | | alert.ConfirmClickEvent += async () => |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | var result = await doorLock.SetNormallyOpenModeFuncAsync(true); |
| | | if (result == null || result.defaultControlResponseData == null) |
| | | { |
| | | string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | this.ShowTipMsg(msg0); |
| | | btnNormallyOpen.IsSelected = false; |
| | | return; |
| | | } |
| | | if (result.defaultControlResponseData.status != 0) |
| | | { |
| | | string msg1 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeFailed); |
| | | this.ShowTipMsg(msg1); |
| | | btnNormallyOpen.IsSelected = false; |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | DoorLockCommonInfo.IsDoorLockNormallyMode = true; |
| | | UpdateNomallyOpenStatus(); |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | //常开模式开启提示 |
| | | string msgNomallyModeIsTurnOn = Language.StringByID(R.MyInternationalizationString.NomallyModeIsTurnOn); |
| | | var doorLockInValidSetting = Language.StringByID(R.MyInternationalizationString.DoorLockInValidSetting); |
| | | var alertNomallyModeIsTurnOn = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.DoorLockLogic, msgNomallyModeIsTurnOn, doorLockInValidSetting); |
| | | alertNomallyModeIsTurnOn.Show(); |
| | | alertNomallyModeIsTurnOn.LogicClickEvent += () => |
| | | { |
| | | //自动化 |
| | | }; |
| | | alertNomallyModeIsTurnOn.InvalidClickEvent += async () => |
| | | { |
| | | NomallyOpenModeInvalidTimeDialog(); |
| | | }; |
| | | } |
| | | }; |
| | | }; |
| | | HdlCheckLogic.Current.CheckSecondarySecurity(action); |
| | | } |
| | | else |
| | | { |
| | | NomallyOpenModeInvalidDialog(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 常开模式失效处理 |
| | | /// </summary> |
| | | public void NomallyOpenModeInvalidDialog(bool IsFromReport = false) |
| | | { |
| | | string msg = Language.StringByID(R.MyInternationalizationString.NomallyModeIsCanceled).Replace("{0}", "\r\n"); |
| | | var confirm = Language.StringByID(R.MyInternationalizationString.SureCancel); |
| | | var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.NomallyOpenMode, msg, confirm); |
| | | if (HaveLogicNormallyOpenMode) |
| | | { |
| | | //有逻辑设置的弹窗 |
| | | alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.CancelNomallyOpenModeWithLogic, msg, confirm); |
| | | } |
| | | alert.Show(); |
| | | alert.CancelClickEvent += async () => |
| | | { |
| | | //保持常开 |
| | | if (IsFromReport) |
| | | var addLogicPage = new Shared.Phone.Device.Logic.SoneLogicList(); |
| | | UserView.HomePage.Instance.AddChidren(addLogicPage); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | addLogicPage.Show(); |
| | | addLogicPage.action += async (w) => |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | var result = await doorLock.SetNormallyOpenModeFuncAsync(true); |
| | | if (result == null || result.defaultControlResponseData == null) |
| | | DoorLockCommonInfo.NormallyOpenModeValue(doorLock, w); |
| | | UpdateNomallyOpenStatus(); |
| | | //返回按键清空当前逻辑定义的LogicAction |
| | | UserCenter.DoorLock.DoorLockCommonInfo.LogicAction = null; |
| | | //是否存在常开模式 |
| | | var resTemp = Shared.Common.Logic.SoneLogicList; |
| | | if (resTemp.Count == 0) |
| | | { |
| | | string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | this.ShowTipMsg(msg0); |
| | | btnNormallyOpen.IsSelected = false; |
| | | DoorLockCommonInfo.IsDoorLockNormallyMode = false; |
| | | return; |
| | | } |
| | | if (result.defaultControlResponseData.status != 0) |
| | | { |
| | | string msg1 = Language.StringByID(R.MyInternationalizationString.OpenNormallyOpenModeFailed); |
| | | this.ShowTipMsg(msg1); |
| | | btnNormallyOpen.IsSelected = false; |
| | | DoorLockCommonInfo.IsDoorLockNormallyMode = false; |
| | | return; |
| | | haveLogicNormallyOpenMode = false; |
| | | } |
| | | else |
| | | { |
| | | DoorLockCommonInfo.IsDoorLockNormallyMode = true; |
| | | btnNormallyOpen.IsSelected = true; |
| | | UpdateNomallyOpenStatus(); |
| | | CommonPage.Loading.Hide(); |
| | | haveLogicNormallyOpenMode = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | btnNormallyOpen.IsSelected = true; |
| | | } |
| | | }; |
| | | alert.ConfirmClickEvent += async () => |
| | | { |
| | | //确认取消常开 |
| | | if (IsFromReport) |
| | | { |
| | | DoorLockCommonInfo.IsDoorLockNormallyMode = false; |
| | | btnNormallyOpen.IsSelected = false; |
| | | UpdateNomallyOpenStatus(); |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | var result = await doorLock.SetNormallyOpenModeFuncAsync(false); |
| | | if (result == null || result.defaultControlResponseData == null) |
| | | { |
| | | string msg0 = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | this.ShowTipMsg(msg0); |
| | | btnNormallyOpen.IsSelected = true; |
| | | return; |
| | | } |
| | | if (result.defaultControlResponseData.status != 0) |
| | | { |
| | | string msg1 = Language.StringByID(R.MyInternationalizationString.CloseNormallyOpenModeFailed); |
| | | this.ShowTipMsg(msg1); |
| | | btnNormallyOpen.IsSelected = true; |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | DoorLockCommonInfo.IsDoorLockNormallyMode = false; |
| | | UpdateNomallyOpenStatus(); |
| | | string msg2 = Language.StringByID(R.MyInternationalizationString.CloseNormallyOpenModeSuccess); |
| | | this.ShowTipMsg(msg2); |
| | | } |
| | | } |
| | | |
| | | UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction -= addLogicPage.updateCurrentDoorlockActionTemp; |
| | | }; |
| | | }; |
| | | HdlCheckLogic.Current.CheckSecondarySecurity(action); |
| | | |
| | | } |
| | | |
| | | ///// <summary> |
| | | /// 常开模式失效时间处理 |
| | | /// </summary> |
| | | private void NomallyOpenModeInvalidTimeDialog() |
| | | { |
| | | //失效设置 |
| | | string msgTimeInValidSetting = Language.StringByID(R.MyInternationalizationString.DoorLockOpenAllTheTime); |
| | | var timeConfrim = Language.StringByID(R.MyInternationalizationString.Confrim); |
| | | var alertTimeInValidSetting = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.InValid, msgTimeInValidSetting, timeConfrim); |
| | | alertTimeInValidSetting.Show(); |
| | | alertTimeInValidSetting.CancelClickEvent += () => |
| | | { |
| | | btnNormallyOpen.IsSelected = true; |
| | | }; |
| | | alertTimeInValidSetting.InvalidTimeAction += (obj) => |
| | | { |
| | | Regex rg = new Regex("^[0-9]+$"); |
| | | if (!rg.IsMatch(obj)) |
| | | { |
| | | //必须是数字 |
| | | string msg0 = Language.StringByID(R.MyInternationalizationString.NormallyOpenModeInvalidTimeTip); |
| | | this.ShowTipMsg(msg0); |
| | | |
| | | string msgTimeInValidSetting2 = Language.StringByID(R.MyInternationalizationString.DoorLockOpenAllTheTime); |
| | | var timeConfrim2 = Language.StringByID(R.MyInternationalizationString.Confrim); |
| | | var alertTimeInValidSetting2 = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.InValid, msgTimeInValidSetting2, timeConfrim2); |
| | | alertTimeInValidSetting2.Show(); |
| | | return; |
| | | } |
| | | var temp = int.Parse(obj); |
| | | DoorLockCommonInfo.NormallyOpenModeInvalidTime = temp; |
| | | btnNormallyOpen.IsSelected = true; |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 常开模式状态更新 |
| | | /// </summary> |
| | |
| | | { |
| | | if (!canOpenNormallyMode) |
| | | { |
| | | btnNormallyOpen.UnSelectedImagePath = "DoorLock/NormallyOpenOffline.png"; |
| | | btnNormallyOpen.Enable = false; |
| | | btnNormallyOpenFrameLayout.Width = Application.GetRealWidth(0); |
| | | return; |
| | | } |
| | | if (DoorLockCommonInfo.IsDoorLockNormallyMode == true) |
| | | if (doorLock.IsDoorLockNormallyMode) |
| | | { |
| | | btnNormallyOpen.IsSelected = true; |
| | | btnDoorLockPic.IsSelected = true; |
| | |
| | | btnStatus.Text = Language.StringByID(R.MyInternationalizationString.Current) + Language.StringByID(R.MyInternationalizationString.DoorLockOpen); |
| | | |
| | | } |
| | | else if (DoorLockCommonInfo.IsDoorLockNormallyMode == false) |
| | | else if (!doorLock.IsDoorLockNormallyMode) |
| | | { |
| | | btnStatus.Text = Language.StringByID(R.MyInternationalizationString.Current) + Language.StringByID(R.MyInternationalizationString.CLose); |
| | | btnDoorLockPic.IsSelected = false; |
| | | btnNormallyOpen.IsSelected = false; |
| | | progressButton.Y = Application.GetRealHeight(347); |
| | | } |
| | | else |
| | | { |
| | | btnNormallyOpen.UnSelectedImagePath = "DoorLock/NormallyOpenOffline.png"; |
| | | btnNormallyOpen.Enable = false; |
| | | string msg = Language.StringByID(R.MyInternationalizationString.GetNormallyOpenModeFailed); |
| | | this.ShowTipMsg(msg); |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | { |
| | | openFrameLayout.Enable = false; |
| | | btnDoorOpenPic.Enable = false; |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) |
| | | { |
| | | var result = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockOperateAccess(doorLock, Shared.Common.Config.Instance.Guid); |
| | | var result = await 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); |
| | | var result1 = await DoorLockCommonInfo.GetDoorLockUnlockAccess(doorLock, Shared.Common.Config.Instance.Guid); |
| | | if (result1 == true) |
| | | { |
| | | RemoteUnlockRequest(doorLock, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle); |
| | | RemoteUnlockRequest(currentRoom, deviceUI, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle); |
| | | devicNameSecAction += (deviceRename) => |
| | | { |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | |
| | | } |
| | | else |
| | | { |
| | | RemoteUnlockRequest(doorLock, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle); |
| | | RemoteUnlockRequest(currentRoom, deviceUI, action, progressButton, btnDoorLockPic, btnStatus, btnDoorLockTitle); |
| | | devicNameSecAction += (deviceRename) => |
| | | { |
| | | if (!string.IsNullOrEmpty(deviceRename)) |
| | | { |
| | | btnDoorLockTitle.Text = deviceRename;
|
| | | //改房间
|
| | | btnDoorLockTitle.Text = deviceRename; |
| | | //改房间 |
| | | HdlRoomLogic.Current.ChangedRoom(deviceUI, currentRoom.Id); |
| | | deviceUI.ReSave(); |
| | | } |
| | |
| | | /// </summary> |
| | | public override void RemoveFromParent() |
| | | { |
| | | UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction = null; |
| | | if (IsDrawerLockMode) |
| | | { |
| | | CommonPage.Instance.IsDrawerLockMode = false; |
| | | } |
| | | ZbGateway.StatusList.Remove(this); |
| | | DoorLockCommonInfo.LogicAction = null; |
| | | base.RemoveFromParent(); |
| | | } |
| | | #endregion |