From d6aec3027ebec50e1096af7da19d03b1e5f5bea4 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期六, 19 十二月 2020 21:33:00 +0800
Subject: [PATCH] 20201219-99

---
 HDL_ON/Entity/Function/Scene.cs |   85 +++++++++++++++++++++++++++---------------
 1 files changed, 55 insertions(+), 30 deletions(-)

diff --git a/HDL_ON/Entity/Function/Scene.cs b/HDL_ON/Entity/Function/Scene.cs
index 639997f..c6ad0eb 100644
--- a/HDL_ON/Entity/Function/Scene.cs
+++ b/HDL_ON/Entity/Function/Scene.cs
@@ -64,36 +64,10 @@
         /// 寤舵椂
         /// </summary>
         public string delay = "0";
-        ///// <summary>
-        ///// 寤舵椂鏄剧ず鐨勬枃鏈�
-        ///// </summary>
-        //[Newtonsoft.Json.JsonIgnore]
-        //public string delayText
-        //{
-        //    get
-        //    {
-        //        string text = "";
-        //        switch (delay)
-        //        {
-        //            case 0:
-        //                text = Language.StringByID(StringId.NoDelay);
-        //                break;
-        //            case 30:
-        //                text = "30s";
-        //                break;
-        //            case 60:
-        //                text = "1min";
-        //                break;
-        //            case 120:
-        //                text = "2min";
-        //                break;
-        //            case 300:
-        //                text = "5min";
-        //                break;
-        //        }
-        //        return text;
-        //    }
-        //}
+        /// <summary>
+        /// 鍦烘櫙鐨勬渶濂戒竴娆℃墽琛屾椂闂�
+        /// </summary>
+        public string LastExecutionTime = "";
 
         /// <summary>
         /// 鍦烘櫙鍒嗙粍
@@ -239,6 +213,57 @@
                 return "SceneData_" + sid;
             }
         }
+        /// <summary>
+        /// 鍦烘櫙鎵ц\鍊掕鏃�
+        /// </summary>
+        /// <param name="btnShowDelay"></param>
+        public void SceneCountDown(Button btnShowDelay)
+        {
+            //鍦烘櫙姝e湪鍊掕鏃舵墽琛屼腑
+            if (LastExecutionTime != "" && Convert.ToDouble(LastExecutionTime) + Convert.ToDouble(delay) > Convert.ToDouble(Utlis.GetTimestamp(false)))
+            {
+                int time = 0;
+                int.TryParse(Convert.ToInt32(
+                    Convert.ToDouble(LastExecutionTime) + Convert.ToDouble(delay) - Convert.ToDouble(Utlis.GetTimestamp(false))
+                    ).ToString(), out time);
+                if (time > 0)
+                {
+                    new System.Threading.Thread(() =>
+                    {
+                        if (time > 0)
+                        {
+                            while (time > 0)
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    if (time / 60 > 1)
+                                    {
+                                        btnShowDelay.Text = (time / 60).ToString() + "min";
+                                    }
+                                    else
+                                    {
+                                        btnShowDelay.Text = (time--).ToString() + "s";
+                                    }
+                                });
+                                if (time / 60 > 1)
+                                {
+                                    System.Threading.Thread.Sleep(time / 60 * 60000);
+                                }
+                                else
+                                {
+                                    System.Threading.Thread.Sleep(1000);
+                                }
+                            }
+                            Application.RunOnMainThread(() =>
+                            {
+                                btnShowDelay.Text = "";
+                            });
+                        }
+                    })
+                    { IsBackground = true, Priority = System.Threading.ThreadPriority.BelowNormal }.Start();
+                }
+            }
+        }
 
         /// <summary>
         /// 淇濆瓨鍔熻兘鏁版嵁

--
Gitblit v1.8.0