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/DoorLockLogic/LockLogicCommunalPage.cs |  128 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 110 insertions(+), 18 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
index 29cb893..345478d 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
@@ -35,14 +35,13 @@
             }
             view.clickBtn.MouseDownEventHandler += (sender, e) =>
             {
-                //UserView.HomePage.Instance.ScrollEnabled = true;//鎭㈠宸︽粦
                 action();
                 RemoveFromParent();
             };
             var middle = new VerticalScrolViewLayout
             {
                 Y = view.topRowLayout.Bottom,
-                Height = Application.GetRealHeight(1920 - 184 - 180),
+                Height = Application.GetRealHeight(Method.H - 184 - 180),
                 BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
             };
             this.AddChidren(middle);
@@ -140,7 +139,7 @@
                             {
                                 var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]);
                                 selecteddevice.deviceNameBtn.Visible = true;
-                                selecteddevice.deviceNameBtn.Text = deviceinof.DeviceEpointName;
+                                selecteddevice.deviceNameBtn.Text = LocalDevice.Current.GetDeviceEpointName(deviceinof);
                                 selecteddevice.regionNameBtn.Visible = true;
                                 Method.RoomNmae(selecteddevice.regionNameBtn, deviceinof);
                                 selecteddevice.edit.Tag = i;
@@ -155,7 +154,7 @@
                                                 {
                                                     if (Common.Logic.CurrentLogic.Accounts[a]["UserId"] == conditions["AttriButeData2"])
                                                     {
-                                                        selecteddevice.selecetddevicestateBtn.Text = Common.Logic.CurrentLogic.Accounts[a]["Account"];
+                                                        selecteddevice.selecetddevicestateBtn.Text = Common.Logic.CurrentLogic.Accounts[a]["AccountName"];
                                                         break;
                                                     }
                                                 }
@@ -184,10 +183,11 @@
                         alert.ConfirmClickEvent += () =>
                         {
                             Common.Logic.CurrentLogic.Conditions.Remove(conditions);
-                            var lockLogicCommunalPage = new LockLogicCommunalPage();
-                            UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
-                            UserView.HomePage.Instance.PageIndex += 1;
-                            lockLogicCommunalPage.Show(() => { });
+                            selecteddevice.selecetdFrameLayout.RemoveFromParent();
+                            //var lockLogicCommunalPage = new LockLogicCommunalPage();
+                            //UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
+                            //UserView.HomePage.Instance.PageIndex += 1;
+                            //lockLogicCommunalPage.Show(() => { });
                         };
                     };
 
@@ -246,7 +246,7 @@
                             {
 
                                 var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
-                                name = deviceinof.DeviceEpointName;
+                                name =LocalDevice.Current.GetDeviceEpointName(deviceinof);
                                 actiondevice.regionNameBtn.Visible = true;
                                 Method.RoomNmae(actiondevice.regionNameBtn, deviceinof);
 
@@ -504,7 +504,86 @@
                                             }
                                         }
                                         break;
