| | |
| | | { |
| | | public class TimeSettignPage : DoorLockCommonLayout, ZigBee.Common.IStatus |
| | | { |
| | | #region 上报数据处理 |
| | | /// <summary> |
| | | /// 处理变化事件 |
| | | /// </summary> |
| | |
| | | var dataReport = tempDevice.DeviceStatusReport.AttriBute[0]; |
| | | if (tempDevice.DeviceStatusReport.CluterID == 10 && dataReport.AttributeId == 0) |
| | | { |
| | | CurentDoorLockTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(dataReport.AttriButeData); |
| | | CurentDoorLockTime = DoorLockCommonInfo.GetLocalTime(dataReport.AttriButeData); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | waitGetDoorLockTime = DateTime.MaxValue; |
| | |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 构造函数 |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | |
| | | this.doorLock = doorLock; |
| | | setTimeType = timeType; |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; |
| | | //读门锁时区时间 |
| | | DoorLockCommonInfo.GetDoorLockZoneTime(); |
| | | ZigBee.Device.ZbGateway.StatusList.Add(this); |
| | | } |
| | | #endregion |
| | | |
| | | #region UI内容 |
| | | #region 变量申明 |
| | | /// <summary> |
| | | /// 当前门锁 |
| | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 重写移除方法 |
| | | /// </summary> |
| | | public override void RemoveFromParent() |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | base.RemoveFromParent(); |
| | | } |
| | | |
| | | /// <summary>
|
| | | /// UI显示
|
| | | /// </summary> |
| | | public void Show() |
| | |
| | | this.MidFrameLayout(this); |
| | | MidFrameLayoutContent(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 中部布局 |
| | | /// </summary> |
| | |
| | | { |
| | | if (setTimeType == "DoorLockTime") |
| | | { |
| | | CommonPage.Loading.Start(""); |
| | | // 只有重新启动时会慢,然后其他时刻都是有值的 |
| | | new System.Threading.Thread(() => |
| | | { |
| | | while (this.Parent != null) |
| | | { |
| | | if (DateTime.Now > waitGetDoorLockTime) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | //读门锁时间 |
| | | //等待10秒,没有收到提示超时退出 |
| | | waitGetDoorLockTime = DateTime.Now.AddSeconds(+5); |
| | | doorLock.ReadAttri(ZigBee.Device.Cluster_ID.DoorLock, ZigBee.Device.AttriButeId.DoorLock); |
| | | System.Threading.Thread.Sleep(5 * 1000); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | ReadDoorlockTime(); |
| | | } |
| | | |
| | | var MidTopFrameLayout = new FrameLayout() |
| | | var zoneFrameLayout = new FrameLayout() |
| | | { |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | this.midFrameLayout.AddChidren(MidTopFrameLayout); |
| | | this.midFrameLayout.AddChidren(zoneFrameLayout); |
| | | |
| | | var dtNow = DateTime.Now; |
| | | if (setTimeType == "DoorLockTime") |
| | | { |
| | | zoneFrameLayout.Height = Application.GetRealHeight(150) + 1; |
| | | AddDoorLocksTimeRow(zoneFrameLayout); |
| | | } |
| | | else |
| | | { |
| | | zoneFrameLayout.Height = Application.GetRealHeight(0); |
| | | } |
| | | |
| | | var midTopFrameLayout = new FrameLayout() |
| | | { |
| | | Y = zoneFrameLayout.Bottom, |
| | | }; |
| | | this.midFrameLayout.AddChidren(midTopFrameLayout); |
| | | |
| | | var dtNow = DoorLockCommonInfo.DoorlockZoneTime;// DateTime.Now; |
| | | for (int i = 0; i < 2; i++) |
| | | { |
| | | #region MidTopFrameLayout UI |
| | |
| | | Height = Application.GetRealHeight(127 + 23), |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(rowLayout); |
| | | midTopFrameLayout.AddChidren(rowLayout); |
| | | |
| | | var btnDateTime = new Button() |
| | | { |
| | |
| | | X = Application.GetRealWidth(58), |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | }; |
| | | MidTopFrameLayout.AddChidren(btnLine); |
| | | midTopFrameLayout.AddChidren(btnLine); |
| | | #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); |
| | | |
| | | if (curIndex == 0) |
| | | { |
| | | //日期 |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.Date; |
| | | } |
| | | else |
| | | { |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentDate; |
| | | } |
| | | |
| | | mUIPickerView.Y = Application.GetRealWidth(245); |
| | | var mList1 = new List<string>(); |
| | | var mList2 = new List<string>(); |
| | | var mList3 = new List<string>(); |
| | | var oldMonth = dtNow.Month; |
| | | |
| | | int year = dtNow.Year + 1; |
| | | int days = DateTime.DaysInMonth(dtNow.Year, dtNow.Month); |
| | | |
| | | for (int y = dtNow.Year - 9; y < dtNow.Year + 1; y++) |
| | | { |
| | | mList1.Add(y.ToString()); |
| | | } |
| | | for (int m = 1; m < 13; m++) |
| | | { |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList2.Add(m.ToString() + "月"); |
| | | } |
| | | else |
| | | { |
| | | mList2.Add(m.ToString()); |
| | | } |
| | | } |
| | | for (int d = 1; d < days + 1; d++) |
| | | { |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList3.Add(d.ToString() + "日"); |
| | | } |
| | | else |
| | | { |
| | | mList3.Add(d.ToString()); |
| | | } |
| | | } |
| | | |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | mUIPickerView.setNPicker(mList2, mList3, null); |
| | | mUIPickerView.setCurrentItems(dtNow.Month - 1, dtNow.Day - 1, 0); |
| | | curMonth = dtNow.Month; |
| | | curDay = dtNow.Day; |
| | | |
| | | if (setTimeType == "ValidTime") |
| | | { |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateYear = dtNow.Year; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth = curMonth; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay = curDay; |
| | | } |
| | | else |
| | | { |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateYear = dtNow.Year; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth = curMonth; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay = curDay; |
| | | } |
| | | var btnOk = new Button |
| | | { |
| | | X = Application.GetRealWidth(919), |
| | | Y = Application.GetRealHeight(40), |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(101), |
| | | Text = Language.StringByID(R.MyInternationalizationString.Complete), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMOrange, |
| | | TextSize = 14, |
| | | }; |
| | | this.bottomRadiusFrameLayout.AddChidren(btnOk); |
| | | btnOk.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | if (setTimeType == "ValidTime") |
| | | { |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateYear = dtNow.Year; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMonth = curMonth; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateDay = curDay; |
| | | } |
| | | else |
| | | { |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateYear = dtNow.Year; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMonth = curMonth; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateDay = curDay; |
| | | } |
| | | if (timeSetAction != null) |
| | | { |
| | | timeSetAction(); |
| | | } |
| | | this.shadowRadiusFrameLayout.RemoveFromParent(); |
| | | MidFrameLayoutContent(); |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | mUIPickerView.setCurrentItems(9, dtNow.Month - 1, dtNow.Day - 1); |
| | | curYear = dtNow.Year; |
| | | curMonth = dtNow.Month; |
| | | curDay = dtNow.Day; |
| | | if (CurentDoorLockTime != null) |
| | | { |
| | | curHour = CurentDoorLockTime.Hour; |
| | | curMin = CurentDoorLockTime.Minute; |
| | | curSec = CurentDoorLockTime.Second; |
| | | } |
| | | else |
| | | { |
| | | curHour = dtNow.Hour; |
| | | curMin = dtNow.Minute; |
| | | curSec = dtNow.Second; |
| | | } |
| | | } |
| | | |
| | | Action dAction = () => |
| | | { |
| | | if (curMonth != oldMonth) |
| | | { |
| | | oldMonth = curMonth; |
| | | days = DateTime.DaysInMonth(curYear, curMonth); |
| | | mList3.Clear(); |
| | | |
| | | for (int d = 1; d < days + 1; d++) |
| | | { |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList3.Add(d.ToString() + "日"); |
| | | } |
| | | else |
| | | { |
| | | mList3.Add(d.ToString()); |
| | | } |
| | | } |
| | | |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | mUIPickerView.setNPicker(mList2, mList3, null); |
| | | mUIPickerView.setCurrentItems(curMonth - 1, curDay - 1, 0); |
| | | } |
| | | else |
| | | { |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | mUIPickerView.setCurrentItems(9, curMonth - 1, curDay - 1); |
| | | } |
| | | } |
| | | }; |
| | | mUIPickerView.OnSelectChangeEvent += (y, m, d) => |
| | | { |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | curYear = dtNow.Year; |
| | | curMonth = y + 1; |
| | | curDay = m + 1; |
| | | } |
| | | else |
| | | { |
| | | curYear = y + 2009; |
| | | curMonth = m + 1; |
| | | curDay = d + 1; |
| | | } |
| | | dAction(); |
| | | }; |
| | | } |
| | | if (curIndex == 1) |
| | | { |
| | | //时间 |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.Time; |
| | | } |
| | | else |
| | | { |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentTime; |
| | | } |
| | | |
| | | mUIPickerView.Y = Application.GetRealWidth(245); |
| | | var mList1 = new List<string>(); |
| | | var mList2 = new List<string>(); |
| | | for (int h = 0; h < 24; h++) |
| | | { |
| | | if (h < 10) |
| | | { |
| | | mList1.Add("0" + h.ToString()); |
| | | } |
| | | else |
| | | { |
| | | mList1.Add(h.ToString()); |
| | | } |
| | | } |
| | | for (int m = 0; m < 60; m++) |
| | | { |
| | | if (m < 10) |
| | | { |
| | | mList2.Add("0" + m.ToString()); |
| | | } |
| | | else |
| | | { |
| | | mList2.Add(m.ToString()); |
| | | } |
| | | } |
| | | mUIPickerView.setNPicker(mList1, mList2, null); |
| | | mUIPickerView.setCurrentItems(dtNow.Hour, dtNow.Minute, 0); |
| | | if (CurentDoorLockTime != null) |
| | | { |
| | | curYear = CurentDoorLockTime.Year; |
| | | curMonth = CurentDoorLockTime.Month; |
| | | curDay = CurentDoorLockTime.Day; |
| | | } |
| | | else |
| | | { |
| | | curYear = dtNow.Year; |
| | | curMonth = dtNow.Month; |
| | | curDay = dtNow.Day; |
| | | } |
| | | curHour = dtNow.Hour; |
| | | curMin = dtNow.Minute; |
| | | curSec = dtNow.Second; |
| | | mUIPickerView.OnSelectChangeEvent += (h, m, s) => |
| | | { |
| | | curHour = h; |
| | | curMin = m; |
| | | curSec = dtNow.Second; |
| | | }; |
| | | |
| | | if (setTimeType == "ValidTime") |
| | | { |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = curHour; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = curMin; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = curSec; |
| | | } |
| | | else |
| | | { |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = curHour; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = curMin; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = curSec; |
| | | } |
| | | |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | var btnOk = new Button |
| | | { |
| | | X = Application.GetRealWidth(919), |
| | | Y = Application.GetRealHeight(40), |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(101), |
| | | Text = Language.StringByID(R.MyInternationalizationString.Complete), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMOrange, |
| | | TextSize = 14, |
| | | }; |
| | | this.bottomRadiusFrameLayout.AddChidren(btnOk); |
| | | btnOk.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | if (setTimeType == "ValidTime") |
| | | { |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateHour = curHour; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateMinute = curMin; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.ValidDateSecond = curSec; |
| | | } |
| | | else |
| | | { |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateHour = curHour; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateMinute = curMin; |
| | | Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.InValidDateSecond = curSec; |
| | | } |
| | | if (timeSetAction != null) |
| | | { |
| | | timeSetAction(); |
| | | } |
| | | this.shadowRadiusFrameLayout.RemoveFromParent(); |
| | | MidFrameLayoutContent(); |
| | | }; |
| | | } |
| | | } |
| | | ClickHandle(curIndex, dtNow); |
| | | }; |
| | | rowLayout.MouseDownEventHandler += hander; |
| | | btnDateTime.MouseDownEventHandler += hander; |
| | |
| | | { |
| | | this.shadowRadiusFrameLayout.RemoveFromParent(); |
| | | }; |
| | | btnFinish.MouseUpEventHandler += (sender1, e1) => |
| | | btnFinish.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | if (setTimeType == "DoorLockTime") |
| | | { |
| | | System.Threading.Tasks.Task.Run(async () => { |
| | | try |
| | | { |
| | | 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) |
| | | { |
| | | 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 |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | }); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Hide(); }); |
| | | } |
| | | }); |
| | | { |
| | | DoorLockTimeFinishHandle(); |
| | | } |
| | | }; |
| | | this.shadowRadiusFrameLayout.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | this.shadowRadiusFrameLayout.RemoveFromParent(); |
| | | }; |
| | | |
| | | if (setTimeType == "DoorLockTime") |
| | | { |
| | | if (CurentDoorLockTime != null && CurentDoorLockTime.Year != 1) |
| | |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 接口实现 |
| | | #region 时区 |
| | | /// <summary> |
| | | /// 处理变化事件 --将弃用 改用DeviceInfoChange() |
| | | /// 添加【门锁时间】行(门锁专用) |
| | | /// </summary> |
| | | /// <returns>The changed.</returns> |
| | | /// <param name="common">Common.</param> |
| | | public void Changed(CommonDevice common) |
| | | /// <param name="zoneFrameLayout"></param> |
| | | private void AddDoorLocksTimeRow(FrameLayout zoneFrameLayout) |
| | | { |
| | | //门锁时间 |
| | | var rowLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(150), |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | zoneFrameLayout.AddChidren(rowLayout); |
| | | |
| | | //当前时区 |
| | | var btnCurZone = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(560), |
| | | Height = Application.GetRealHeight(58), |
| | | X = Application.GetRealWidth(58), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 12, |
| | | Y = Application.GetRealHeight(46), |
| | | Text = Language.StringByID(R.MyInternationalizationString.CurZone), |
| | | }; |
| | | rowLayout.AddChidren(btnCurZone); |
| | | |
| | | //哪个时区 |
| | | var textZone = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(333), |
| | | Height = Application.GetRealHeight(58), |
| | | X = Application.GetRealWidth(689), |
| | | Y = Application.GetRealHeight(46), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray4, |
| | | TextSize = 14, |
| | | }; |
| | | |
| | | rowLayout.AddChidren(textZone); |
| | | textZone.Text = zoneData(); |
| | | textZone.MouseDownEventHandler += (sender, e) => |
| | | { |
| | | //1、入网后先获取门锁在网关中的时区时间 |
| | | var curDateTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockZoneTime(); |
| | | //2、将时间设置到网关中 |
| | | var dateTime = new DateTime(curDateTime.Year, curDateTime.Month, curDateTime.Day, curDateTime.Hour, curDateTime.Minute, curDateTime.Second); |
| | | var setTimestamp = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetUnixTimeStamp(dateTime); |
| | | doorLock.RectifyDoorLockTimeAsync(int.Parse(setTimestamp)); |
| | | }; |
| | | |
| | | var btnLine = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(965), |
| | | Height = 1, |
| | | X = Application.GetRealWidth(58), |
| | | Y = Application.GetRealHeight(150), |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | }; |
| | | zoneFrameLayout.AddChidren(btnLine); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 时区数据 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private string zoneData() |
| | | { |
| | | string zoneText = ""; |
| | | int num = 0; |
| | | var gwZone = DoorLockCommonInfo.CaculateTimeZone(Common.Config.Instance.Home.Longitude); |
| | | if (int.Parse(gwZone) != 0) |
| | | { |
| | | num = int.Parse(gwZone.Substring(1)); |
| | | } |
| | | if (gwZone.Contains('+')) |
| | | { |
| | | if (num == 0) |
| | | { |
| | | zoneText = Language.StringByID(R.MyInternationalizationString.CurZoneText0); |
| | | } |
| | | else |
| | | { |
| | | zoneText = EastZoneList(num - 1); |
| | | } |
| | | } |
| | | else if (gwZone.Contains('-')) |
| | | { |
| | | zoneText = WestZoneList(num - 1); |
| | | } |
| | | else |
| | | { |
| | | zoneText = Language.StringByID(R.MyInternationalizationString.CurZoneText0); |
| | | } |
| | | return zoneText; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 转换东区 |
| | | /// </summary> |
| | | /// <param name="x"></param> |
| | | /// <returns></returns> |
| | | private string EastZoneList(int x) |
| | | { |
| | | var numString = new string[] |
| | | { |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText1), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText2), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText3), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText4), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText5), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText6), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText7), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText8), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText9), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText10), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText11), |
| | | Language.StringByID(R.MyInternationalizationString.CurZoneText12) |
| | | }; |
| | | var strChnNamesList = new List<string>(numString); |
| | | return strChnNamesList[x]; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 转换西区 |
| | | /// </summary> |
| | | /// <param name="x"></param> |
| | | /// <returns></returns> |
| | | private string WestZoneList(int x) |
| | | { |
| | | var numString = new string[] |
| | | { |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText1), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText2), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText3), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText4), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText5), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText6), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText7), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText8), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText9), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText10), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText11), |
| | | Language.StringByID(R.MyInternationalizationString.WestZoneText12) |
| | | }; |
| | | var strChnNamesList = new List<string>(numString); |
| | | return strChnNamesList[x]; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取时区 |
| | | /// <para>currentLon:"+"为东区,“-”为西区</para> |
| | | /// </summary> |
| | | /// <param name="currentLon"></param> |
| | | /// <returns></returns> |
| | | public static String CaculateTimeZone(double currentLon) |
| | | { |
| | | int timeZone; |
| | | int shangValue = (int)(currentLon / 15); |
| | | double yushuValue = Math.Abs(currentLon % 15); |
| | | if (yushuValue <= 7.5) |
| | | { |
| | | timeZone = shangValue; |
| | | } |
| | | else |
| | | { |
| | | timeZone = shangValue + (currentLon > 0 ? 1 : -1); |
| | | } |
| | | return timeZone >= 0 ? "+" + Math.Abs(timeZone) : "-" + Math.Abs(timeZone); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取所在时区的时间 |
| | | /// </summary> |
| | | /// <param name="unix"></param> |
| | | /// <returns></returns> |
| | | public static int GetLocalTime(int unix) |
| | | { |
| | | var gwZone = CaculateTimeZone(Common.Config.Instance.Home.Longitude); |
| | | var data = unix + 8 * 3600; |
| | | |
| | | return data; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 门锁时间 |
| | | /// <summary> |
| | | /// 读取门锁时间 |
| | | /// </summary> |
| | | private void ReadDoorlockTime() |
| | | { |
| | | CommonPage.Loading.Start(""); |
| | | // 只有重新启动时会慢,然后其他时刻都是有值的 |
| | | new System.Threading.Thread(() => |
| | | { |
| | | while (this.Parent != null) |
| | | { |
| | | if (DateTime.Now > waitGetDoorLockTime) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(CommonPage.Instance); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | | //读门锁时间 |
| | | //等待10秒,没有收到提示超时退出 |
| | | waitGetDoorLockTime = DateTime.Now.AddSeconds(+5); |
| | | doorLock.ReadAttri(ZigBee.Device.Cluster_ID.DoorLock, ZigBee.Device.AttriButeId.DoorLock); |
| | | System.Threading.Thread.Sleep(5 * 1000); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 门锁时间确认按钮处理 |
| | | /// </summary> |
| | | private void DoorLockTimeFinishHandle() |
| | | { |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | try |
| | | { |
| | | var curDateTime = new DateTime(curYear, curMonth, curDay, curHour, curMin, curSec); |
| | | var setTimestamp = DoorLockCommonInfo.GetUnixTimeStamp(curDateTime); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | CommonPage.Loading.Start(""); |
| | | }); |
| | | var rectifyResult = await doorLock.RectifyDoorLockTimeAsync(int.Parse(setTimestamp)); |
| | | if (rectifyResult != null && rectifyResult.setWritableValueResponData != null) |
| | | { |
| | | 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 |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | }); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Hide(); }); |
| | | } |
| | | }); |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region 公共事件处理 |
| | | /// <summary> |
| | | /// Changeds the IL ogic status. |
| | | /// 事件处理 |
| | | /// </summary> |
| | | /// <param name="logic">Logic.</param> |
| | | public void ChangedILogicStatus(ZigBee.Device.Logic logic) |
| | | private void ClickHandle(int curIndex, DateTime dtNow) |
| | | { |
| | | 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); |
| | | |
| | | if (curIndex == 0) |
| | | { |
| | | //日期 |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.Date; |
| | | } |
| | | else |
| | | { |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentDate; |
| | | } |
| | | |
| | | mUIPickerView.Y = Application.GetRealWidth(245); |
| | | var mList1 = new List<string>(); |
| | | var mList2 = new List<string>(); |
| | | var mList3 = new List<string>(); |
| | | var oldMonth = dtNow.Month; |
| | | |
| | | int year = dtNow.Year + 1; |
| | | int days = DateTime.DaysInMonth(dtNow.Year, dtNow.Month); |
| | | |
| | | for (int y = dtNow.Year - 9; y < dtNow.Year + 1; y++) |
| | | { |
| | | mList1.Add(y.ToString()); |
| | | } |
| | | for (int m = 1; m < 13; m++) |
| | | { |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList2.Add(m.ToString() + "月"); |
| | | } |
| | | else |
| | | { |
| | | mList2.Add(m.ToString()); |
| | | } |
| | | } |
| | | for (int d = 1; d < days + 1; d++) |
| | | { |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList3.Add(d.ToString() + "日"); |
| | | } |
| | | else |
| | | { |
| | | mList3.Add(d.ToString()); |
| | | } |
| | | } |
| | | |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | mUIPickerView.setNPicker(mList2, mList3, null); |
| | | mUIPickerView.setCurrentItems(dtNow.Month - 1, dtNow.Day - 1, 0); |
| | | curMonth = dtNow.Month; |
| | | curDay = dtNow.Day; |
| | | |
| | | if (setTimeType == "ValidTime") |
| | | { |
| | | DoorLockCommonInfo.ValidDateYear = dtNow.Year; |
| | | DoorLockCommonInfo.ValidDateMonth = curMonth; |
| | | DoorLockCommonInfo.ValidDateDay = curDay; |
| | | } |
| | | else |
| | | { |
| | | DoorLockCommonInfo.InValidDateYear = dtNow.Year; |
| | | DoorLockCommonInfo.InValidDateMonth = curMonth; |
| | | DoorLockCommonInfo.InValidDateDay = curDay; |
| | | } |
| | | var btnOk = new Button |
| | | { |
| | | X = Application.GetRealWidth(919), |
| | | Y = Application.GetRealHeight(40), |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(101), |
| | | Text = Language.StringByID(R.MyInternationalizationString.Complete), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMOrange, |
| | | TextSize = 14, |
| | | }; |
| | | this.bottomRadiusFrameLayout.AddChidren(btnOk); |
| | | btnOk.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | if (setTimeType == "ValidTime") |
| | | { |
| | | string nowValue1 = DateTime.Now.ToString("yyyyMMdd"); |
| | | string nowValue2 = dtNow.Year.ToString() + curMonth.ToString().PadLeft(2, '0') + curDay.ToString().PadLeft(2, '0'); |
| | | if (nowValue1.CompareTo(nowValue2) == 1)
|
| | | {
|
| | | var mess = Language.StringByID(R.MyInternationalizationString.ValidTimeNoLessThanCurrentTime); |
| | | this.ShowMassage(ShowMsgType.Error, mess);
|
| | | return;
|
| | | } |
| | | //检查时间 |
| | | var flage = this.CheckValidTime(dtNow.Year, curMonth, curDay, |
| | | DoorLockCommonInfo.ValidDateHour, DoorLockCommonInfo.ValidDateMinute, DoorLockCommonInfo.ValidDateSecond, |
| | | DoorLockCommonInfo.InValidDateYear, DoorLockCommonInfo.InValidDateMonth, DoorLockCommonInfo.InValidDateDay, |
| | | DoorLockCommonInfo.InValidDateHour, DoorLockCommonInfo.InValidDateMinute, DoorLockCommonInfo.InValidDateSecond); |
| | | if (flage == false)
|
| | | {
|
| | | var mess = Language.StringByID(R.MyInternationalizationString.ValidTimeNoMoreThanInValidTime); |
| | | this.ShowMassage(ShowMsgType.Error, mess);
|
| | | return;
|
| | | } |
| | | DoorLockCommonInfo.ValidDateYear = dtNow.Year; |
| | | DoorLockCommonInfo.ValidDateMonth = curMonth; |
| | | DoorLockCommonInfo.ValidDateDay = curDay; |
| | | } |
| | | else |
| | | {
|
| | | //检查时间
|
| | | var flage = this.CheckValidTime(DoorLockCommonInfo.ValidDateYear, DoorLockCommonInfo.ValidDateMonth, DoorLockCommonInfo.ValidDateDay, |
| | | DoorLockCommonInfo.ValidDateHour, DoorLockCommonInfo.ValidDateMinute, DoorLockCommonInfo.ValidDateSecond, |
| | | dtNow.Year, curMonth, curDay, |
| | | DoorLockCommonInfo.InValidDateHour, DoorLockCommonInfo.InValidDateMinute, DoorLockCommonInfo.InValidDateSecond); |
| | | if (flage == false)
|
| | | {
|
| | | var mess = Language.StringByID(R.MyInternationalizationString.InvalidTimeNoLessThanValidTime); |
| | | this.ShowMassage(ShowMsgType.Error, mess);
|
| | | return;
|
| | | }
|
| | | |
| | | DoorLockCommonInfo.InValidDateYear = dtNow.Year; |
| | | DoorLockCommonInfo.InValidDateMonth = curMonth; |
| | | DoorLockCommonInfo.InValidDateDay = curDay; |
| | | } |
| | | if (timeSetAction != null) |
| | | { |
| | | timeSetAction(); |
| | | } |
| | | this.shadowRadiusFrameLayout.RemoveFromParent(); |
| | | MidFrameLayoutContent(); |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | mUIPickerView.setCurrentItems(9, dtNow.Month - 1, dtNow.Day - 1); |
| | | curYear = dtNow.Year; |
| | | curMonth = dtNow.Month; |
| | | curDay = dtNow.Day; |
| | | if (CurentDoorLockTime != null) |
| | | { |
| | | curHour = CurentDoorLockTime.Hour; |
| | | curMin = CurentDoorLockTime.Minute; |
| | | curSec = CurentDoorLockTime.Second; |
| | | } |
| | | else |
| | | { |
| | | curHour = dtNow.Hour; |
| | | curMin = dtNow.Minute; |
| | | curSec = dtNow.Second; |
| | | } |
| | | } |
| | | |
| | | Action dAction = () => |
| | | { |
| | | if (curMonth != oldMonth) |
| | | { |
| | | oldMonth = curMonth; |
| | | days = DateTime.DaysInMonth(curYear, curMonth); |
| | | mList3.Clear(); |
| | | |
| | | for (int d = 1; d < days + 1; d++) |
| | | { |
| | | if (Language.CurrentLanguage == "Chinese") |
| | | { |
| | | mList3.Add(d.ToString() + "日"); |
| | | } |
| | | else |
| | | { |
| | | mList3.Add(d.ToString()); |
| | | } |
| | | } |
| | | |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | mUIPickerView.setNPicker(mList2, mList3, null); |
| | | mUIPickerView.setCurrentItems(curMonth - 1, curDay - 1, 0); |
| | | } |
| | | else |
| | | { |
| | | mUIPickerView.setNPicker(mList1, mList2, mList3); |
| | | mUIPickerView.setCurrentItems(9, curMonth - 1, curDay - 1); |
| | | } |
| | | } |
| | | }; |
| | | mUIPickerView.OnSelectChangeEvent += (y, m, d) => |
| | | { |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | curYear = dtNow.Year; |
| | | curMonth = y + 1; |
| | | curDay = m + 1; |
| | | } |
| | | else |
| | | { |
| | | switch (y) |
| | | { |
| | | case 0: |
| | | curYear = dtNow.Year - 9; |
| | | break; |
| | | case 1: |
| | | curYear = dtNow.Year - 8; |
| | | break; |
| | | case 2: |
| | | curYear = dtNow.Year - 7; |
| | | break; |
| | | case 3: |
| | | curYear = dtNow.Year - 6; |
| | | break; |
| | | case 4: |
| | | curYear = dtNow.Year - 5; |
| | | break; |
| | | case 5: |
| | | curYear = dtNow.Year - 4; |
| | | break; |
| | | case 6: |
| | | curYear = dtNow.Year - 3; |
| | | break; |
| | | case 7: |
| | | curYear = dtNow.Year - 2; |
| | | break; |
| | | case 8: |
| | | curYear = dtNow.Year - 1; |
| | | break; |
| | | default: |
| | | curYear = dtNow.Year; |
| | | break; |
| | | } |
| | | curMonth = m + 1; |
| | | curDay = d + 1; |
| | | } |
| | | dAction(); |
| | | }; |
| | | } |
| | | if (curIndex == 1) |
| | | { |
| | | //时间 |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.Time; |
| | | } |
| | | else |
| | | { |
| | | this.btnBottomTitle.TextID = R.MyInternationalizationString.CurrentTime; |
| | | } |
| | | |
| | | mUIPickerView.Y = Application.GetRealWidth(245); |
| | | var mList1 = new List<string>(); |
| | | var mList2 = new List<string>(); |
| | | for (int h = 0; h < 24; h++) |
| | | { |
| | | if (h < 10) |
| | | { |
| | | mList1.Add("0" + h.ToString()); |
| | | } |
| | | else |
| | | { |
| | | mList1.Add(h.ToString()); |
| | | } |
| | | } |
| | | for (int m = 0; m < 60; m++) |
| | | { |
| | | if (m < 10) |
| | | { |
| | | mList2.Add("0" + m.ToString()); |
| | | } |
| | | else |
| | | { |
| | | mList2.Add(m.ToString()); |
| | | } |
| | | } |
| | | mUIPickerView.setNPicker(mList1, mList2, null); |
| | | mUIPickerView.setCurrentItems(dtNow.Hour, dtNow.Minute, 0); |
| | | if (CurentDoorLockTime != null) |
| | | { |
| | | curYear = CurentDoorLockTime.Year; |
| | | curMonth = CurentDoorLockTime.Month; |
| | | curDay = CurentDoorLockTime.Day; |
| | | } |
| | | else |
| | | { |
| | | curYear = dtNow.Year; |
| | | curMonth = dtNow.Month; |
| | | curDay = dtNow.Day; |
| | | } |
| | | curHour = dtNow.Hour; |
| | | curMin = dtNow.Minute; |
| | | curSec = dtNow.Second; |
| | | mUIPickerView.OnSelectChangeEvent += (h, m, s) => |
| | | { |
| | | curHour = h; |
| | | curMin = m; |
| | | curSec = dtNow.Second; |
| | | }; |
| | | |
| | | if (setTimeType == "ValidTime") |
| | | { |
| | | DoorLockCommonInfo.ValidDateHour = curHour; |
| | | DoorLockCommonInfo.ValidDateMinute = curMin; |
| | | DoorLockCommonInfo.ValidDateSecond = curSec; |
| | | } |
| | | else |
| | | { |
| | | DoorLockCommonInfo.InValidDateHour = curHour; |
| | | DoorLockCommonInfo.InValidDateMinute = curMin; |
| | | DoorLockCommonInfo.InValidDateSecond = curSec; |
| | | } |
| | | |
| | | if (setTimeType != "DoorLockTime") |
| | | { |
| | | var btnOk = new Button |
| | | { |
| | | X = Application.GetRealWidth(919), |
| | | Y = Application.GetRealHeight(40), |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(101), |
| | | Text = Language.StringByID(R.MyInternationalizationString.Complete), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMOrange, |
| | | TextSize = 14, |
| | | }; |
| | | this.bottomRadiusFrameLayout.AddChidren(btnOk); |
| | | btnOk.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | if (setTimeType == "ValidTime") |
| | | {
|
| | | var flage = this.CheckValidTime(DoorLockCommonInfo.ValidDateYear, DoorLockCommonInfo.ValidDateMonth, DoorLockCommonInfo.ValidDateDay,
|
| | | curHour, curMin, curSec, |
| | | DoorLockCommonInfo.InValidDateYear, DoorLockCommonInfo.InValidDateMonth, DoorLockCommonInfo.InValidDateDay, |
| | | DoorLockCommonInfo.InValidDateHour, DoorLockCommonInfo.InValidDateMinute, DoorLockCommonInfo.InValidDateSecond); |
| | | if (flage == false)
|
| | | {
|
| | | var mess = Language.StringByID(R.MyInternationalizationString.ValidTimeNoMoreThanInValidTime); |
| | | this.ShowMassage(ShowMsgType.Error, mess);
|
| | | return;
|
| | | } |
| | | |
| | | DoorLockCommonInfo.ValidDateHour = curHour; |
| | | DoorLockCommonInfo.ValidDateMinute = curMin; |
| | | DoorLockCommonInfo.ValidDateSecond = curSec; |
| | | } |
| | | else |
| | | {
|
| | | //检查时间
|
| | | var flage = this.CheckValidTime(DoorLockCommonInfo.ValidDateYear, DoorLockCommonInfo.ValidDateMonth, DoorLockCommonInfo.ValidDateDay,
|
| | | DoorLockCommonInfo.ValidDateHour, DoorLockCommonInfo.ValidDateMinute, DoorLockCommonInfo.ValidDateSecond, |
| | | DoorLockCommonInfo.InValidDateYear, DoorLockCommonInfo.InValidDateMonth, DoorLockCommonInfo.InValidDateDay, |
| | | curHour, curMin, curSec); |
| | | if (flage == false)
|
| | | {
|
| | | var mess = Language.StringByID(R.MyInternationalizationString.InvalidTimeNoLessThanValidTime); |
| | | this.ShowMassage(ShowMsgType.Error, mess);
|
| | | return;
|
| | | } |
| | | |
| | | DoorLockCommonInfo.InValidDateHour = curHour; |
| | | DoorLockCommonInfo.InValidDateMinute = curMin; |
| | | DoorLockCommonInfo.InValidDateSecond = curSec; |
| | | } |
| | | if (timeSetAction != null) |
| | | { |
| | | timeSetAction(); |
| | | } |
| | | this.shadowRadiusFrameLayout.RemoveFromParent(); |
| | | MidFrameLayoutContent(); |
| | | }; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 检查时间
|
| | | /// </summary>
|
| | | /// <returns></returns> |
| | | private bool CheckValidTime(int validYear, int validMoth, int validDay, int validHour, int validMinute, int validSecond |
| | | , int inValidYear, int inValidMoth, int inValidDay, int inValidHour, int inValidMinute, int inValidSecond)
|
| | | {
|
| | | //生效时间
|
| | | string nowValue1 = validYear.ToString()
|
| | | + validMoth.ToString().PadLeft(2, '0')
|
| | | + validDay.ToString().PadLeft(2, '0')
|
| | | + validHour.ToString().PadLeft(2, '0')
|
| | | + validMinute.ToString().PadLeft(2, '0')
|
| | | + validSecond.ToString().PadLeft(2, '0');
|
| | | //失效时间
|
| | | string nowValue2 = inValidYear.ToString()
|
| | | + inValidMoth.ToString().PadLeft(2, '0')
|
| | | + inValidDay.ToString().PadLeft(2, '0')
|
| | | + inValidHour.ToString().PadLeft(2, '0')
|
| | | + inValidMinute.ToString().PadLeft(2, '0')
|
| | | + inValidSecond.ToString().PadLeft(2, '0');
|
| | | var aaaa = nowValue1.CompareTo(nowValue2);
|
| | | if (nowValue1.CompareTo(nowValue2) == 1)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | return true;
|
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 移除方法 |
| | | /// <summary> |
| | | /// Changeds the IS cene status. |
| | | /// 重写移除方法 |
| | | /// </summary> |
| | | /// <param name="scene">Scene.</param> |
| | | public void ChangedISceneStatus(Scene scene) |
| | | public override void RemoveFromParent() |
| | | { |
| | | ZbGateway.StatusList.Remove(this); |
| | | base.RemoveFromParent(); |
| | | } |
| | | #endregion |
| | | } |