From b621c50182f42a095b75fc08584240905e22d944 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 24 三月 2021 15:24:20 +0800
Subject: [PATCH] 2021-03-24 1.修改时间选择控件不调用系统的时间选择器,实现自定义时间选择器。   2.优化注册和忘记密码页面,增加倒计时和重发按钮功能

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs |  220 +++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 167 insertions(+), 53 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs
index e96a79f..6046110 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Schedule/AddSchedule.cs
@@ -177,65 +177,69 @@
             timeView.AddChidren (btnTimelbl);
 
             btnTimelbl.MouseUpEventHandler += (timeSender, eee) => {
-                var dialog = new Dialog ();
-                var chooseTimeBodyView = new FrameLayout () {
-                };
-                dialog.AddChidren (chooseTimeBodyView);
 
-                var chooseTime = new TimeView () {
-                    Y = Application.GetRealHeight (1136 - 420 - 90),
-                    Height = Application.GetRealHeight (420),
-                    BackgroundColor = 0xFFD7D7D7,
-                    //BackgroundColor = SkinStyle.Current.ViewColor,
-                };
-                chooseTimeBodyView.AddChidren (chooseTime);
+                ShowTimePickerView (btnTimelbl);
+                return;
 
-                var bottomView = new FrameLayout () {
-                    Y = chooseTime.Bottom,
-                    Height = Application.GetRealHeight (90) + 1,
-                    BackgroundColor = 0xFFD7D7D7,
-                };
-                chooseTimeBodyView.AddChidren (bottomView);
+                //var dialog = new Dialog ();
+                //var chooseTimeBodyView = new FrameLayout () {
+                //};
+                //dialog.AddChidren (chooseTimeBodyView);
 
-                var btnCloseTime = new Button () {
-                    Y = 1,
-                    Width = Application.GetRealWidth (320),
-                    BackgroundColor = SkinStyle.Current.ViewColor,
-                    TextID = R.MyInternationalizationString.Close,
-                    TextAlignment = TextAlignment.Center,
-                    TextColor = SkinStyle.Current.TextColor1,
-                };
-                bottomView.AddChidren (btnCloseTime);
-                btnCloseTime.MouseUpEventHandler += (ddf, dddf) => {
-                    chooseTimeBodyView.RemoveAll ();
-                    chooseTimeBodyView.RemoveFromParent ();
-                    dialog.Close ();
-                };
+                //var chooseTime = new TimeView () {
+                //    Y = Application.GetRealHeight (1136 - 420 - 90),
+                //    Height = Application.GetRealHeight (420),
+                //    BackgroundColor = 0xFFD7D7D7,
+                //    //BackgroundColor = SkinStyle.Current.ViewColor,
+                //};
+                //chooseTimeBodyView.AddChidren (chooseTime);
 
-                var btnSaveTime = new Button () {
-                    X = btnCloseTime.Right + 1,
-                    Y = 1,
-                    Width = Application.GetRealWidth (320),
-                    TextID = R.MyInternationalizationString.SAVE,
-                    BackgroundColor = SkinStyle.Current.ViewColor,
-                    TextAlignment = TextAlignment.Center,
-                    TextColor = SkinStyle.Current.TextColor1,
-                };
-                bottomView.AddChidren (btnSaveTime);
-                btnSaveTime.MouseUpEventHandler += (sender3, e3) => {
-                    // var chooseHour = chooseTime.Hour - timerTemp.TimeZone;
-                    var chooseTimeString = chooseTime.Hour.ToString ().PadLeft (2, '0') + ":" + chooseTime.Minute.ToString ().PadLeft (2, '0');
-                    //if (chooseTime.Hour > 12) {
-                    //    chooseTimeString = (chooseTime.Hour -12) + ":" + chooseTime.Minute + " PM";
-                    //} else {
-                    //    chooseTimeString = chooseTime.Hour + ":" + chooseTime.Minute + " AM";
-                    //}
-                    btnTimelbl.Text = chooseTimeString;
-                    dialog.Close ();
-                };
+                //var bottomView = new FrameLayout () {
+                //    Y = chooseTime.Bottom,
+                //    Height = Application.GetRealHeight (90) + 1,
+                //    BackgroundColor = 0xFFD7D7D7,
+                //};
+                //chooseTimeBodyView.AddChidren (bottomView);
+
+                //var btnCloseTime = new Button () {
+                //    Y = 1,
+                //    Width = Application.GetRealWidth (320),
+                //    BackgroundColor = SkinStyle.Current.ViewColor,
+                //    TextID = R.MyInternationalizationString.Close,
+                //    TextAlignment = TextAlignment.Center,
+                //    TextColor = SkinStyle.Current.TextColor1,
+                //};
+                //bottomView.AddChidren (btnCloseTime);
+                //btnCloseTime.MouseUpEventHandler += (ddf, dddf) => {
+                //    chooseTimeBodyView.RemoveAll ();
+                //    chooseTimeBodyView.RemoveFromParent ();
+                //    dialog.Close ();
+                //};
+
+                //var btnSaveTime = new Button () {
+                //    X = btnCloseTime.Right + 1,
+                //    Y = 1,
+                //    Width = Application.GetRealWidth (320),
+                //    TextID = R.MyInternationalizationString.SAVE,
+                //    BackgroundColor = SkinStyle.Current.ViewColor,
+                //    TextAlignment = TextAlignment.Center,
+                //    TextColor = SkinStyle.Current.TextColor1,
+                //};
+                //bottomView.AddChidren (btnSaveTime);
+                //btnSaveTime.MouseUpEventHandler += (sender3, e3) => {
+                //    // var chooseHour = chooseTime.Hour - timerTemp.TimeZone;
+                //    var chooseTimeString = chooseTime.Hour.ToString ().PadLeft (2, '0') + ":" + chooseTime.Minute.ToString ().PadLeft (2, '0');
+                //    //if (chooseTime.Hour > 12) {
+                //    //    chooseTimeString = (chooseTime.Hour -12) + ":" + chooseTime.Minute + " PM";
+                //    //} else {
+                //    //    chooseTimeString = chooseTime.Hour + ":" + chooseTime.Minute + " AM";
+                //    //}
+                //    btnTimelbl.Text = chooseTimeString;
+                //    dialog.Close ();
+                //};
 
 
-                dialog.Show ();
+                //dialog.Show ();
             };
             #endregion
 
