From 5986f63b75bd81c6cef262c670e9251c038cbf5d Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 17 十二月 2019 17:21:07 +0800
Subject: [PATCH] 合并一个版本

---
 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs |  100 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 92 insertions(+), 8 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
index cdf1612..be44d89 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
@@ -758,22 +758,54 @@
                                         }
                                         break;
                                     case DeviceType.TemperatureSensor:
-                                       // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png";
+                                        // conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png";
                                         var dev = deviceinof as TemperatureSensor;
-                                        if (conditions["Cluster_ID"]=="1026") {
+                                        if (conditions["Cluster_ID"] == "1026")
+                                        {
                                             dev.SensorDiv = 1;
-                                        } else {
+                                        }
+                                        else
+                                        {
                                             dev.SensorDiv = 2;
+                                        }
+                                        string s = "";
+                                        switch (conditions["Range"])
+                                        {
+                                            case "0":
+                                                {
+                                                    s = ">";
+                                                }
+                                                break;
+                                            case "1":
+                                                {
+                                                    s = "=";
+                                                }
+                                                break;
+                                            case "2":
+                                                {
+                                                    s = "<";
+                                                }
+                                                break;
+                                            case "6":
+                                                {
+                                                    s = "鈮�";
+                                                }
+                                                break;
+                                            case "7":
+                                                {
+                                                    s = "鈮�";
+                                                }
+                                                break;
                                         }
                                         if (conditions["Cluster_ID"] == "1026")
                                         {
                                             conditionIcon.UnSelectedImagePath = "ZigeeLogic/temperature.png";
-                                            devicestatus.Text = ">" + conditions["AttriButeData1"] + "鈩�";
+                                            devicestatus.Text = s + conditions["AttriButeData1"] + "鈩�";
                                         }
                                         else
                                         {
                                             conditionIcon.UnSelectedImagePath = "ZigeeLogic/humidity.png";
-                                            devicestatus.Text = "<" + conditions["AttriButeData1"] + "%";
+                                            devicestatus.Text = s + conditions["AttriButeData1"] + "%";
                                         }
                                         break;
 
@@ -1960,7 +1992,7 @@
                 }
 
                 Common.Logic.CurrentLogic.LogicName = name;
-
+                bool succeed = false;
                 //鍒ゆ柇鏄柊娣诲姞閫昏緫(榛樿0)杩樻槸淇敼閫昏緫
                 CommonPage.Loading.Start();
                 if (Common.Logic.CurrentLogic.LogicId == 0)
@@ -1969,6 +2001,7 @@
                     var logicifon = await Send.AddModifyLogic(Common.Logic.CurrentLogic);
                     if (logicifon != null && logicifon.LogicId != 0)
                     {
+                        succeed = true;
                         Common.Logic.CurrentLogic.LogicId = logicifon.LogicId;
                         Common.Logic.LogicList.Add(Common.Logic.CurrentLogic);
                     }
@@ -1976,10 +2009,20 @@
                 else
                 {
                     //鍙戦�佷慨鏀归�昏緫鍛戒护
-                    Send.AddModifyLogic(Common.Logic.CurrentLogic);
+                   var modlogic=Send.AddModifyLogic(Common.Logic.CurrentLogic);
+                    //缂栬緫榛樿鎴愬姛锛堜笉鑰冭檻缃戠粶鎯呭喌锛夛紱
+                    succeed = true;
                 }
-
                 CommonPage.Loading.Hide();
+
+                if (!succeed)//succeed鏍囪鏄坊鍔犳垚鍔熻繕鏄け璐�
+                {
+                    //缃戝叧鍥炲澶辫触锛屼笉鍏抽棴鐣岄潰锛岃瀹冨仠鐣欏綋鍓嶇晫闈紱
+                    //锛堝師鍥狅細鑰冭檻鍒板け璐ラ噸鏂扮紪杈戝師鏉ユ暟鎹粰鐢ㄦ埛甯︽潵浜嗛夯鐑︼級
+                    ///鎻愮ず锛氭坊鍔犺嚜鍔ㄥ寲澶辫触锛�
+                    //TipView("娣诲姞鑷姩鍖栧け璐�");
+                    //return;
+                }
                 UserView.HomePage.Instance.RemoveViewByTag("Logic");
                 Category.Category.instance?.RefreshBodyView();
            
@@ -2479,5 +2522,46 @@
             };
 
         }
+        /// <summary>
+        /// 闂幇鎻愮ず妗嗙殑鏂规硶
+        /// </summary>
+        /// <param name="tipText">鎻愮ず鍐呭</param>
+        /// <param name="second">鍋滅暀鏃堕棿鍗曚綅涓簊</param>
+        public void TipView(string tipText, int second = 1)
+        {
+
+            var frameLayout = new FrameLayout { BackgroundColor = 0x50000000 };
+            this.AddChidren(frameLayout);
+
+            var btn = new Button
+            {
+                Gravity = Gravity.Center,
+                Text = tipText,
+                BackgroundColor = 0xff1f1f1f,
+                Width = Application.GetRealWidth(500),
+                Height = Application.GetRealHeight(100),
+                Radius = (uint)Application.GetRealHeight(50),
+            };
+            frameLayout.AddChidren(btn);
+
+            var dateTime1 = DateTime.Now;
+            new System.Threading.Thread(() =>
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    while (true)
+                    {
+                        if ((DateTime.Now - dateTime1).TotalMilliseconds > second * 1000)
+                        {
+                            //榛樿涓�绉掑叧闂�
+                            frameLayout.RemoveFromParent();
+                            break;
+                        }
+                    }
+                });
+            })
+            { IsBackground = true }.Start();
+
+        }
     }
 }

--
Gitblit v1.8.0