From 01c46e7bfe9aa8fb20b29f70c83c03a307af548a Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 22 十二月 2020 16:35:16 +0800
Subject: [PATCH] 2020-12-22 1.更新。

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs |  119 ++++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 88 insertions(+), 31 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
old mode 100644
new mode 100755
index f839d4c..2d7fbb3
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
@@ -47,10 +47,11 @@
             delayView.frameLayout.Y = sceneView.frameLayout.Bottom;
             delayView.btnText.TextID = StringId.delayLogic;
             delayView.btnIcon.UnSelectedImagePath = "LogicIcon/delayed.png";
-            viewLayout.AddChidren(delayView.FLayoutView());
+            //viewLayout.AddChidren(delayView.FLayoutView());
             #endregion
 
             #region  鎵�鏈夌偣鍑讳簨浠�
+            //鍔熻兘鐐瑰嚮浜嬩欢
             functionView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
                 FunTpye funTpye = new FunTpye();
@@ -59,7 +60,7 @@
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
 
             };
-
+            //鍦烘櫙鐐瑰嚮浜嬩欢
             sceneView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
 
@@ -70,7 +71,7 @@
                 this.AddChidren(fLayout);
                 SceneMethod(fLayout);
             };
-
+            //寤舵椂鐐瑰嚮浜嬩欢
             delayView.btnClick.MouseUpEventHandler += (sen, e) =>
             {
 
@@ -91,60 +92,116 @@
         /// <param name="fLayout">寮规涓绘帶浠�</param>
         public void SceneMethod(FrameLayout fLayout)
         {
-            LogicView.DateView dateView = new LogicView.DateView();
-            dateView.btnTitle.TextID = StringId.addSceneLogic;
-            dateView.FLayoutView(fLayout, 5);
-            dateView.btnCancel.MouseUpEventHandler += (sender2, e2) =>
+            int line = 0;
+            var sceneList = LogicMethod.GetSceneList();
+            if (sceneList.Count == 0|| sceneList.Count>5)
+            {
+                line = 5;
+            }
+            else {
+                line = sceneList.Count;
+            }
+            LogicView.DateView view = new LogicView.DateView();
+            view.btnTitle.TextID = StringId.addSceneLogic;
+            view.FLayoutView(fLayout, line);
+
+            view.btnCancel.MouseUpEventHandler += (sender2, e2) =>
             {
                 fLayout.RemoveFromParent();
             };
+            FrameLayout frameL = new FrameLayout
+            {
+                Y = Application.GetRealHeight(56),
+                Height = Application.GetRealHeight(50 * line),
+            };
+
             VerticalRefreshLayout verticalRefresh = new VerticalRefreshLayout
             {
                 Y = Application.GetRealHeight(56),
                 Height = Application.GetRealHeight(50 * 5),
 
             };
-            dateView.frameLayout.AddChidren(verticalRefresh);
-            //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鐘舵��
-            Button buttonClick = new Button();
-            HDL_ON.Entity.Scene sceneSelecetd = null;
-            var sceneList = LogicMethod.GetSceneList();
             verticalRefresh.BeginHeaderRefreshingAction += () =>
             {
                 //鍏抽棴鍒锋柊View锛�
                 verticalRefresh.EndHeaderRefreshing();
             };
+
+            if (sceneList.Count == 0)
+            {
+                Button btnTipNot = new Button
+                {
+                    X=Application.GetRealWidth(93),
+                    Y = Application.GetRealHeight(80),
+                    Width = Application.GetRealWidth(158),
+                    Height = Application.GetRealWidth(158),
+                    UnSelectedImagePath = "TipNot.png",
+                    
+                };
+                view.frameLayout.AddChidren(btnTipNot);
+
+                Button btnTipNotText = new Button()
+                {
+                    Y = btnTipNot.Bottom+ Application.GetRealHeight(16),
+                    Height = Application.GetRealHeight(20),
+                    TextID = StringId.secnenull,
+                    TextColor = CSS.CSS_Color.textColor,
+                    TextSize =LogicView.TextSize.text14,
+                    TextAlignment = TextAlignment.Center,
+                };
+                view.frameLayout.AddChidren(btnTipNotText);
+            }
+            else if (sceneList.Count <=5 ) {
+                view.frameLayout.AddChidren(frameL);
+            }
+            else if(sceneList.Count>5) {
+                view.frameLayout.AddChidren(verticalRefresh);
+
+            }
+
+
+            //瀹氫箟涓�涓眬閮ㄥ彉閲忚褰曢�変腑鐘舵��
+            Button buttonClick = new Button();
+            HDL_ON.Entity.Scene sceneSelecetd = null;
+            verticalRefresh.BeginHeaderRefreshingAction += () =>
+            {
+                //鍏抽棴鍒锋柊View锛�
+                verticalRefresh.EndHeaderRefreshing();
+            };
+
             for (int i = 0; i < sceneList.Count; i++)
             {
                 var scene = sceneList[i];
-                LogicView.SelectTypeView sceneView = new LogicView.SelectTypeView();
-                sceneView.frameLayout.BackgroundColor = CSS.CSS_Color.viewTranslucence;
-                sceneView.btnIcon.Visible = false;
-                sceneView.btnText.X = Application.GetRealWidth(20);
+                LogicView.CheckView sceneView = new LogicView.CheckView();
                 sceneView.btnText.Text = scene.name;
-                sceneView.btnLine.X = Application.GetRealWidth(20);
-                sceneView.btnLine.Width = Application.GetRealWidth(303);
-                sceneView.btnNextIcon.X = Application.GetRealWidth(303);
-                sceneView.btnNextIcon.Width = Application.GetMinRealAverage(28);
-                sceneView.btnNextIcon.Height = Application.GetMinRealAverage(28);
-                sceneView.btnNextIcon.UnSelectedImagePath = "LogicIcon/weekoff.png";
-                sceneView.btnNextIcon.SelectedImagePath = "LogicIcon/weekon.png";
-                verticalRefresh.AddChidren(sceneView.FLayoutView());
+                sceneView.btnText.TextSize = LogicView.TextSize.text14;
+                if (sceneList.Count <= 5)
+                {
+                    sceneView.frameLayout.Y = Application.GetRealWidth(i*50);
+                    frameL.AddChidren(sceneView.FLayoutView());
+                    if (sceneList.Count-1==i) {
+                        sceneView.btnLine.BackgroundColor = CSS.CSS_Color.view;
+                    }
+                }
+                else
+                {
+                    verticalRefresh.AddChidren(sceneView.FLayoutView());
+                }
                 sceneView.btnClick.Tag = scene;//鏍囪绱㈠紩
-
                 //鍦烘櫙鐨勭偣鍑讳簨浠�
                 sceneView.btnClick.MouseUpEventHandler += (sender, e) =>
                 {
                     buttonClick.IsSelected = false;
-                    sceneView.btnNextIcon.IsSelected = true;
-                    buttonClick = sceneView.btnNextIcon;
-                    sceneSelecetd =sceneView.btnClick.Tag as HDL_ON.Entity.Scene;
+                    sceneView.btnCheckIcon.IsSelected = true;
+                    buttonClick = sceneView.btnCheckIcon;
+                    sceneSelecetd = sceneView.btnClick.Tag as HDL_ON.Entity.Scene;
                 };
 
             }
             //纭鐐瑰嚮浜嬩欢
-            dateView.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
+            view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
             {
+
                 if (sceneSelecetd == null)
                 {
                     //鎻愮ず锛氳繕娌¢�変腑鎵ц鍛ㄦ湡
@@ -153,7 +210,7 @@
                 Output outputDevice = new Output();
                 outputDevice.target_type = "2";
                 outputDevice.sid = sceneSelecetd.sid;
-                //娌″暐浣滅敤锛屼负浜嗘暟鎹牸寮忕粺涓�,鍙戦�佹椂涓嶅啀鍒ゆ柇
+                //娌″暐浣滅敤锛屼负浜嗗彂閫佹暟鎹牸寮忕粺涓�;
                 outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "scene"},{ "value", "0" } } };
                 AddOutput(outputDevice);
                 fLayout.RemoveFromParent();
@@ -200,7 +257,7 @@
                     foreach (var dic in dicList)
                     {
                         string timeValue = dic["value"];
-                        int hIndex = timePointView.GetValueIndex(timeValue, 0, 1, timePointView.GethIntList0());
+                        int hIndex = timePointView.GetValueIndex(timeValue, 0, 1, timePointView.GethIntList());
                         int mIndex = timePointView.GetValueIndex(timeValue, 1, 0, timePointView.GetmIntList());
                         //鏇存柊鍒濆鐘舵��
                         timePointView.mUIPickerView.setCurrentItems(hIndex, mIndex, 0);

--
Gitblit v1.8.0