+                                    case DeviceType.ColorTemperatureLight:
+                                        {
+                                            icon = "ZigeeLogic/nightLight.png";
+                                            var taskList = actions["TaskList"] as List<Dictionary<string, string>>;
+                                            if (taskList == null)
+                                            {
+                                                continue;
+                                            }
+                                            foreach (var tasks in taskList)
+                                            {
+                                                switch (tasks["TaskType"])
+                                                {
+                                                    case "1":
+                                                        {
+                                                            if (tasks["Data1"] == "0")
+                                                            {
+                                                                state += Language.StringByID(MyInternationalizationString.close) + ";";
+                                                            }
+                                                            else
+                                                            {
+                                                                state += Language.StringByID(MyInternationalizationString.open) + ";";
+                                                            }
+                                                        }
+                                                        break;
 
+                                                }
+                                            }
+                                            foreach (var tasks in taskList)
+                                            {
+                                                switch (tasks["TaskType"])
+                                                {
+
+                                                    case "3":
+                                                        {
+                                                            var intvalue = int.Parse(tasks["Data1"]);
+                                                            var lightbrightnessvalue = (intvalue * 100) / 254;
+                                                            state += Language.StringByID(MyInternationalizationString.brightness) + lightbrightnessvalue.ToString() + "%;";
+                                                        }
+                                                        break;
+
+                                                }
+                                            }
+                                            foreach (var tasks in taskList)
+                                            {
+                                                switch (tasks["TaskType"])
+                                                {
+
+                                                    case "7":
+                                                        {
+                                                            if (tasks["Data1"] == "0")
+                                                            {
+                                                                state += Language.StringByID(MyInternationalizationString.buzzer) + Language.StringByID(MyInternationalizationString.close) + ";";
+                                                            }
+                                                            else
+                                                            {
+                                                                state += Language.StringByID(MyInternationalizationString.buzzer) + Language.StringByID(MyInternationalizationString.open) + ";";
+                                                            }
+                                                        }
+                                                        break;
+
+                                                }
+                                            }
+                                            foreach (var tasks in taskList)
+                                            {
+                                                switch (tasks["TaskType"])
+                                                {
+
+                                                    case "8":
+                                                        {
+                                                            var intvalue = int.Parse(tasks["Data1"]);
+                                                            var colorTemperatureValue = 1000000 / (intvalue * 100);
+                                                            state += Language.StringByID(MyInternationalizationString.colorTemperature) + colorTemperatureValue.ToString() + "K";
+                                                        }
+                                                        break;
+                                                }
+                                            }
+
+                                            state = state.TrimEnd(';');//鍘绘帀鏈�鍚庨偅涓�";"
+                                        }
+                                        break;
                                 }
 
 
@@ -559,6 +638,7 @@
                     actiondevice.selecetddevicestateBtn.Text = state;
 
                     ///缂栬緫
+                    actiondevice.edit.Tag = i.ToString();
                     actiondevice.edit.MouseUpEventHandler += (sender, e) =>
                     {
                         switch (linkType)
@@ -567,9 +647,21 @@
                             case 8:
                                 {
                                     var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
-                                    var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
-                                    this.AddChidren(flMain);
-                                    CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_lockaction");
+                                    if (deviceinof.Type != DeviceType.ColorTemperatureLight)
+                                    {
+                                        var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
+                                        this.AddChidren(flMain);
+                                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_lockaction",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, "lockaction",actions);
+                                    }
+
+
                                 }
                                 break;
 
@@ -588,10 +680,11 @@
                         alert.ConfirmClickEvent += () =>
                         {
                             Common.Logic.CurrentLogic.Actions.Remove(actions);
-                            var lockLogicCommunalPage = new LockLogicCommunalPage();
-                            UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
-                            UserView.HomePage.Instance.PageIndex += 1;
-                            lockLogicCommunalPage.Show(() => { });
+                            actiondevice.selecetdFrameLayout.RemoveFromParent();
+                            //var lockLogicCommunalPage = new LockLogicCommunalPage();
+                            //UserView.HomePage.Instance.AddChidren(lockLogicCommunalPage);
+                            //UserView.HomePage.Instance.PageIndex += 1;
+                            //lockLogicCommunalPage.Show(() => { });
                         };
                     };
 
@@ -604,7 +697,6 @@
             Method.Push(middle);
             #endregion
 
-       
             saveBtn.clickviewBtn.MouseUpEventHandler += (sender, e) =>
            {
                var name = logicTextBox.Text.Trim();
@@ -614,12 +706,12 @@
         }
         public  void AddCondition(int value)
         {
+            Common.Logic.CurrentLogic.LogicName = logicTextBox.Text.Trim();
             var addCondition = new AddCondition();
             addCondition.conditionsIndex = value;
             UserView.HomePage.Instance.AddChidren(addCondition);
             UserView.HomePage.Instance.PageIndex += 1;
             addCondition.Show();
-      
         }
     }
 }

--
Gitblit v1.8.0