From 1c4904d77f484c075080942d87785481b52b6fb2 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期一, 28 十月 2019 14:58:46 +0800 Subject: [PATCH] Revert "Merge branch 'dev-tzy' into DEV_GXC" --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs | 541 +++++++++-------------------------------------------- 1 files changed, 95 insertions(+), 446 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs index 7108033..cbcbdf3 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/TimeSettignPage.cs @@ -1,5 +1,4 @@ 锘縰sing System; -using System.Collections.Generic; using Shared.Common; using ZigBee.Device; @@ -7,45 +6,6 @@ { public class TimeSettignPage : DoorLockCommonLayout, ZigBee.Common.IStatus { - /// <summary> - /// 澶勭悊鍙樺寲浜嬩欢 - /// </summary> - /// <param name="common"></param> - /// <param name="typeTag"></param> - public void DeviceInfoChange(CommonDevice tempDevice, string typeTag) - { - if (typeTag == "DeviceStatusReport" && tempDevice != null) - { - if (tempDevice != null) - { - if (tempDevice.DeviceEpoint == doorLock.DeviceEpoint - && tempDevice.DeviceAddr == doorLock.DeviceAddr) - { - if (tempDevice.DeviceStatusReport != null && tempDevice.DeviceStatusReport.AttriBute != null) - { - var dataReport = tempDevice.DeviceStatusReport.AttriBute[0]; - if (tempDevice.DeviceStatusReport.CluterID == 10 && dataReport.AttributeId == 0) - { - CurentDoorLockTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(dataReport.AttriButeData); - Application.RunOnMainThread(() => - { - textDisplayDate.Text = CurentDoorLockTime.Year + Language.StringByID(R.MyInternationalizationString.Year) + CurentDoorLockTime.Month + Language.StringByID(R.MyInternationalizationString.Month) + CurentDoorLockTime.Day + Language.StringByID(R.MyInternationalizationString.Day); - if (CurentDoorLockTime.Minute < 10) - { - textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + "0" + CurentDoorLockTime.Minute; - } - else - { - textDisplayTime.Text = CurentDoorLockTime.Hour + ":" + CurentDoorLockTime.Minute; - } - }); - } - } - } - } - } - } - /// <summary> /// 鏋勯�犲嚱鏁� /// </summary> @@ -61,26 +21,9 @@ #region 鈼� 鍙橀噺鐢虫槑__________________________ ZigBee.Device.DoorLock doorLock; string setTimeType = ""; - DateTime CurentDoorLockTime; - Button textDisplayDate; - Button textDisplayTime; - int curYear = 0; - int curMonth = 0; - int curDay = 0; - int curHour = 0; - int curMin = 0; - int curSec = 0; - public Action timeSetAction; + Action<string> dateAction; //鏃ユ湡閫氱煡 + Action<string> timeAction; //鏃堕棿閫氱煡 #endregion - - /// <summary> - /// 閲嶅啓绉婚櫎鏂规硶 - /// </summary> - public override void RemoveFromParent() - { - ZbGateway.StatusList.Remove(this); - base.RemoveFromParent(); - } /// <summary> /// UI鏄剧ず @@ -91,18 +34,15 @@ { this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.ValidTime)); } - else if (setTimeType == "InValidTime") - { - this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.InValidTime)); - } else { - this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.DoorLockTime)); + this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.InValidTime)); + } EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => { - this.RemoveFromParent(); + RemoveFromParent(); }; this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; @@ -113,31 +53,17 @@ public void MidFrameLayoutContent() { - if (setTimeType == "DoorLockTime") - { - new System.Threading.Thread(() => - { - while (this.Parent != null) - { - doorLock.ReadAttri(ZigBee.Device.Cluster_ID.DoorLock, ZigBee.Device.AttriButeId.DoorLock); - System.Threading.Thread.Sleep(5 * 1000); - } - }) - { IsBackground = true }.Start(); - } - var MidTopFrameLayout = new FrameLayout() { BackgroundColor = ZigbeeColor.Current.XMWhite, }; this.midFrameLayout.AddChidren(MidTopFrameLayout); - var dtNow = DateTime.Now; for (int i = 0; i < 2; i++) { var btnDateTime = new Button() { - Width = Application.GetRealWidth(560), + Width = Application.GetRealWidth(743 - 300), Height = Application.GetRealHeight(58), X = Application.GetRealWidth(58), TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, @@ -146,30 +72,28 @@ }; MidTopFrameLayout.AddChidren(btnDateTime); - var textDisplayDateFrameLayout = new FrameLayout() + var textDisplay = new Button() { - Width = Application.GetRealWidth(333), + Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(620), + X = Application.GetRealWidth(580), + TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, + TextAlignment = TextAlignment.CenterRight, + TextSize = 12, }; - MidTopFrameLayout.AddChidren(textDisplayDateFrameLayout); - - var btnNextFrameLayout = new FrameLayout() - { - Width = Application.GetRealWidth(116), - Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(956), - }; - MidTopFrameLayout.AddChidren(btnNextFrameLayout); + MidTopFrameLayout.AddChidren(textDisplay); 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", }; - btnNextFrameLayout.AddChidren(btnNext); + MidTopFrameLayout.AddChidren(btnNext); var btnLine = new FrameLayout() { @@ -181,375 +105,92 @@ }; MidTopFrameLayout.AddChidren(btnLine); - if (setTimeType != "DoorLockTime") - { - textDisplayDateFrameLayout.Width = 0; - } - if (i == 0) { btnDateTime.Y = Application.GetRealHeight(50); + btnDateTime.Text = Language.StringByID(R.MyInternationalizationString.Date); btnLine.Y = Application.GetRealHeight(23 + 127); + textDisplay.Text = "8鏈�6鏃�"; + textDisplay.Y = btnNext.Y = btnDateTime.Y; - textDisplayDate = new Button() + EventHandler<MouseEventArgs> stattimeclick = (sender1, e1) => { - TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, - TextAlignment = TextAlignment.CenterRight, - TextSize = 12, - Text = "_" + Language.StringByID(R.MyInternationalizationString.Year) + "_" + Language.StringByID(R.MyInternationalizationString.Month) + "_" + Language.StringByID(R.MyInternationalizationString.Day), + var flMain = new FrameLayout { BackgroundColor = 0x00000000 }; + this.midFrameLayout.AddChidren(flMain); + + flMain.MouseUpEventHandler += (sender11, e11) => + { + flMain.RemoveFromParent(); + }; + + var timeview = new DateView + { + Y = Application.GetRealHeight(1920 - 800), + Height = Application.GetRealHeight(800), + BackgroundColor = ZigbeeColor.Current.LogicTimeViewColor, + Width = Application.GetRealWidth(1080), + }; + flMain.AddChidren(timeview); + + var btnSave = new Button + { + Y = Application.GetRealHeight(1920 - 800), + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(150), + Text = "瀹屾垚", + TextColor = ZigbeeColor.Current.LogicTimeViewSaveButton, + X = Application.GetRealWidth(1080 - 200), + }; + flMain.AddChidren(btnSave); }; - textDisplayDateFrameLayout.AddChidren(textDisplayDate); - textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = btnDateTime.Y; - - if (setTimeType != "DoorLockTime") - { - btnDateTime.Text = Language.StringByID(R.MyInternationalizationString.Date); - } - else - { - btnDateTime.Text = Language.StringByID(R.MyInternationalizationString.CurrentDate); - } + btnNext.MouseDownEventHandler += stattimeclick; } else if (i == 1) { btnDateTime.Y = Application.GetRealHeight(200); + btnDateTime.Text = Language.StringByID(R.MyInternationalizationString.Time); btnLine.Y = Application.GetRealHeight(40 + 127 + 127); - textDisplayTime = new Button() - { - TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, - TextAlignment = TextAlignment.CenterRight, - TextSize = 12, - Text = "00:00", - }; - textDisplayDateFrameLayout.AddChidren(textDisplayTime); - textDisplayDateFrameLayout.Y = btnNextFrameLayout.Y = btnDateTime.Y; + textDisplay.Text = "12 : 00"; + textDisplay.Y = btnNext.Y = btnDateTime.Y; - if (setTimeType != "DoorLockTime") + EventHandler<MouseEventArgs> endtimeclick = (sender, e) => { - btnDateTime.Text = Language.StringByID(R.MyInternationalizationString.Time); - } - else - { - btnDateTime.Text = Language.StringByID(R.MyInternationalizationString.CurrentTime); - } + var flMain = new FrameLayout { BackgroundColor = 0x00000000 }; + this.midFrameLayout.AddChidren(flMain); + flMain.MouseUpEventHandler += (sender11, e11) => + { + flMain.RemoveFromParent(); + }; + + var timeview = new TimeView() + { + Y = Application.GetRealHeight(1920 - 800), + Height = Application.GetRealHeight(800), + BackgroundColor = ZigbeeColor.Current.LogicTimeViewColor, + Width = Application.GetRealWidth(1080), + }; + flMain.AddChidren(timeview); + + var btnSave = new Button + { + Y = Application.GetRealHeight(1920 - 800), + Width = Application.GetRealWidth(200), + Height = Application.GetRealHeight(150), + Text = "瀹屾垚", + TextColor = ZigbeeColor.Current.LogicTimeViewSaveButton, + X = Application.GetRealWidth(1080 - 200), + }; + flMain.AddChidren(btnSave); + + btnSave.MouseUpEventHandler += (sender2, e2) => + { + flMain.RemoveFromParent(); + }; + }; + + btnNext.MouseDownEventHandler += endtimeclick; } - int curIndex = i; - EventHandler<MouseEventArgs> hander = (sender, e) => - { - this.midFrameLayout.AddChidren(this.shadowRadiusFrameLayout); - this.BottomRadiusFrameLayout(this); - - var mUIPickerView = new UIPickerView() - { - X = Application.GetRealWidth(0), - }; - 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(110); - 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 - 10; y < dtNow.Year + 1; y++) - { - mList1.Add(y.ToString()); - } - for (int m = 1; m < 13; m++) - { - mList2.Add(m.ToString()); - } - for (int d = 1; d < days; d++) - { - 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.XMGray3, - 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(); - }; - } - else - { - mUIPickerView.setNPicker(mList1, mList2, mList3); - mUIPickerView.setCurrentItems(dtNow.Year, 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++) - { - 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(curYear, 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(95); - 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.XMGray3, - 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(); - }; - } - } - }; - btnDateTime.MouseDownEventHandler += hander; - textDisplayDateFrameLayout.MouseDownEventHandler += hander; - btnNextFrameLayout.MouseDownEventHandler += hander; - btnNext.MouseDownEventHandler += hander; } - - btnCancel.MouseUpEventHandler += (sender1, e1) => - { - this.shadowRadiusFrameLayout.RemoveFromParent(); - }; - btnFinish.MouseUpEventHandler += async (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 && rectifyResult.setWritableValueResponData.Status == 0) - { - this.shadowRadiusFrameLayout.RemoveFromParent(); - // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RectifySuccess), 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); - } - } - catch { } - finally - { - System.Threading.Thread.Sleep(3000); - CommonPage.Loading.Hide(); - } - } - }; - this.shadowRadiusFrameLayout.MouseUpEventHandler += (sender1, e1) => - { - this.shadowRadiusFrameLayout.RemoveFromParent(); - }; - - //绛夊緟浠庨棬閿佷笂闈㈠姞杞藉嚭鐨勬椂闂� - //System.Threading.Thread.Sleep(1500); - //CommonPage.Loading.Hide(); - } #region 鈼� 鎺ュ彛瀹炵幇__________________________ @@ -563,6 +204,14 @@ } /// <summary> + /// 澶勭悊鍙樺寲浜嬩欢 + /// </summary> + /// <param name="common"></param> + /// <param name="typeTag"></param> + public void DeviceInfoChange(CommonDevice common, string typeTag) + { + } + /// <summary> /// Changeds the IL ogic status. /// </summary> /// <param name="logic">Logic.</param> -- Gitblit v1.8.0