From 263401d40b2d9d2c1b36a24f33d45c5cb7192518 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 23 十二月 2020 15:51:54 +0800
Subject: [PATCH] 20201223-6

---
 HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs |   91 ++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 84 insertions(+), 7 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
old mode 100755
new mode 100644
index efac389..fd70da5
--- a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
@@ -133,15 +133,20 @@
                 Height = Application.GetMinRealAverage(28),
                 UnSelectedImagePath = "Public/AddIcon.png",
             };
-            topView.AddChidren(btnAddIconBg);
-
+            if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare)
+            {
+                topView.AddChidren(btnAddIconBg);
+            }
             btnAddIcon = new Button()
             {
                 X = Application.GetRealWidth(337-20),
                 Width = Application.GetMinRealAverage(28+30),
                 Height = Application.GetMinRealAverage(28+29),
             };
-            topView.AddChidren(btnAddIcon);
+            if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare)
+            {
+                topView.AddChidren(btnAddIcon);
+            }
             #endregion
 
             contentPageView = new PageLayout()
@@ -349,6 +354,19 @@
                 };
                 view.AddChidren(btnCoverd);
 
+                Button btnShowDelay;
+                btnShowDelay = new Button()
+                {
+                    X = Application.GetRealWidth(40),
+                    Y = Application.GetRealWidth(4),
+                    Height = Application.GetRealWidth(32),
+                    Width = Application.GetRealWidth(100),
+                    TextColor = CSS_Color.AuxiliaryColor1,
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                };
+                view.AddChidren(btnShowDelay);
+
                 Button btnName;
                 btnName = new Button()
                 {
@@ -387,7 +405,10 @@
                     Width = Application.GetRealWidth(32),
                     UnSelectedImagePath = "Public/FuncInfoSetIcon_white.png",
                 };
-                view.AddChidren(btnSettingIcon);
+                if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare)
+                {
+                    view.AddChidren(btnSettingIcon);
+                }
 
                 Button btnCollection;
                 btnCollection = new Button()
@@ -410,7 +431,7 @@
                     scene.collect = btnCollection.IsSelected = !btnCollection.IsSelected;
                     scene.CollectScene();
                 };
-                LoadEvent_ControlScene(btnCoverd,btnName,btnZone, scene);
+                LoadEvent_ControlScene(btnCoverd, btnName, btnZone, btnShowDelay, scene);
                 btnSettingIcon.MouseUpEventHandler = (sender, e) => {
                     Action backAction = () => {
                         LoadSceneFunctionControlZone(null);
@@ -426,6 +447,53 @@
                     aep.LoadPage(refreshAction);
                     MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                 };
+                //鍦烘櫙姝e湪鍊掕鏃舵墽琛屼腑
+                scene.SceneCountDown(btnShowDelay);
+
+                //if (scene.LastExecutionTime == "" || Convert.ToDouble(scene.LastExecutionTime) + Convert.ToDouble(scene.delay) < Convert.ToDouble(Utlis.GetTimestamp(false)))
+                //{
+                //    int time = 0;
+                //    int.TryParse(Convert.ToInt32(
+                //        Convert.ToDouble(scene.LastExecutionTime) + Convert.ToDouble(scene.delay) - Convert.ToDouble(Utlis.GetTimestamp(false))
+                //        ).ToString(),out time);
+                //    if (time > 0)
+                //    {
+                //        new System.Threading.Thread(() =>
+                //        {
+                //            //int time = Convert.ToInt32(scene.delay);
+                //            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();
+                //    }
+                //}
             }
             catch (Exception ex)
             {
@@ -440,7 +508,6 @@
         /// </summary>
         void LoadAutomationPageView()
         {
-            //btnAddIcon.RemoveFromParent();
             automationPage = new FrameLayout();
             contentPageView.AddChidren(automationPage);
             UI2.Intelligence.Automation.MainView.automationPage = automationPage;
@@ -557,14 +624,24 @@
         /// <summary>
         /// 鍔犺浇鍦烘櫙鎺у埗浜嬩欢
         /// </summary>
-        void LoadEvent_ControlScene(Button btnCoverd, Button btnName, Button btnZone, Scene scene)
+        void LoadEvent_ControlScene(Button btnCoverd, Button btnName, Button btnZone,Button btnShowDelay, Scene scene)
         {
 
             EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
             {
+                //鍦烘櫙姝e湪鍊掕鏃舵墽琛屼腑锛屼笉鍏佽鍐嶇偣鍑�
+                if (scene.LastExecutionTime == "" || Convert.ToDouble(scene.LastExecutionTime) + Convert.ToDouble(scene.delay) < Convert.ToDouble(Utlis.GetTimestamp(false)))
+                {
+                    scene.LastExecutionTime = Utlis.GetTimestamp(false);
+                }
+                else
+                {
+                    return;
+                }
                 string msg = scene.name + Language.StringByID(StringId.AlreadyOpened);
                 new PublicAssmebly().TipMsgAutoClose(msg, true);
                 Control.Ins.ControlScene(scene);
+                scene.SceneCountDown(btnShowDelay);
             };
             btnCoverd.MouseUpEventHandler = eventHandler;
             btnName.MouseUpEventHandler = eventHandler;

--
Gitblit v1.8.0