@@ -729,6 +733,116 @@
             };
 
         }
+
+        /// <summary>
+        /// 鑷畾涔塗imePickerView
+        /// 2021-03-24
+        /// </summary>
+        void ShowTimePickerView (Button btnTimelbl)
+        {
+            var chooseTimeString = "00:00";
+            var dialog = new Dialog ();
+            var chooseTimeBodyView = new FrameLayout () {
+            };
+            dialog.AddChidren (chooseTimeBodyView);
+
+            var chooseTime = new UIPickerView () {
+                Y = Application.GetRealHeight (1136 - 420 - 90),
+                Height = Application.GetRealHeight (420),
+                BackgroundColor = 0xFFD7D7D7,
+                //BackgroundColor = SkinStyle.Current.ViewColor,
+            };
+            chooseTimeBodyView.AddChidren (chooseTime);
+
+            var bottomView = new FrameLayout () {
+                Y = chooseTime.Bottom,
+                Height = Application.GetRealHeight (90) + 1,
+                BackgroundColor = 0xFFD7D7D7,
+            };
+            chooseTimeBodyView.AddChidren (bottomView);
+
+            var btnCloseTime = new Button () {
+                Y = 1,
+                Width = Application.GetRealWidth (320),
+                BackgroundColor = SkinStyle.Current.ViewColor,
+                TextID = R.MyInternationalizationString.Close,
+                TextAlignment = TextAlignment.Center,
+                TextColor = SkinStyle.Current.TextColor1,
+            };
+            bottomView.AddChidren (btnCloseTime);
+            btnCloseTime.MouseUpEventHandler += (ddf, dddf) => {
+                chooseTimeBodyView.RemoveAll ();
+                chooseTimeBodyView.RemoveFromParent ();
+                dialog.Close ();
+            };
+
+            var btnSaveTime = new Button () {
+                X = btnCloseTime.Right + 1,
+                Y = 1,
+                Width = Application.GetRealWidth (320),
+                TextID = R.MyInternationalizationString.SAVE,
+                BackgroundColor = SkinStyle.Current.ViewColor,
+                TextAlignment = TextAlignment.Center,
+                TextColor = SkinStyle.Current.TextColor1,
+            };
+            bottomView.AddChidren (btnSaveTime);
+            btnSaveTime.MouseUpEventHandler += (sender3, e3) => {
+                btnTimelbl.Text = chooseTimeString;
+                dialog.Close ();
+            };
+
+            var nowDateTime = DateTime.Now;
+            var hour = nowDateTime.Hour;
+            //hourStr
+            var hourStr = hour.ToString();
+            if (hour < 10) {
+                hourStr = "0" + hour;
+            }
+
+            var minute = nowDateTime.Minute;
+            //minuteStr
+            var minuteStr = minute.ToString ();
+            if (minute < 10) {
+                minuteStr = "0" + minute;
+            }
+            var hourList = new List<string> ();
+            for (int i = 0; i < 24; i++) {
+                if (i < 10) {
+                    var a = "0" + i.ToString ();
+                    hourList.Add (a);
+                } else {
+                    hourList.Add (i.ToString ());
+                }
+
+            }
+
+            var minuteList = new List<string> ();
+            for (int i = 0; i < 60; i++) {
+                if (i < 10) {
+                    var a = "0" + i.ToString ();
+                    minuteList.Add (a);
+                } else {
+                    minuteList.Add (i.ToString ());
+                }
+
+            }
+
+            chooseTime.setNPicker (hourList, minuteList, null);
+            chooseTime.setCurrentItems (hour, minute, 0);
+            chooseTimeString = hourStr + ":" + minuteStr;
+
+            //string selectde = "";
+            chooseTime.OnSelectChangeEvent += (s1, s2, s3) => {
+                var hourV = hourList [s1];
+                var minuteV = minuteList [s2];
+                chooseTimeString = hourV + ":" + minuteV;
+
+            };
+
+            dialog.Show ();
+
+        }
+
         /// <summary>
         /// 鍔犺浇鎴块棿璁惧鍒楄〃鐣岄潰
         /// </summary>

--
Gitblit v1.8.0