| | |
| | | using System; |
| | | using Java.Sql; |
| | | using Shared.Common; |
| | | using ZigBee.Device; |
| | | |
| | |
| | | ZigBee.Device.DoorLock doorLock; |
| | | public System.Collections.Generic.List<Button> pawButtonList = new System.Collections.Generic.List<Button> { };//临时密码中的6位数字 |
| | | Button passwordText; //临时密码 |
| | | FrameLayout MidTopFrameLayout; |
| | | #endregion |
| | | |
| | | /// <summary>
|
| | |
| | | this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; |
| | | this.MidFrameLayout(this); |
| | | |
| | | MidFrameLayoutContent(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读门锁临时密码信息 |
| | | /// </summary> |
| | | /// <param name="door_lock">Door lock.</param> |
| | | void readStatus() |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => |
| | | 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) => |
| | | { |
| | | ZigBee.Device.DoorLock.LocalTempPassword = ""; |
| | | dialog.Close(); |
| | | }; |
| | | delBackgroundFrameLayout.MouseDownEventHandler += eHandler2; |
| | | btnDelIcon2.MouseDownEventHandler += eHandler2; |
| | | btnDelText.MouseDownEventHandler += eHandler2; |
| | | }; |
| | | btnDelFrameLayout.MouseDownEventHandler += eHandler; |
| | | btnDelIcon.MouseDownEventHandler += eHandler; |
| | | |
| | | 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, |
| | | }; |
| | | 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), |
| | | Width = Application.GetRealWidth(118), |
| | | X = Application.GetRealWidth(507), |
| | | Y = Application.GetRealHeight(389), |
| | | Text = "10:00", |
| | | 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 数据处理 |
| | | string hour = ""; |
| | | string minute = ""; |
| | | 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.ValidDateMinute.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); |
| | | |
| | | if (string.IsNullOrEmpty(ZigBee.Device.DoorLock.LocalTempPassword)) |
| | | { |
| | | randomPassword.Text = "- - - - - -"; |
| | | temPasswordVisiable.Visible = false; |
| | | randomPassword.X = Application.GetRealWidth(215); |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMGray4; |
| | | } |
| | | else |
| | | { |
| | | randomPassword.Text = ZigBee.Device.DoorLock.LocalTempPassword; |
| | | temPasswordVisiable.Visible = true; |
| | | } |
| | | 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; |
| | | } |
| | | |
| | | topPic.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | randomPassword.Text = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetTempPassword(); |
| | | ZigBee.Device.DoorLock.LocalTempPassword = randomPassword.Text; |
| | | temPasswordVisiable.IsSelected = true; |
| | | temPasswordVisiable.Visible = true; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = true; |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMOrange; |
| | | }; |
| | | 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(); |
| | | ZigBee.Device.DoorLock.LocalTempPassword = randomPassword.Text; |
| | | randomPassword.SecureTextEntry = false; |
| | | temPasswordVisiable.IsSelected = true; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InTempPasswordVisiable = true; |
| | | randomPassword.TextColor = Shared.Common.ZigbeeColor.Current.XMOrange; |
| | | }; |
| | | |
| | | EventHandler<MouseEventArgs> handerValidTimeDateSet = (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(); |
| | | |
| | | tempPage.timeSetAction += () => |
| | | { |
| | | MidFrameLayoutContent(); |
| | | }; |
| | | }; |
| | | validTimeDate.MouseUpEventHandler += handerValidTimeDateSet; |
| | | validTime.MouseUpEventHandler += handerValidTimeDateSet; |
| | | EventHandler<MouseEventArgs> handerInValidTimeSet = (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(); |
| | | tempPage.timeSetAction += () => |
| | | { |
| | | MidFrameLayoutContent(); |
| | | }; |
| | | }; |
| | | inValidTime.MouseUpEventHandler += handerInValidTimeSet; |
| | | inValidTimeDate.MouseUpEventHandler += handerInValidTimeSet; |
| | | #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) => |
| | | } |
| | | int curIndex = i; |
| | | EventHandler<MouseEventArgs> hander = (sender, e) => |
| | | { |
| | | 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(); |
| | | }; |
| | | } |
| | | else if (i == 2) |
| | | { |
| | | btnValidTime.Y = Application.GetRealHeight(481); |
| | | btnValidTime.Text = Language.StringByID(R.MyInternationalizationString.ClearTempPassword); |
| | | btnNext.Y = btnValidTime.Y; |
| | | btnLine.Y = Application.GetRealHeight(1025 - 449); |
| | | } |
| | | tempPage.timeSetAction += () => |
| | | { |
| | | MidFrameLayoutContent(); |
| | | }; |
| | | } |
| | | }; |
| | | btnValidTime.MouseDownEventHandler += hander; |
| | | btnModifyText.MouseDownEventHandler += hander; |
| | | btnNextFrameLayout.MouseDownEventHandler += hander; |
| | | btnNext.MouseDownEventHandler += hander; |
| | | } |
| | | |
| | | var 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.XMBlack, |
| | | //BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | TextSize = 16, |
| | | }; |
| | | bottomFrameLayout.AddChidren(btnFinifh); |
| | | |
| | | //var bottomLine = new Button() |
| | | //{ |
| | | // Height = Application.GetRealHeight(1), |
| | | // BackgroundColor = 0xff000000, |
| | | //}; |
| | | //bottomFrameLayout.AddChidren(bottomLine); |
| | | btnFinifh.MouseUpEventHandler += async (sender, e) => |
| | | { |
| | | FinifhEventHandler(btnFinifh); |
| | | }; |
| | | |
| | | //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(); |
| | | // } |
| | | // } |
| | | // } |
| | | //}; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 生成6位临时密码 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetTempPassword() |
| | | //确定事件处理 |
| | | async private void FinifhEventHandler(Button btnFinifh) |
| | | { |
| | | string password = ""; |
| | | password = new Random().Next(100000, 999999).ToString(); |
| | | return password; |
| | | if (ZigBee.Device.DoorLock.LocalTempPassword == "") |
| | | { |
| | | //请"点击生成"临时密码; |
| | | 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) |
| | | { |
| | | //请设置生效时间; |
| | | 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) |
| | | { |
| | | //请设置生效日期; |
| | | 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) |
| | | { |
| | | 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) |
| | | { |
| | | 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); |
| | | var result = await doorLock.TempPasswordAsync(ZigBee.Device.DoorLock.LocalTempPassword, validDateTime, inValidDateTime); |
| | | if (result != null && result.responseData != null && result.responseData.status == 0) |
| | | { |
| | | var aa = 0; |
| | | } |
| | | else |
| | | { |
| | | //失败 |
| | | } |
| | | } |
| | | |
| | | //生成随机数事件处理 |
| | | private void RandomPasswordMouseUpEventHandler(Button randomPassword) |
| | | { |
| | | |
| | | } |
| | | |
| | | #region ◆ 接口实现__________________________ |