| | |
| | | |
| | | namespace Shared.Phone.UserCenter.DoorLock |
| | | { |
| | | public class TemporaryPassword : DoorLockCommonLayout, ZigBee.Common.IStatus |
| | | public class TemporaryPassword : DoorLockCommonLayout |
| | | { |
| | | /// <summary> |
| | | /// 构造函数 |
| | |
| | | { |
| | | this.doorLock = doorLock; |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; |
| | | ZigBee.Device.ZbGateway.StatusList.Add(this); |
| | | } |
| | | |
| | | #region 变量申明 |
| | |
| | | }; |
| | | btnDelFrameLayout.MouseDownEventHandler += eHandler; |
| | | btnDelIcon.MouseDownEventHandler += eHandler; |
| | | #endregion |
| | | #endregion |
| | | MidTopFrameLayout = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(181), |
| | | Y = Application.GetRealHeight(92), |
| | | X = Application.GetMinRealAverage(181), |
| | | Y = Application.GetMinRealAverage(92), |
| | | Width = Application.GetRealWidth(717), |
| | | Height = Application.GetRealHeight(570), |
| | | BackgroundImagePath = "DoorLock/TempPasswordBackground.png", |
| | |
| | | { |
| | | Height = Application.GetRealHeight(43), |
| | | Width = Application.GetRealWidth(259), |
| | | X = Application.GetRealWidth(230), |
| | | X = Application.GetRealWidth(227), |
| | | Y = Application.GetRealHeight(418), |
| | | UnSelectedImagePath = "DoorLock/TempPasswordBackground1.png", |
| | | }; |
| | |
| | | var validTime = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(55), |
| | | Width = Application.GetRealWidth(92 + 115), |
| | | Width = Application.GetRealWidth(207), |
| | | Y = Application.GetRealHeight(386), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = 16, |
| | | Text = "--:--", |
| | | }; |
| | | MidTopFrameLayout.AddChidren(validTime); |
| | | |
| | | var validTimeDate = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(49), |
| | | Width = Application.GetRealWidth(84 + 135), |
| | | Width = Application.GetRealWidth(208), |
| | | Y = Application.GetRealHeight(441), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 12, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(validTimeDate); |
| | | |
| | |
| | | Height = Application.GetRealHeight(55), |
| | | Width = Application.GetRealWidth(717 - 507), |
| | | X = Application.GetRealWidth(507), |
| | | Y = Application.GetRealHeight(389), |
| | | Y = Application.GetRealHeight(386), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 16, |
| | | Text = "--:--", |
| | | }; |
| | | MidTopFrameLayout.AddChidren(inValidTime); |
| | | |
| | |
| | | Height = Application.GetRealHeight(49), |
| | | Width = Application.GetRealWidth(717 - 508), |
| | | X = Application.GetRealWidth(508), |
| | | Y = Application.GetRealHeight(444), |
| | | Y = Application.GetRealHeight(441), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 12, |
| | | TextSize = 12, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(inValidTimeDate); |
| | | |
| | |
| | | |
| | | #region 数据处理 |
| | | TimeDisplay(validTime, validTimeDate, inValidTime, inValidTimeDate, false); |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify) |
| | | { |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinifh.Enable = true; |
| | | topPic.Visible = true; |
| | | topPic.Enable = true; |
| | | } |
| | | else |
| | | { |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinifh.Enable = false; |
| | | topPic.Visible = false; |
| | | topPic.Enable = false; |
| | | } |
| | | |
| | | if (string.IsNullOrEmpty(doorLock.LocalTempPassword)) |
| | | { |
| | | randomPassword.Text = "- - - - - -"; |
| | |
| | | } |
| | | } |
| | | |
| | | temPasswordVisiable.MouseUpEventHandler += (sender, e) => |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify) |
| | | { |
| | | temPasswordVisiable.IsSelected = !temPasswordVisiable.IsSelected; |
| | | if (!temPasswordVisiable.IsSelected) |
| | | { |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMGray4; |
| | | randomPassword.SecureTextEntry = true; |
| | | } |
| | | else |
| | | { |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMOrange; |
| | | randomPassword.SecureTextEntry = false; |
| | | } |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = !randomPassword.SecureTextEntry; |
| | | }; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinifh.Enable = true; |
| | | topPic.Visible = true; |
| | | topPic.Enable = true; |
| | | } |
| | | else |
| | | { |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinifh.Enable = false; |
| | | topPic.Visible = false; |
| | | topPic.Enable = false; |
| | | } |
| | | |
| | | temPasswordVisiable.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | temPasswordVisiable.IsSelected = !temPasswordVisiable.IsSelected; |
| | | if (!temPasswordVisiable.IsSelected) |
| | | { |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMGray4; |
| | | randomPassword.SecureTextEntry = true; |
| | | } |
| | | else |
| | | { |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMOrange; |
| | | randomPassword.SecureTextEntry = false; |
| | | } |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = !randomPassword.SecureTextEntry; |
| | | }; |
| | | topPic.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | randomPassword.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetTempPassword(); |
| | |
| | | //请"点击生成"临时密码; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1); |
| | | ShowMassage(ShowMsgType.Tip, mess); |
| | | |
| | | }); |
| | | return; |
| | | } |
| | |
| | | //请"点击生成"临时密码; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | //请"点击生成"临时密码; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | //无效的时间设置 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | addDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | addDoorLockTempPasswordData.IsOtherAccountCtrl = true; |
| | | } |
| | | addDoorLockTempPasswordData.TempPwd = doorLock.tempPasswordObject.TempPassword; |
| | | //对密码进行加密处理 |
| | | string hdlKey = "hD1(La3o"; |
| | | var enPsw = UserCenterLogic.EncryptPassword(hdlKey, doorLock.tempPasswordObject.TempPassword); |
| | | addDoorLockTempPasswordData.TempPwd = enPsw; |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | addDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.SetFailedXm1); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.SetFailedXm); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.SetFailedXm); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ClearFailedXm1) + ".", Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.ClearFailedXm1); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | } |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | } |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ClearFailedXm1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.ClearFailedXm1); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDelText); |
| | | |
| | | var mess = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | } |
| | | } |
| | | } |
| | |
| | | tpObj.UserId = int.Parse(curDoorLockTempPaw.TempPwdId); |
| | | tpObj.ValidTime = curDoorLockTempPaw.ValidBeginTime; |
| | | tpObj.InValidTime = curDoorLockTempPaw.ValidEndTime; |
| | | doorLock.LocalTempPassword = tpObj.TempPassword = curDoorLockTempPaw.TempPwd; |
| | | //解密密码 |
| | | string hdlKey = "hD1(La3o"; |
| | | var desPsw = UserCenterLogic.DecryptPassword(hdlKey, curDoorLockTempPaw.TempPwd); |
| | | doorLock.LocalTempPassword = tpObj.TempPassword = desPsw; |
| | | doorLock.tempPasswordObject = tpObj; |
| | | TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime); |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | var mess = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime); |
| | | this.ShowMassage(ShowMsgType.Tip, mess); |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | if (isDefaultTime) |
| | | { |
| | | var cur = DateTime.Now; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = cur.Hour; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = cur.Hour; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = cur.Minute; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = cur.Minute; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = cur.Second; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = cur.Second; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateYear = cur.Year; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateYear = cur.Year; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth = cur.Month; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth = cur.Month; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay = cur.Day; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay = cur.Day + 1; |
| | | DoorLockCommonInfo.ValidDateHour = cur.Hour; |
| | | DoorLockCommonInfo.ValidDateMinute = cur.Minute; |
| | | DoorLockCommonInfo.ValidDateSecond = cur.Second; |
| | | DoorLockCommonInfo.InValidDateHour = cur.Hour; |
| | | DoorLockCommonInfo.InValidDateMinute = cur.Minute; |
| | | DoorLockCommonInfo.InValidDateSecond = cur.Second; |
| | | DoorLockCommonInfo.ValidDateYear = cur.Year; |
| | | DoorLockCommonInfo.ValidDateMonth = cur.Month; |
| | | DoorLockCommonInfo.ValidDateDay = cur.Day; |
| | | |
| | | var curD = DoorLockCommonInfo.LastDayOfMonth(cur); |
| | | if (DoorLockCommonInfo.ValidDateDay == curD.Day) |
| | | { |
| | | if (DoorLockCommonInfo.ValidDateMonth == 12) |
| | | { |
| | | DoorLockCommonInfo.InValidDateYear = cur.Year + 1; |
| | | DoorLockCommonInfo.InValidDateMonth = 1; |
| | | DoorLockCommonInfo.InValidDateDay = 1; |
| | | } |
| | | else |
| | | { |
| | | DoorLockCommonInfo.InValidDateYear = cur.Year; |
| | | DoorLockCommonInfo.InValidDateMonth = cur.Month + 1; |
| | | DoorLockCommonInfo.InValidDateDay = 1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | DoorLockCommonInfo.InValidDateYear = cur.Year; |
| | | DoorLockCommonInfo.InValidDateMonth = cur.Month; |
| | | DoorLockCommonInfo.InValidDateDay = cur.Day + 1; |
| | | } |
| | | |
| | | //doorLock.ReSave(); |
| | | } |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour < 10) |
| | |
| | | //有效时间 |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour == 100) |
| | | { |
| | | validTime.Text = "00:00"; |
| | | validTime.Text = "--:--"; |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour == 100) |
| | | { |
| | | inValidTime.Text = "00:00"; |
| | | inValidTime.Text = "--:--"; |
| | | } |
| | | else |
| | | { |
| | | inValidTime.Text = hour + ":" + minute; |
| | | } |
| | | validTimeDate.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth + Language.StringByID(R.MyInternationalizationString.Month) + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay + Language.StringByID(R.MyInternationalizationString.Day); |
| | | inValidTimeDate.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth + Language.StringByID(R.MyInternationalizationString.Month) + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay + Language.StringByID(R.MyInternationalizationString.Day); |
| | | } |
| | | |
| | | #region 接口实现 |
| | | /// <summary> |
| | | /// 处理变化事件 --将弃用 改用DeviceInfoChange() |
| | | /// </summary> |
| | | /// <returns>The changed.</returns> |
| | | /// <param name="common">Common.</param> |
| | | public void Changed(CommonDevice common) |
| | | { |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth == 0) |
| | | { |
| | | validTimeDate.Text = "-" + Language.StringByID(R.MyInternationalizationString.Month) + "-" + Language.StringByID(R.MyInternationalizationString.Day); |
| | | } |
| | | else |
| | | { |
| | | validTimeDate.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth + Language.StringByID(R.MyInternationalizationString.Month) + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay + Language.StringByID(R.MyInternationalizationString.Day); |
| | | } |
| | | |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth == 0) |
| | | { |
| | | inValidTimeDate.Text = "-" + Language.StringByID(R.MyInternationalizationString.Month) + "-" + Language.StringByID(R.MyInternationalizationString.Day); |
| | | } |
| | | else |
| | | { |
| | | inValidTimeDate.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth + Language.StringByID(R.MyInternationalizationString.Month) + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay + Language.StringByID(R.MyInternationalizationString.Day); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 处理变化事件 |
| | | /// </summary> |
| | | /// <param name="common"></param> |
| | | /// <param name="typeTag"></param> |
| | | public void DeviceInfoChange(CommonDevice common, string typeTag) |
| | | { |
| | | } |
| | | /// <summary> |
| | | /// Changeds the IL ogic status. |
| | | /// </summary> |
| | | /// <param name="logic">Logic.</param> |
| | | public void ChangedILogicStatus(ZigBee.Device.Logic logic) |
| | | { |
| | | } |
| | | /// <summary> |
| | | /// Changeds the IS cene status. |
| | | /// </summary> |
| | | /// <param name="scene">Scene.</param> |
| | | public void ChangedISceneStatus(Scene scene) |
| | | { |
| | | } |
| | | #endregion |
| | | } |
| | | } |