| | |
| | | using System; |
| | | using System.Linq.Expressions; |
| | | using Newtonsoft.Json.Linq; |
| | | using Shared.Common; |
| | | using ZigBee.Device; |
| | | |
| | |
| | | this.doorLock = doorLock; |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; |
| | | ZigBee.Device.ZbGateway.StatusList.Add(this); |
| | | ReadTempPasswordData(); |
| | | } |
| | | |
| | | #region ◆ 变量申明__________________________ |
| | | ZigBee.Device.DoorLock doorLock; |
| | | public System.Collections.Generic.List<Button> pawButtonList = new System.Collections.Generic.List<Button> { };//临时密码中的6位数字 |
| | | Button passwordText; //临时密码 |
| | | FrameLayout MidTopFrameLayout; |
| | | Action<string, string> action;//接收通知 |
| | | Button btnFinifh; |
| | | DateTime cunVDateTime; |
| | | DateTime cunIVDateTime; |
| | | #endregion |
| | | |
| | | /// <summary>
|
| | | /// UI显示 |
| | | /// <summary> |
| | | /// UI显示 |
| | | /// </summary> |
| | | public void Show() |
| | | { |
| | |
| | | |
| | | EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => |
| | | { |
| | | if (doorLock.Gateway != null || doorLock.Gateway.GwResDataAction != null) |
| | | { |
| | | doorLock.Gateway.GwResDataAction -= action; |
| | | } |
| | | RemoveFromParent(); |
| | | }; |
| | | this.btnBack.MouseUpEventHandler += eHandlerBack; |
| | | this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; |
| | | this.MidFrameLayout(this); |
| | | |
| | | MidFrameLayoutContent(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读门锁临时密码信息 |
| | | /// </summary> |
| | | /// <param name="door_lock">Door lock.</param> |
| | | void readStatus() |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => |
| | | #region btnDelFrameLayout |
| | | var btnDelFrameLayout = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(953), |
| | | Height = Application.GetRealHeight(69), |
| | | Width = Application.GetRealWidth(1080 - 953), |
| | | }; |
| | | this.titleFrameLayout.AddChidren(btnDelFrameLayout); |
| | | |
| | | }); |
| | | var btnDelIcon = new Button |
| | | { |
| | | Height = Application.GetRealHeight(69), |
| | | Width = Application.GetRealWidth(69), |
| | | UnSelectedImagePath = "DoorLock/DelIcon.png", |
| | | }; |
| | | btnDelFrameLayout.AddChidren(btnDelIcon); |
| | | |
| | | EventHandler<MouseEventArgs> eHandler = (sender, e) => |
| | | { |
| | | var dialog = new Dialog { }; |
| | | dialog.Show(); |
| | | |
| | | var flMain = new FrameLayout { BackgroundColor = 0x00000000 }; |
| | | dialog.AddChidren(flMain); |
| | | flMain.MouseUpEventHandler += (sender11, e11) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | var delBackgroundFrameLayout = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(596), |
| | | Y = Application.GetRealHeight(164), |
| | | Height = Application.GetRealHeight(173), |
| | | Width = Application.GetRealWidth(449), |
| | | BackgroundImagePath = "DoorLock/DelBackground.png", |
| | | }; |
| | | flMain.AddChidren(delBackgroundFrameLayout); |
| | | |
| | | var btnDelIcon2 = new Button |
| | | { |
| | | Height = Application.GetRealHeight(81), |
| | | Width = Application.GetRealWidth(81), |
| | | X = Application.GetRealWidth(81), |
| | | Y = Application.GetRealHeight(55), |
| | | UnSelectedImagePath = "DoorLock/DelIcon.png", |
| | | }; |
| | | delBackgroundFrameLayout.AddChidren(btnDelIcon2); |
| | | |
| | | var btnDelText = new Button |
| | | { |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(311), |
| | | X = Application.GetRealWidth(173), |
| | | Y = Application.GetRealHeight(69), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = Language.StringByID(R.MyInternationalizationString.ClearTempPassword), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText, |
| | | TextSize = 12, |
| | | }; |
| | | delBackgroundFrameLayout.AddChidren(btnDelText); |
| | | |
| | | EventHandler<MouseEventArgs> eHandler2 = (sender2, e2) => |
| | | { |
| | | var dialog1 = new Dialog { }; |
| | | var doorDialog = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog1, Language.StringByID(R.MyInternationalizationString.Tip)); |
| | | doorDialog.Show(); |
| | | doorDialog.dialogMidFraFrameLayout.Width = Application.GetRealWidth(415); |
| | | doorDialog.dialogMidFraFrameLayout.Height = Application.GetRealHeight(58); |
| | | doorDialog.dialogMidFraFrameLayout.X = Application.GetRealWidth(190); |
| | | doorDialog.dialogMidFraFrameLayout.Y = Application.GetRealHeight(202); |
| | | doorDialog.dialogMidFraFrameLayout.AddChidren(doorDialog.dialogMidText); |
| | | doorDialog.dialogMidText.Text = Language.StringByID(R.MyInternationalizationString.SureToDeleteTempPassword); |
| | | doorDialog.dialogMidText.TextSize = 14; |
| | | doorDialog.dialogMidFraFrameLayout.AddChidren(doorDialog.dialogMidText); |
| | | doorDialog.dialogBtnConfirm.Text = Language.StringByID(R.MyInternationalizationString.Confrim); |
| | | doorDialog.dialogBtnCancel.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | dialog.Close(); |
| | | dialog1.Close(); |
| | | }; |
| | | doorDialog.dialogBtnConfirm.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | dialog.Close(); |
| | | dialog1.Close(); |
| | | ClearEventHandler(btnDelText, dialog1); |
| | | }; |
| | | }; |
| | | delBackgroundFrameLayout.MouseDownEventHandler += eHandler2; |
| | | btnDelIcon2.MouseDownEventHandler += eHandler2; |
| | | btnDelText.MouseDownEventHandler += eHandler2; |
| | | }; |
| | | btnDelFrameLayout.MouseDownEventHandler += eHandler; |
| | | btnDelIcon.MouseDownEventHandler += eHandler; |
| | | #endregion |
| | | MidTopFrameLayout = new FrameLayout() |
| | | { |
| | | X = Application.GetRealWidth(181), |
| | | Y = Application.GetRealHeight(92), |
| | | Width = Application.GetRealWidth(717), |
| | | Height = Application.GetRealHeight(570), |
| | | BackgroundImagePath = "DoorLock/TempPasswordBackground.png", |
| | | }; |
| | | this.midFrameLayout.AddChidren(MidTopFrameLayout); |
| | | MidFrameLayoutContent(); |
| | | } |
| | | |
| | | public void MidFrameLayoutContent() |
| | | { |
| | | var MidTopFrameLayout = new FrameLayout() |
| | | MidTopFrameLayout.RemoveAll(); |
| | | var TempPasswordBackground1 = new Button() |
| | | { |
| | | X = Application.GetRealWidth(196), |
| | | Y = Application.GetRealHeight(276), |
| | | Width = Application.GetRealWidth(668), |
| | | Height = Application.GetRealHeight(527), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | Height = Application.GetRealHeight(43), |
| | | Width = Application.GetRealWidth(259), |
| | | X = Application.GetRealWidth(230), |
| | | Y = Application.GetRealHeight(418), |
| | | UnSelectedImagePath = "DoorLock/TempPasswordBackground1.png", |
| | | }; |
| | | this.midFrameLayout.AddChidren(MidTopFrameLayout); |
| | | MidTopFrameLayout.AddChidren(TempPasswordBackground1); |
| | | |
| | | var topMidTopFrameLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(313), |
| | | }; |
| | | MidTopFrameLayout.AddChidren(topMidTopFrameLayout); |
| | | |
| | | var topPic = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(184), |
| | | Width = Application.GetRealWidth(184), |
| | | X = Application.GetRealWidth(449), |
| | | Y = Application.GetRealHeight(58), |
| | | Height = Application.GetRealHeight(81), |
| | | Y = Application.GetRealHeight(48), |
| | | TextAlignment = TextAlignment.Center, |
| | | Text = Language.StringByID(R.MyInternationalizationString.RandomPasword), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray1, |
| | | Text = Language.StringByID(R.MyInternationalizationString.ClickGenerate), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText, |
| | | TextSize = 12, |
| | | Visible = true, |
| | | Enable = true, |
| | | }; |
| | | this.midFrameLayout.AddChidren(topPic); |
| | | topMidTopFrameLayout.AddChidren(topPic); |
| | | |
| | | var randomPassword = new EditText() |
| | | { |
| | | X = Application.GetRealWidth(233), |
| | | Y = Application.GetRealHeight(153), |
| | | Height = Application.GetRealHeight(84), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMOrange, |
| | | Width = Application.GetRealWidth(251), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = 24, |
| | | Text = GetTempPassword(), |
| | | SecureTextEntry = false, |
| | | Enable = false, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(randomPassword); |
| | | topMidTopFrameLayout.AddChidren(randomPassword); |
| | | |
| | | var temPasswordVisiable = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(92), |
| | | Width = Application.GetRealWidth(92), |
| | | X = Application.GetRealWidth(495), |
| | | Y = Application.GetRealHeight(153), |
| | | UnSelectedImagePath = "DoorLock/TemPasswordInvisiable.png", |
| | | SelectedImagePath = "DoorLock/TemPasswordVisiable.png", |
| | | }; |
| | | topMidTopFrameLayout.AddChidren(temPasswordVisiable); |
| | | |
| | | var validTime = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(55), |
| | | Width = Application.GetRealWidth(115), |
| | | X = Application.GetRealWidth(78), |
| | | X = Application.GetRealWidth(92), |
| | | Y = Application.GetRealHeight(386), |
| | | Text = "12:00", |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 12, |
| | | TextSize = 14, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(validTime); |
| | | |
| | |
| | | { |
| | | Height = Application.GetRealHeight(49), |
| | | Width = Application.GetRealWidth(135), |
| | | X = Application.GetRealWidth(69), |
| | | X = Application.GetRealWidth(84), |
| | | Y = Application.GetRealHeight(441), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | Text = "8" + Language.StringByID(R.MyInternationalizationString.Month) + "1" + Language.StringByID(R.MyInternationalizationString.Day), |
| | | TextSize = 10, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(validTimeDate); |
| | | |
| | | var inValidTime = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(55), |
| | | Width = Application.GetRealWidth(115), |
| | | X = Application.GetRealWidth(492), |
| | | Y = Application.GetRealHeight(386), |
| | | Text = "10:00", |
| | | Width = Application.GetRealWidth(118), |
| | | X = Application.GetRealWidth(507), |
| | | Y = Application.GetRealHeight(389), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 12, |
| | | TextSize = 14, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(inValidTime); |
| | | |
| | |
| | | { |
| | | Height = Application.GetRealHeight(49), |
| | | Width = Application.GetRealWidth(135), |
| | | X = Application.GetRealWidth(484), |
| | | Y = Application.GetRealHeight(441), |
| | | X = Application.GetRealWidth(508), |
| | | Y = Application.GetRealHeight(444), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray2, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = "8" + Language.StringByID(R.MyInternationalizationString.Month) + "2" + Language.StringByID(R.MyInternationalizationString.Day), |
| | | TextSize = 10, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(inValidTimeDate); |
| | | |
| | | //var inputCountText = new EditText() |
| | | //{ |
| | | // Width = Application.GetRealWidth(780), |
| | | // Height = Application.GetRealHeight(100), |
| | | // X = Application.GetRealWidth(80), |
| | | // Y = validCountText.Bottom + Application.GetRealHeight(10), |
| | | // PlaceholderText = doorLock.tempPasswordObj.times.ToString(), |
| | | // PlaceholderTextColor = 0xffc1c1c1, |
| | | // TextAlignment = TextAlignment.Center, |
| | | // //UnSelectedImagePah = "Register/Register_Kuang.png", |
| | | // BackgroundColor = 0xff00ff00, |
| | | //}; |
| | | //this.midFrameLayout.AddChidren(inputCountText); |
| | | |
| | | //var unitCount = new Button() |
| | | //{ |
| | | // Height = Application.GetRealHeight(50), |
| | | // Width = Application.GetRealWidth(100), |
| | | // X = inputCountText.Right + Application.GetRealWidth(2), |
| | | // Y = Application.GetRealHeight(490), |
| | | // Text = Language.StringByID(R.MyInternationalizationString.Ci), |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // TextSize = 12, |
| | | // TextColor = 0xff000000, |
| | | //}; |
| | | //this.midFrameLayout.AddChidren(unitCount); |
| | | |
| | | //var remindPic2 = new Button() |
| | | //{ |
| | | // Height = Application.GetRealHeight(40), |
| | | // Width = Application.GetRealWidth(40), |
| | | // X = Application.GetRealWidth(80), |
| | | // Y = inputCountText.Bottom + Application.GetRealHeight(18), |
| | | // //UnSelectedImagePath = "DoorLockPic/door_lock_alert.png", |
| | | // BackgroundColor = 0xff0000ff, |
| | | //}; |
| | | //this.midFrameLayout.AddChidren(remindPic2); |
| | | |
| | | //var maxValidCount = new Button() |
| | | //{ |
| | | // Width = Application.GetRealWidth(550), |
| | | // Height = Application.GetRealHeight(80), |
| | | // X = remindPic2.Right + Application.GetRealWidth(8), |
| | | // Y = inputCountText.Bottom, |
| | | // Text = Language.StringByID(R.MyInternationalizationString.MaxValicCount), |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // TextSize = 10, |
| | | // TextColor = 0xff000000, |
| | | //}; |
| | | //this.midFrameLayout.AddChidren(maxValidCount); |
| | | |
| | | //var remindFrameLayout = new FrameLayout() |
| | | //{ |
| | | // Height = Application.GetRealHeight(350), |
| | | // Y = remindPic2.Bottom + Application.GetRealHeight(90), |
| | | // BackgroundColor = 0xff00ffff, |
| | | //}; |
| | | //this.midFrameLayout.AddChidren(remindFrameLayout); |
| | | |
| | | //var TempPasswordText = new Button() |
| | | //{ |
| | | // X = Application.GetRealWidth(80), |
| | | // Y = Application.GetRealHeight(10), |
| | | // Width = Application.GetRealWidth(300), |
| | | // Height = Application.GetRealHeight(80), |
| | | // TextAlignment = TextAlignment.CenterLeft, |
| | | // Text = Language.StringByID(R.MyInternationalizationString.DynamicTempPassword), |
| | | // TextColor = 0xffff0000, |
| | | //}; |
| | | //remindFrameLayout.AddChidren(TempPasswordText); |
| | | |
| | | //for (int i = 0; i < 6; i++) |
| | | //{ |
| | | // passwordText = new Button() |
| | | // { |
| | | // Height = Application.GetRealHeight(150), |
| | | // Width = Application.GetRealWidth(80), |
| | | // TextAlignment = TextAlignment.Center, |
| | | // Y = TempPasswordText.Bottom + Application.GetRealHeight(10), |
| | | // TextSize = 28, |
| | | // BackgroundColor = 0xff0000ff, |
| | | // }; |
| | | // remindFrameLayout.AddChidren(passwordText); |
| | | // if (i == 0) |
| | | // { |
| | | // passwordText.X = Application.GetRealWidth(90); |
| | | // } |
| | | // else |
| | | // { |
| | | // passwordText.X = (i + 1) * Application.GetRealWidth(90) + (i + 1) * Application.GetRealWidth(10); |
| | | // } |
| | | // if (i == 1 || i == 3 || i == 5) |
| | | // { |
| | | // passwordText.BackgroundColor = 0xff00ff00; |
| | | // } |
| | | // pawButtonList.Add(passwordText); |
| | | //} |
| | | |
| | | BottomFrameLayoutContent(); |
| | | } |
| | | |
| | | #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.Visible = false; |
| | | randomPassword.X = Application.GetRealWidth(215); |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMGray4; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = true; |
| | | topPic.Visible = true; |
| | | topPic.Enable = true; |
| | | } |
| | | else |
| | | { |
| | | randomPassword.Text = doorLock.LocalTempPassword; |
| | | temPasswordVisiable.Visible = true; |
| | | // topPic.Visible = false; |
| | | // topPic.Enable = false; |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable) |
| | | { |
| | | randomPassword.SecureTextEntry = false; |
| | | temPasswordVisiable.IsSelected = true; |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMOrange; |
| | | } |
| | | else |
| | | { |
| | | randomPassword.SecureTextEntry = true; |
| | | temPasswordVisiable.IsSelected = false; |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMGray4; |
| | | } |
| | | } |
| | | |
| | | 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(); |
| | | doorLock.LocalTempPassword = randomPassword.Text; |
| | | TimeDisplay(validTime, validTimeDate, inValidTime, inValidTimeDate, true); |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;//XMUnSelect |
| | | btnFinifh.Enable = true; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = true; |
| | | randomPassword.SecureTextEntry = false; |
| | | temPasswordVisiable.IsSelected = true; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = true; |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMOrange; |
| | | }; |
| | | #endregion |
| | | } |
| | | //底部界面和数据处理 |
| | | public void BottomFrameLayoutContent() |
| | | { |
| | | var bottomFrameLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(1025), |
| | | Y = Application.GetRealHeight(896), |
| | | Y = Application.GetRealHeight(711), |
| | | BackgroundColor = ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | this.midFrameLayout.AddChidren(bottomFrameLayout); |
| | |
| | | Text = Language.StringByID(R.MyInternationalizationString.InformationEdit), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 12, |
| | | TextSize = 15, |
| | | }; |
| | | bottomFrameLayout.AddChidren(informationEdit); |
| | | for (int i = 0; i < 3; i++) |
| | | |
| | | for (int i = 0; i < 2; i++) |
| | | { |
| | | var btnValidTime = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(743), |
| | | Width = Application.GetRealWidth(453), |
| | | Height = Application.GetRealHeight(58), |
| | | X = Application.GetRealWidth(58), |
| | | Text = Language.StringByID(R.MyInternationalizationString.ValidTime), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 12, |
| | | TextSize = 14, |
| | | }; |
| | | bottomFrameLayout.AddChidren(btnValidTime); |
| | | |
| | | var btnModifyText = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(448), |
| | | Height = Application.GetRealHeight(58), |
| | | X = btnValidTime.Right, |
| | | Text = Language.StringByID(R.MyInternationalizationString.Modify), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = 14, |
| | | }; |
| | | bottomFrameLayout.AddChidren(btnModifyText); |
| | | |
| | | var btnNextFrameLayout = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(58 * 2), |
| | | Height = Application.GetRealHeight(58), |
| | | X = Application.GetRealWidth(956), |
| | | Y = Application.GetRealHeight(204), |
| | | }; |
| | | bottomFrameLayout.AddChidren(btnNextFrameLayout); |
| | | |
| | | var btnNext = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(58), |
| | | Height = Application.GetRealHeight(58), |
| | | X = Application.GetRealWidth(956), |
| | | Y = Application.GetRealHeight(204), |
| | | BackgroundColor = ZigbeeColor.Current.XMOrange, |
| | | UnSelectedImagePath = "Item/Next.png", |
| | | SelectedImagePath = "Item/Down.png", |
| | | }; |
| | | bottomFrameLayout.AddChidren(btnNext); |
| | | btnNextFrameLayout.AddChidren(btnNext); |
| | | |
| | | var btnLine = new FrameLayout() |
| | | { |
| | |
| | | { |
| | | btnValidTime.Y = Application.GetRealHeight(204); |
| | | btnValidTime.Text = Language.StringByID(R.MyInternationalizationString.ValidTime); |
| | | btnNext.Y = btnValidTime.Y; |
| | | btnModifyText.Y = btnNextFrameLayout.Y = btnValidTime.Y; |
| | | btnLine.Y = Application.GetRealHeight(308); |
| | | btnNext.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "ValidTime"); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | tempPage.Show(); |
| | | }; |
| | | } |
| | | else if (i == 1) |
| | | { |
| | | btnValidTime.Y = Application.GetRealHeight(343); |
| | | btnValidTime.Text = Language.StringByID(R.MyInternationalizationString.InValidTime); |
| | | btnNext.Y = btnValidTime.Y; |
| | | btnModifyText.Y = btnNextFrameLayout.Y = btnValidTime.Y; |
| | | btnLine.Y = Application.GetRealHeight(446); |
| | | btnNext.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "InValidTime"); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | tempPage.Show(); |
| | | }; |
| | | } |
| | | else if (i == 2) |
| | | int curIndex = i; |
| | | EventHandler<MouseEventArgs> hander = (sender, e) => |
| | | { |
| | | btnValidTime.Y = Application.GetRealHeight(481); |
| | | btnValidTime.Text = Language.StringByID(R.MyInternationalizationString.ClearTempPassword); |
| | | btnNext.Y = btnValidTime.Y; |
| | | btnLine.Y = Application.GetRealHeight(1025 - 449); |
| | | } |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify) |
| | | { |
| | | if (curIndex == 0) |
| | | { |
| | | var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "ValidTime"); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | tempPage.Show(); |
| | | tempPage.timeSetAction += () => |
| | | { |
| | | MidFrameLayoutContent(); |
| | | }; |
| | | } |
| | | if (curIndex == 1) |
| | | { |
| | | var tempPage = new Shared.Phone.UserCenter.DoorLock.TimeSettignPage(doorLock, "InValidTime"); |
| | | Shared.Phone.UserView.HomePage.Instance.AddChidren(tempPage); |
| | | Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; |
| | | tempPage.Show(); |
| | | tempPage.timeSetAction += () => |
| | | { |
| | | MidFrameLayoutContent(); |
| | | }; |
| | | } |
| | | } |
| | | }; |
| | | btnValidTime.MouseDownEventHandler += hander; |
| | | btnModifyText.MouseDownEventHandler += hander; |
| | | btnNextFrameLayout.MouseDownEventHandler += hander; |
| | | btnNext.MouseDownEventHandler += hander; |
| | | } |
| | | |
| | | var modifyTempPasswordTip1 = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(49), |
| | | Y = Application.GetRealHeight(628), |
| | | TextID = R.MyInternationalizationString.ModifyTempPasswordTip1, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 12, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | bottomFrameLayout.AddChidren(modifyTempPasswordTip1); |
| | | |
| | | //var bottomLine = new Button() |
| | | //{ |
| | | // Height = Application.GetRealHeight(1), |
| | | // BackgroundColor = 0xff000000, |
| | | //}; |
| | | //bottomFrameLayout.AddChidren(bottomLine); |
| | | var modifyTempPasswordTip2 = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(49), |
| | | Y = modifyTempPasswordTip1.Bottom, |
| | | Radius = (uint)Application.GetRealHeight(120) / 2, |
| | | TextID = R.MyInternationalizationString.ModifyTempPasswordTip2, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 12, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | bottomFrameLayout.AddChidren(modifyTempPasswordTip2); |
| | | |
| | | //var generateTempPassword = new Button() |
| | | //{ |
| | | // Y = bottomLine.Bottom, |
| | | // Height = Application.GetRealHeight(180), |
| | | // TextID = R.MyInternationalizationString.GenerateTemporaryPassword, |
| | | // TextSize = 15, |
| | | // BackgroundColor = 0xFF121212, |
| | | // SelectedBackgroundColor = 0xFFFC5806, |
| | | //}; |
| | | //bottomFrameLayout.AddChidren(generateTempPassword); |
| | | //string tempPaw = ""; |
| | | //generateTempPassword.MouseUpEventHandler += (sender, e) => |
| | | //{ |
| | | // tempPaw = GetTempPassword(); |
| | | // for (int i = 0; i < tempPaw.Length; i++) |
| | | // { |
| | | // for (int j = 0; j < pawButtonList.Count; j++) |
| | | // { |
| | | // if (i == j) |
| | | // { |
| | | // pawButtonList[j].Text = tempPaw[i].ToString(); |
| | | // } |
| | | // } |
| | | // } |
| | | //}; |
| | | btnFinifh = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(907), |
| | | Height = Application.GetRealHeight(127), |
| | | X = Application.GetRealWidth(86), |
| | | Y = Application.GetRealHeight(760), |
| | | Radius = (uint)Application.GetRealHeight(120) / 2, |
| | | TextID = R.MyInternationalizationString.Confrim, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | TextSize = 16, |
| | | Enable = false, |
| | | }; |
| | | bottomFrameLayout.AddChidren(btnFinifh); |
| | | |
| | | btnFinifh.MouseUpEventHandler += async (sender, e) => |
| | | { |
| | | FinifhEventHandler(btnFinifh); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成6位临时密码 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetTempPassword() |
| | | //确定事件处理 |
| | | void FinifhEventHandler(Button btnFinifh) |
| | | { |
| | | string password = ""; |
| | | password = new Random().Next(100000, 999999).ToString(); |
| | | return password; |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | try |
| | | { |
| | | if (doorLock.LocalTempPassword == "") |
| | | { |
| | | //请"点击生成"临时密码; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | //if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour == 100) |
| | | //{ |
| | | // //请设置生效时间; |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip2), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | // }); |
| | | // return; |
| | | //} |
| | | //if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth == 0) |
| | | //{ |
| | | // //请设置生效日期; |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip3), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | // }); |
| | | // return; |
| | | //} |
| | | //if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour == 100) |
| | | //{ |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip4), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | // }); |
| | | // return; |
| | | //} |
| | | //if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth == 0) |
| | | //{ |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetTempPasswordTip5), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | // }); |
| | | // return; |
| | | //} |
| | | |
| | | var dNow = DateTime.Now; |
| | | var validDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute, dNow.Second); |
| | | var inValidDateTime = new DateTime(dNow.Year, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour, Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute, dNow.Second); |
| | | action = (topic, data) => |
| | | { |
| | | var gatewayID = topic.Split('/')[0]; |
| | | var jObjectdata = JObject.Parse(data); |
| | | if (jObjectdata == null) |
| | | { |
| | | return; |
| | | } |
| | | if (topic == $"{gatewayID}/DoorLock/DoorLockProgrammingEventNotificationCommand") |
| | | { |
| | | var ProgrammingEventNotificationData = Newtonsoft.Json.JsonConvert.DeserializeObject<ZigBee.Device.DoorLock.DoorLockProgrammingEventNotificationCommand>(jObjectdata["Data"].ToString()); |
| | | { |
| | | doorLock.doorLockProgrammingEventNotificationCommand = ProgrammingEventNotificationData; |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | localDoorLockObj.UserID = ProgrammingEventNotificationData.UserID; |
| | | localDoorLockObj.UnlockType = ProgrammingEventNotificationData.ProgramEventSoure; |
| | | var entryTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(ProgrammingEventNotificationData.ZigbeeLocalTime); |
| | | localDoorLockObj.EntryTime = entryTime; |
| | | if (!doorLock.localDoorLockUserList.ContainsKey(localDoorLockObj.UserID)) |
| | | { |
| | | doorLock.localDoorLockUserList.Add(ProgrammingEventNotificationData.UserID, localDoorLockObj); |
| | | } |
| | | //临时密码数据存储处理 |
| | | if (ProgrammingEventNotificationData.UserID > 245) |
| | | { |
| | | var tpObj = new ZigBee.Device.DoorLock.TempPasswordObject(); |
| | | tpObj.UserId = ProgrammingEventNotificationData.UserID; |
| | | tpObj.TempPassword = doorLock.LocalTempPassword; |
| | | tpObj.ValidTime = validDateTime; |
| | | tpObj.InValidTime = inValidDateTime; |
| | | doorLock.tempPasswordObject = tpObj; |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | if (doorLock.Gateway != null || doorLock.Gateway.GwResDataAction != null) |
| | | { |
| | | doorLock.Gateway.GwResDataAction += action; |
| | | } |
| | | //设置临时密码到门锁 |
| | | var addOrModifyResult = await doorLock.TempPasswordAsync(doorLock.LocalTempPassword, validDateTime, inValidDateTime); |
| | | if (addOrModifyResult != null && addOrModifyResult.responseData != null && addOrModifyResult.responseData.status == 0) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | | if (doorLock.tempPasswordObject != null) |
| | | { |
| | | var addDoorLockTempPasswordData = new ZigBee.Device.DoorLock.AddDoorLockTempPasswordData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | addDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | addDoorLockTempPasswordData.IsOtherAccountCtrl = true; |
| | | } |
| | | addDoorLockTempPasswordData.TempPwd = doorLock.tempPasswordObject.TempPassword; |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | addDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | addDoorLockTempPasswordData.ValidBeginTime = doorLock.tempPasswordObject.ValidTime; |
| | | addDoorLockTempPasswordData.ValidEndTime = doorLock.tempPasswordObject.InValidTime; |
| | | addDoorLockTempPasswordData.TempPwdId = doorLock.tempPasswordObject.UserId.ToString(); |
| | | //存到云 |
| | | var result1 = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLockPwd", addDoorLockTempPasswordData); |
| | | if (result1 != null && result1.StateCode != "Success") |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | }); |
| | | return; |
| | | } |
| | | //btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;//XMUnSelect XMBlack |
| | | //btnFinifh.Enable = false; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = false; |
| | | doorLock.LocalTempPassword = doorLock.tempPasswordObject.TempPassword; |
| | | TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime); |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.SetFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | }); |
| | | return; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | var mess = ex.Message; |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MidFrameLayoutContent(); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //清除事件处理 |
| | | async void ClearEventHandler(Button btnDelText = null, Dialog dialog = null) |
| | | { |
| | | if (btnDelText == null) |
| | | { |
| | | btnDelText = new Button(); |
| | | } |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | try |
| | | { |
| | | if (doorLock.tempPasswordObject != null) |
| | | { |
| | | var passData = doorLock.SetUserAccessData(doorLock.tempPasswordObject.UserId, ZigBee.Device.DoorLock.AccessType.DelCurrentUser); |
| | | var resultData = await doorLock.DefaultControlAsync(passData); |
| | | if (resultData != null && resultData.defaultControlResponseData != null && resultData.defaultControlResponseData.status == 0) |
| | | { |
| | | var delDoorLockTempPasswordData = new ZigBee.Device.DoorLock.DelDoorLockTempPasswordData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | delDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | delDoorLockTempPasswordData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | delDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | var result1 = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLockPwd", delDoorLockTempPasswordData); |
| | | if (result1 != null && result1 != null && result1.StateCode == "Success") |
| | | { |
| | | doorLock.tempPasswordObject = null; |
| | | doorLock.LocalTempPassword = ""; |
| | | TimeDateData(DateTime.Now, DateTime.Now, true); |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = false; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.IsModify = true; |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ClearFailedXm1), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ClearFailedXm), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDelText); |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (dialog != null) |
| | | { |
| | | dialog.Close(); |
| | | } |
| | | MidFrameLayoutContent(); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | //读取云端存储数据 |
| | | void ReadTempPasswordData() |
| | | { |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); |
| | | try |
| | | { |
| | | var getDoorLockTempPasswordData = new ZigBee.Device.DoorLock.GetDoorLockTempPasswordData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | getDoorLockTempPasswordData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | getDoorLockTempPasswordData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | getDoorLockTempPasswordData.LocalDoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | var result = await ZigBee.Device.DoorLock.GetDoorLockTempPasswordFromServer("DoorLock/GetDoorLockPwdPagger", getDoorLockTempPasswordData); |
| | | if (result != null && result.PageData != null) |
| | | { |
| | | foreach (var curDoorLockTempPaw in result.PageData) |
| | | { |
| | | var tpObj = new ZigBee.Device.DoorLock.TempPasswordObject(); |
| | | tpObj.UserId = int.Parse(curDoorLockTempPaw.TempPwdId); |
| | | tpObj.ValidTime = curDoorLockTempPaw.ValidBeginTime; |
| | | tpObj.InValidTime = curDoorLockTempPaw.ValidEndTime; |
| | | doorLock.LocalTempPassword = tpObj.TempPassword = curDoorLockTempPaw.TempPwd; |
| | | doorLock.tempPasswordObject = tpObj; |
| | | TimeDateData(doorLock.tempPasswordObject.ValidTime, doorLock.tempPasswordObject.InValidTime); |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MidFrameLayoutContent(); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | //本地时间数据处理 |
| | | void TimeDateData(DateTime validTimeDateTime, DateTime inValidTime, bool isClearLocalTime = false) |
| | | { |
| | | if (doorLock.tempPasswordObject != null) |
| | | { |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = validTimeDateTime.Hour; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = validTimeDateTime.Minute; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = validTimeDateTime.Second; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateYear = validTimeDateTime.Year; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth = validTimeDateTime.Month; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay = validTimeDateTime.Day; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = inValidTime.Hour; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = inValidTime.Minute; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = inValidTime.Second; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateYear = inValidTime.Year; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth = inValidTime.Month; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay = inValidTime.Day; |
| | | } |
| | | if (isClearLocalTime) |
| | | { |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = 100; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = 100; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = 0; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateYear = 0; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth = 0; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay = 0; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = 100; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = 100; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = 0; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateYear = 0; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth = 0; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay = 0; |
| | | } |
| | | } |
| | | |
| | | //时间显示数据处理 |
| | | void TimeDisplay(Button validTime, Button validTimeDate, Button inValidTime, Button inValidTimeDate, bool isDefaultTime) |
| | | { |
| | | string hour = ""; |
| | | string minute = ""; |
| | | 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; |
| | | } |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour < 10) |
| | | { |
| | | hour = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour; |
| | | } |
| | | else |
| | | { |
| | | hour = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour.ToString(); |
| | | } |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute < 10) |
| | | { |
| | | minute = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute; |
| | | } |
| | | else |
| | | { |
| | | minute = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute.ToString(); |
| | | } |
| | | //有效时间 |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour == 100) |
| | | { |
| | | validTime.Text = "00:00"; |
| | | } |
| | | else |
| | | { |
| | | validTime.Text = hour + ":" + minute; |
| | | } |
| | | |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour < 10) |
| | | { |
| | | hour = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour; |
| | | } |
| | | else |
| | | { |
| | | hour = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour.ToString(); |
| | | } |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute < 10) |
| | | { |
| | | minute = "0" + Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute; |
| | | } |
| | | else |
| | | { |
| | | minute = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute.ToString(); |
| | | } |
| | | |
| | | if (Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour == 100) |
| | | { |
| | | inValidTime.Text = "00:00"; |
| | | } |
| | | 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 ◆ 接口实现__________________________ |