wei
2020-12-22 d07d62be7111d78b2aaa44c9cdee23a7d22b4dda
HDL_ON/Entity/Function/Scene.cs
old mode 100755 new mode 100644
@@ -35,7 +35,7 @@
        /// <summary>
        /// 云端唯一ID
        /// </summary>
        public string userSceneId = "";
        public string userSceneId = null;
        /// <summary>
        /// 场景sid
        /// </summary>
@@ -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,51 @@
                return "SceneData_" + sid;
            }
        }
        /// <summary>
        /// 场景执行\倒计时
        /// </summary>
        /// <param name="btnShowDelay"></param>
        public void SceneCountDown(Button btnShowDelay)
        {
            //场景正在倒计时执行中
            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)
                                    {
                                        btnShowDelay.Text = (time / 60).ToString() + "min" + time % 60 + "s";
                                    }
                                    else
                                    {
                                        btnShowDelay.Text = time.ToString() + "s";
                                    }
                                });
                                System.Threading.Thread.Sleep(1000);
                                time--;
                            }
                            Application.RunOnMainThread(() =>
                            {
                                btnShowDelay.Text = "";
                            });
                        }
                    })
                    { IsBackground = true, Priority = System.Threading.ThreadPriority.BelowNormal }.Start();
                }
            }
        }
        /// <summary>
        /// 保存功能数据