| | |
| | | ZigBee.Device.ZbGateway.StatusList.Add(this); |
| | | } |
| | | |
| | | #region ◆ 变量申明__________________________ |
| | | #region 变量申明 |
| | | /// <summary> |
| | | /// 当前门锁 |
| | | /// </summary> |
| | | ZigBee.Device.DoorLock doorLock; |
| | | /// <summary> |
| | | /// 设置时间类型 |
| | | /// </summary> |
| | | string setTimeType = ""; |
| | | /// <summary> |
| | | /// 当前门锁时间 |
| | | /// </summary> |
| | | DateTime CurentDoorLockTime; |
| | | /// <summary> |
| | | /// 显示日期的文本 |
| | | /// </summary> |
| | | Button textDisplayDate; |
| | | /// <summary> |
| | | /// 显示时间的文本 |
| | | /// </summary> |
| | | Button textDisplayTime; |
| | | /// <summary> |
| | | /// 本地变量“年” |
| | | /// </summary> |
| | | int curYear = 0; |
| | | /// <summary> |
| | | /// 本地变量“月” |
| | | /// </summary> |
| | | int curMonth = 0; |
| | | /// <summary> |
| | | /// 本地变量“日” |
| | | /// </summary> |
| | | int curDay = 0; |
| | | /// <summary> |
| | | /// 本地变量“时” |
| | | /// </summary> |
| | | int curHour = 0; |
| | | /// <summary> |
| | | /// 本地变量“分” |
| | | /// </summary> |
| | | int curMin = 0; |
| | | /// <summary> |
| | | /// 本地变量“秒” |
| | | /// </summary> |
| | | int curSec = 0; |
| | | /// <summary> |
| | | /// 设置时间的Action |
| | | /// </summary> |
| | | public Action timeSetAction; |
| | | /// <summary> |
| | | /// 等待获取门锁时的等待时间 |
| | | /// </summary> |
| | | DateTime waitGetDoorLockTime = DateTime.MaxValue; |
| | | #endregion |
| | | |
| | |
| | | this.MidFrameLayout(this); |
| | | MidFrameLayoutContent(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 中部布局 |
| | | /// </summary> |
| | | public void MidFrameLayoutContent() |
| | | { |
| | | if (setTimeType == "DoorLockTime") |
| | |
| | | var dtNow = DateTime.Now; |
| | | for (int i = 0; i < 2; i++) |
| | | { |
| | | #region MidTopFrameLayout UI |
| | | var rowLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(127 + 23), |
| | |
| | | { |
| | | Width = Application.GetRealWidth(58), |
| | | Height = Application.GetRealHeight(58), |
| | | UnSelectedImagePath = "Item/Next.png", |
| | | UnSelectedImagePath = "Item/RightNext.png", |
| | | SelectedImagePath = "Item/Down.png", |
| | | }; |
| | | btnNextFrameLayout.AddChidren(btnNext); |
| | |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(btnLine); |
| | | #endregion |
| | | |
| | | #region 显示处理 |
| | | if (i == 0) |
| | | { |
| | | btnDateTime.Y = textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = Application.GetRealHeight(50); |
| | |
| | | } |
| | | btnLine.Visible = false; |
| | | } |
| | | #endregion |
| | | |
| | | #region 事件处理 |
| | | int curIndex = i; |
| | | EventHandler<MouseEventArgs> hander = (sender, e) => |
| | | { |
| | | this.midFrameLayout.AddChidren(this.shadowRadiusFrameLayout); |
| | | this.bottomRadiusFrameLayout.RemoveAll(); |
| | | this.BottomRadiusFrameLayout(this); |
| | | |
| | | var mUIPickerView = new UIPickerView() |
| | | { |
| | | X = Application.GetRealWidth(0), |
| | | Height = Application.GetRealHeight(440), |
| | | }; |
| | | this.bottomRadiusFrameLayout.AddChidren(mUIPickerView); |
| | | |
| | |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentDate; |
| | | } |
| | | |
| | | mUIPickerView.Y = Application.GetRealWidth(110); |
| | | mUIPickerView.Y = Application.GetRealWidth(245); |
| | | var mList1 = new List<string>(); |
| | | var mList2 = new List<string>(); |
| | | var mList3 = new List<string>(); |
| | |
| | | int year = dtNow.Year + 1; |
| | | int days = DateTime.DaysInMonth(dtNow.Year, dtNow.Month); |
| | | |
| | | for (int y = dtNow.Year - 10; y < dtNow.Year + 1; y++) |
| | | for (int y = dtNow.Year - 9; y < dtNow.Year + 1; y++) |
| | | { |
| | | mList1.Add(y.ToString()); |
| | | } |
| | | for (int m = 1; m < 13; m++) |
| | | { |
| | | mList2.Add(m.ToString()); |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList2.Add(m.ToString() + "月"); |
| | | } |
| | | else |
| | | { |
| | | mList2.Add(m.ToString()); |
| | | } |
| | | } |
| | | for (int d = 1; d < days + 1; d++) |
| | | { |
| | | mList3.Add(d.ToString()); |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList3.Add(d.ToString() + "日"); |
| | | } |
| | | else |
| | | { |
| | | mList3.Add(d.ToString()); |
| | | } |
| | | } |
| | | |
| | | if (setTimeType != "DoorLockTime") |
| | |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(101), |
| | | Text = Language.StringByID(R.MyInternationalizationString.Complete), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMOrange, |
| | | TextSize = 14, |
| | | }; |
| | | this.bottomRadiusFrameLayout.AddChidren(btnOk); |
| | |
| | | else |
| | | { |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | mUIPickerView.setCurrentItems(dtNow.Year, dtNow.Month - 1, dtNow.Day - 1); |
| | | mUIPickerView.setCurrentItems(9, dtNow.Month - 1, dtNow.Day - 1); |
| | | curYear = dtNow.Year; |
| | | curMonth = dtNow.Month; |
| | | curDay = dtNow.Day; |
| | |
| | | |
| | | for (int d = 1; d < days + 1; d++) |
| | | { |
| | | mList3.Add(d.ToString()); |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList3.Add(d.ToString() + "日"); |
| | | } |
| | | else |
| | | { |
| | | mList3.Add(d.ToString()); |
| | | } |
| | | } |
| | | |
| | | if (setTimeType != "DoorLockTime") |
| | |
| | | else |
| | | { |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | mUIPickerView.setCurrentItems(curYear, curMonth - 1, curDay - 1); |
| | | mUIPickerView.setCurrentItems(9, curMonth - 1, curDay - 1); |
| | | } |
| | | } |
| | | }; |
| | |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentTime; |
| | | } |
| | | |
| | | mUIPickerView.Y = Application.GetRealWidth(95); |
| | | mUIPickerView.Y = Application.GetRealWidth(245); |
| | | var mList1 = new List<string>(); |
| | | var mList2 = new List<string>(); |
| | | for (int h = 0; h < 24; h++) |
| | |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(101), |
| | | Text = Language.StringByID(R.MyInternationalizationString.Complete), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMOrange, |
| | | TextSize = 14, |
| | | }; |
| | | this.bottomRadiusFrameLayout.AddChidren(btnOk); |
| | |
| | | textDisplayDateFrameLayout.MouseDownEventHandler += hander; |
| | | btnNextFrameLayout.MouseDownEventHandler += hander; |
| | | btnNext.MouseDownEventHandler += hander; |
| | | |
| | | if (curIndex == 0) |
| | | { |
| | | textDisplayDate.MouseDownEventHandler += hander; |
| | | } |
| | | else |
| | | { |
| | | textDisplayTime.MouseDownEventHandler += hander; |
| | | } |
| | | #endregion |
| | | } |
| | | |
| | | btnCancel.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | this.shadowRadiusFrameLayout.RemoveFromParent(); |
| | | }; |
| | | btnFinish.MouseUpEventHandler += async (sender1, e1) => |
| | | btnFinish.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | if (setTimeType == "DoorLockTime") |
| | | { |
| | | var curDateTime = new DateTime(curYear, curMonth, curDay, curHour, curMin, curSec); |
| | | var setTimestamp = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetUnixTimeStamp(curDateTime); |
| | | try |
| | | { |
| | | CommonPage.Loading.Start(""); |
| | | var rectifyResult = await doorLock.RectifyDoorLockTimeAsync(int.Parse(setTimestamp)); |
| | | if (rectifyResult != null && rectifyResult.setWritableValueResponData != null) |
| | | { |
| | | System.Threading.Tasks.Task.Run(async () => { |
| | | try |
| | | { |
| | | if (rectifyResult.setWritableValueResponData.Status == 0) |
| | | var curDateTime = new DateTime(curYear, curMonth, curDay, curHour, curMin, curSec); |
| | | var setTimestamp = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetUnixTimeStamp(curDateTime); |
| | | Application.RunOnMainThread(() => { |
| | | CommonPage.Loading.Start(""); |
| | | }); |
| | | var rectifyResult = await doorLock.RectifyDoorLockTimeAsync(int.Parse(setTimestamp)); |
| | | if (rectifyResult != null && rectifyResult.setWritableValueResponData != null) |
| | | { |
| | | this.shadowRadiusFrameLayout.RemoveFromParent(); |
| | | Application.RunOnMainThread(() => { |
| | | if (rectifyResult.setWritableValueResponData.Status == 0) |
| | | { |
| | | doorLock.ReadAttri(ZigBee.Device.Cluster_ID.DoorLock, ZigBee.Device.AttriButeId.DoorLock); |
| | | System.Threading.Thread.Sleep(1000); |
| | | this.shadowRadiusFrameLayout.RemoveFromParent(); |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RectifyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | } |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RectifyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | Application.RunOnMainThread(() => { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Hide(); }); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | System.Threading.Thread.Sleep(3000); |
| | | CommonPage.Loading.Hide(); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | this.shadowRadiusFrameLayout.MouseUpEventHandler += (sender1, e1) => |
| | |
| | | } |
| | | } |
| | | |
| | | #region ◆ 接口实现__________________________ |
| | | #region 接口实现 |
| | | /// <summary> |
| | | /// 处理变化事件 --将弃用 改用DeviceInfoChange() |
| | | /// </summary> |