From 2ec9898778d3beda89278e2a53ac0e68b3035d29 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 01 七月 2020 15:06:24 +0800
Subject: [PATCH] 2020-7-1-2

---
 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
index dd716fd..d937307 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
@@ -426,6 +426,44 @@
 
                                                     }
                                                     break;
+                                                case 541:
+                                                    {
+                                                        if (conditions["Cluster_ID"] == "1024") {
+                                                            state = Language.StringByID(MyInternationalizationString.ambientLight)+"<"+conditions["AttriButeData1"]+"lux"+ Language.StringByID(MyInternationalizationString.hour1);
+                                                        }
+                                                        else
+                                                        {
+                                                            if (conditions.ContainsKey("IgnoreTime"))
+                                                            {
+                                                                int minute = int.Parse(conditions["IgnoreTime"]) / 60;
+                                                                int second = int.Parse(conditions["IgnoreTime"]) % 60;
+                                                                if (minute != 0 && second != 0)
+                                                                {
+                                                                    state = minute.ToString() + Language.StringByID(MyInternationalizationString.minute) + second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+
+                                                                }
+                                                                else
+                                                                {
+                                                                    if (minute == 0 && second != 0)
+                                                                    {
+                                                                        state = second.ToString() + Language.StringByID(MyInternationalizationString.second) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+
+                                                                    }
+                                                                    if (minute != 0 && second == 0)
+                                                                    {
+                                                                        state = minute.ToString() + Language.StringByID(MyInternationalizationString.Minute) + Language.StringByID(MyInternationalizationString.unattendedtime1);
+
+                                                                    }
+
+                                                                }
+                                                            }
+                                                            else
+                                                            {
+                                                                state = Language.StringByID(MyInternationalizationString.someone);
+                                                            }
+                                                        }
+                                                    }
+                                                    break;
                                                 default:
                                                     {
                                                         if (intvalue == "1")
@@ -593,6 +631,7 @@
                         selecteddevice.selecetddevicestateBtn.Text = state;
                     }
                     ///缂栬緫
+                    selecteddevice.edit.Tag = i.ToString();
                     selecteddevice.edit.MouseUpEventHandler += (sender, e) =>
                     {
                         switch (Type)
@@ -625,7 +664,7 @@
                                     {
                                         var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                                         this.AddChidren(flMain);
-                                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic");
+                                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_logic",int.Parse(selecteddevice.edit.Tag.ToString()));
                                     }
                                     else
                                     {
@@ -1003,11 +1042,11 @@
                                                         {
                                                             if (tasks["Data1"] == "0")
                                                             {
-                                                                state = Language.StringByID(MyInternationalizationString.close) + ";";
+                                                                state += Language.StringByID(MyInternationalizationString.close) + ";";
                                                             }
                                                             else
                                                             {
-                                                                state = Language.StringByID(MyInternationalizationString.open) + ";";
+                                                                state += Language.StringByID(MyInternationalizationString.open) + ";";
                                                             }
                                                         }
                                                         break;
@@ -1038,11 +1077,11 @@
                                                         {
                                                             if (tasks["Data1"] == "0")
                                                             {
-                                                                state += Language.StringByID(MyInternationalizationString.buzzer) + MyInternationalizationString.close + ";";
+                                                                state += Language.StringByID(MyInternationalizationString.buzzer) + Language.StringByID(MyInternationalizationString.close) + ";";
                                                             }
                                                             else
                                                             {
-                                                                state += Language.StringByID(MyInternationalizationString.buzzer) + MyInternationalizationString.open + ";";
+                                                                state += Language.StringByID(MyInternationalizationString.buzzer) + Language.StringByID(MyInternationalizationString.open) + ";";
                                                             }
                                                         }
                                                         break;
@@ -1057,12 +1096,14 @@
                                                     case "8":
                                                         {
                                                             var intvalue = int.Parse(tasks["Data1"]);
-                                                            var lightbrightnessvalue = intvalue / 100;
-                                                            state += Language.StringByID(MyInternationalizationString.colorTemperature) + lightbrightnessvalue.ToString() + "K";
+                                                            var colorTemperatureValue = 1000000/(intvalue *100);
+                                                            state += Language.StringByID(MyInternationalizationString.colorTemperature) + colorTemperatureValue.ToString() + "K";
                                                         }
                                                         break;
                                                 }
                                             }
+
+                                            state=state.TrimEnd(';');//鍘绘帀鏈�鍚庨偅涓�";"
                                         }
                                         break;
                                 }
@@ -1191,6 +1232,7 @@
                         actiondevice.selecetddevicestateBtn.Text = state;
                     }
                     ///缂栬緫
+                    actiondevice.edit.Tag = i.ToString();
                     actiondevice.edit.MouseUpEventHandler += (sender, e) =>
                     {
                         switch (linkType)
@@ -1203,14 +1245,14 @@
                                     {
                                         var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                                         this.AddChidren(flMain);
-                                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_logic");
+                                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_logic",int.Parse(actiondevice.edit.Tag.ToString()));
                                     }
                                     else
                                     {
                                         var nightlight = new Nightlight();
                                         UserView.HomePage.Instance.AddChidren(nightlight);
                                         UserView.HomePage.Instance.PageIndex += 1;
-                                        nightlight.Show(deviceinof, true, actions);
+                                        nightlight.Show(deviceinof, true, "logic", actions);
                                     }
                                 }
                                 break;

--
Gitblit v1.8.0