wei
2020-12-19 d6aec3027ebec50e1096af7da19d03b1e5f5bea4
HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
old mode 100755 new mode 100644
@@ -349,6 +349,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()
                {
@@ -410,7 +423,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 +439,53 @@
                    aep.LoadPage(refreshAction);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
                //场景正在倒计时执行中
                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)
            {
@@ -557,14 +617,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) =>
            {
                //场景正在倒计时执行中,不允许再点击
                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;