From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3

---
 ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs |  143 +++++++++++++++++++++++++++++++----------------
 1 files changed, 94 insertions(+), 49 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs
index 5044d9c..2e82ac8 100755
--- a/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs
+++ b/ZigbeeApp/Shared/Phone/Device/CommonForm/SelectTime.cs
@@ -4,12 +4,12 @@
 
 namespace Shared.Phone.Device.CommonForm
 {
-    public class SelectTime:FrameLayout
+    public class SelectTime : FrameLayoutBase
     {
         public Action<int> TimeAction;
 
         Button TempSelectBtn;
-       
+
         Button TempTimeBtn;
 
         public int TempTime;
@@ -33,10 +33,10 @@
             var backgroundFL = new FrameLayout
             {
                 Y = Application.GetRealHeight(596),
-                Height = Application.GetRealHeight(1425),
-                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
-                Radius=(uint)Application.GetRealHeight(20)
+                Height = Application.GetRealHeight(1325),
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
             };
+            backgroundFL.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
             dialog.AddChidren(backgroundFL);
 
             var topView = new FrameLayout
@@ -47,64 +47,69 @@
 
             var cancle = new Button
             {
-                X=Application.GetRealWidth(80),
-                Width=Application.GetRealWidth(300),
+                X = Application.GetRealWidth(80),
+                Width = Application.GetRealWidth(300),
                 TextAlignment = TextAlignment.CenterLeft,
                 TextColor = ZigbeeColor.Current.GXCTextGrayColor,
-                TextID=R.MyInternationalizationString.Cancel,
-                TextSize=16
+                TextID = R.MyInternationalizationString.Cancel,
+                TextSize = 14
             };
             topView.AddChidren(cancle);
 
             var title = new Button
             {
                 Width = Application.GetRealWidth(300),
-                Gravity=Gravity.CenterHorizontal,
+                Gravity = Gravity.CenterHorizontal,
                 TextColor = ZigbeeColor.Current.GXCTextBlackColor2,
-                TextID=R.MyInternationalizationString.Delay,
+                TextID = R.MyInternationalizationString.Delay,
                 TextSize = 16
             };
             topView.AddChidren(title);
 
-            var confrim=new Button
+            var confrim = new Button
             {
-                X = Application.GetRealWidth(CommonFormResouce.AppRealWidth-80-300),
+                X = dialog.Width - Application.GetRealWidth(80 - 300),
                 Width = Application.GetRealWidth(300),
                 TextAlignment = TextAlignment.CenterRight,
                 TextColor = ZigbeeColor.Current.GXCTextSelectedColor2,
-                TextID = R.MyInternationalizationString.Confrim,
-                TextSize = 16
+                TextID = R.MyInternationalizationString.Complete,
+                TextSize = 14
             };
             topView.AddChidren(confrim);
+
+            var Line = new FrameLayout()
+            {
+                Y = topView.Height - 1,
+                Height = 1,
+                BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2
+            };
+            topView.AddChidren(Line);
 
             var timeLayout = new VerticalScrolViewLayout
             {
                 Y = Application.GetRealHeight(207),
-                Height = Application.GetRealHeight(703+127*2+12*2)
+                Height = Application.GetRealHeight(703 + 127 * 2 + 12 + 12),
+                ScrollEnabled = false,
+                VerticalScrollBarEnabled = false,
             };
             backgroundFL.AddChidren(timeLayout);
 
             TempSelectBtn = new Button();
             TempTimeBtn = new Button();
 
-            var unKe = new FrameLayout
-            {
-                Y = timeLayout.Bottom,
-                Height = Application.GetRealHeight(161),
-                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
-            };
-            backgroundFL.AddChidren(unKe);
 
             var notOpen = new Button
             {
                 X = Application.GetRealWidth(80),
+                Y = Application.GetRealHeight(1200),
+                Width = Application.GetRealWidth(800),
+                Height = Application.GetRealHeight(80),
                 TextColor = ZigbeeColor.Current.GXCTextGrayColor4,
                 TextID = R.MyInternationalizationString.NotOpen,
                 TextAlignment = TextAlignment.CenterLeft,
-                Gravity = Gravity.CenterVertical,
-                TextSize=16
+                TextSize = 14
             };
-            unKe.AddChidren(notOpen);
+            backgroundFL.AddChidren(notOpen);
 
             cancle.MouseUpEventHandler += Close;
             confrim.MouseUpEventHandler += Confrim_MouseEvent;
@@ -119,11 +124,10 @@
             tList.Add(60 * 30);
             tList.Add(60 * 60);
 
-            foreach(var t in tList)
+            foreach (var t in tList)
             {
                 AddTime(timeLayout, t);
             }
-
         }
 
         /// <summary>
@@ -134,52 +138,53 @@
         {
             var row = new FrameLayout
             {
-                Height = Application.GetRealHeight(127+12),
+                Height = Application.GetRealHeight(127 + 12),
                 BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
             };
             verticalScrolView.AddChidren(row);
 
             var trow = new FrameLayout
             {
-                Y=Application.GetRealHeight(12),
+                Y = Application.GetRealHeight(12),
                 Height = Application.GetRealHeight(127),
-                BackgroundColor=ZigbeeColor.Current.GXCBackgroundColor
+                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor
             };
             row.AddChidren(trow);
 
             var timeBtn = new Button
             {
                 X = Application.GetRealWidth(80),
-                Width=Application.GetRealWidth(500),
+                Width = Application.GetRealWidth(500),
                 TextAlignment = TextAlignment.CenterLeft,
                 TextColor = ZigbeeColor.Current.GXCTextGrayColor4,
                 SelectedTextColor = ZigbeeColor.Current.GXCTextBlackColor,
-                IsSelected=false
+                IsSelected = false,
+                TextSize = 14
             };
             trow.AddChidren(timeBtn);
 
             var selectBtn = new Button
             {
                 X = Application.GetRealWidth(942),
-                Width = Application.GetMinRealAverage(60),
-                Height=Application.GetMinRealAverage(60),
-                Gravity=Gravity.CenterVertical,
-                UnSelectedImagePath="Item/ItemSelected.png",
-                Visible=false
+                Width = this.GetPictrueRealSize(60),
+                Height = this.GetPictrueRealSize(60),
+                Gravity = Gravity.CenterVertical,
+                UnSelectedImagePath = "Item/ItemSelected.png",
+                Visible = false
             };
             trow.AddChidren(selectBtn);
 
             var Line = new FrameLayout()
             {
-                Y = trow.Height - 1,
+                Y = row.Height - 1,
                 Width = Application.GetRealWidth(919),
                 Height = 1,
-                Gravity=Gravity.CenterHorizontal,
+                Gravity = Gravity.CenterHorizontal,
                 BackgroundColor = Common.ZigbeeColor.Current.GXCGrayLineColor2
             };
-            trow.AddChidren(Line);
+            row.AddChidren(Line);
 
-           
+
             EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
             {
                 TempTimeBtn.IsSelected = false;
@@ -197,7 +202,7 @@
             timeBtn.MouseUpEventHandler += eventHandler;
             trow.MouseUpEventHandler += eventHandler;
 
-            timeBtn.Text =CommonFormResouce.GetTimeString(timess);
+            timeBtn.Text = this.GetTimeString(timess);
 
             if (timess == TempTime)
             {
@@ -209,15 +214,55 @@
 
         }
 
-
-       
+        /// <summary>
+        /// 鑾峰彇鍦烘櫙寤舵椂瀛楃涓�
+        /// </summary>
+        /// <param name="second"></param>
+        /// <returns></returns>
+        private string GetTimeString(int second)
+        {
+            if (second == 0)
+            {
+                return null;
+            }
+            string timeStr = string.Empty;
+            int hour = second / 3600;
+            int minu = second % 3600 / 60;
+            int sec = second % 60;
+            if (hour > 0)
+            {
+                timeStr += $"{hour}{Language.StringByID(R.MyInternationalizationString.Hour)}";
+                if (minu > 0)
+                {
+                    timeStr += $"{minu}{Language.StringByID(R.MyInternationalizationString.Minute)}";
+                }
+                if (sec > 0)
+                {
+                    timeStr += $"{sec}{Language.StringByID(R.MyInternationalizationString.Second)}";
+                }
+                return timeStr;
+            }
+            else if (minu > 0)
+            {
+                timeStr += $"{minu}{Language.StringByID(R.MyInternationalizationString.Minute)}";
+                if (sec > 0)
+                {
+                    timeStr += $"{sec}{Language.StringByID(R.MyInternationalizationString.Second)}";
+                }
+                return timeStr;
+            }
+            else
+            {
+                return $"{sec}{Language.StringByID(R.MyInternationalizationString.Second)}";
+            }
+        }
 
         /// <summary>
         /// Close
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="mouseEventArgs"></param>
-        private void Close(object sender,MouseEventArgs mouseEventArgs)
+        private void Close(object sender, MouseEventArgs mouseEventArgs)
         {
             RemoveFromParent();
         }
@@ -227,7 +272,7 @@
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="mouseEventArgs"></param>
-        private void Confrim_MouseEvent(object sender,MouseEventArgs mouseEventArgs)
+        private void Confrim_MouseEvent(object sender, MouseEventArgs mouseEventArgs)
         {
             TimeAction.Invoke(TempTime);
             RemoveFromParent();
@@ -238,11 +283,11 @@
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="mouseEventArgs"></param>
-        private void NotOpen_MouseEvent(object sender,MouseEventArgs mouseEventArgs)
+        private void NotOpen_MouseEvent(object sender, MouseEventArgs mouseEventArgs)
         {
             TimeAction.Invoke(0);
             RemoveFromParent();
         }
-       
+
     }
 }

--
Gitblit v1.8.0