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/LogicIfon.cs                           |   16 +++++--
 ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml                                     |   24 ++++++------
 ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs                   |    2 
 ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs |    3 +
 ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs                   |    6 ++-
 ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide                               |    0 
 .DS_Store                                                                  |    0 
 ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs                  |   58 +++++++++++++++++-----------
 ZigbeeApp/Shared/Phone/Device/Logic/Illumination.cs                        |    2 
 ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs                        |    9 +++-
 10 files changed, 72 insertions(+), 48 deletions(-)

diff --git a/.DS_Store b/.DS_Store
index 9629612..2fc6a44 100644
--- a/.DS_Store
+++ b/.DS_Store
Binary files differ
diff --git a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
index d1e3d59..3e9579b 100644
--- a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
+++ b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
@@ -1,15 +1,17 @@
 锘�<Properties StartupConfiguration="{28EDE1FF-20EF-476B-8AF8-24A3EEB69F45}|Default">
   <MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.5c86e4357d63" />
   <MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.Android_Accelerated_Oreo" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/LogicCommunalPage.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Logic/CurrentDeviceState.cs">
     <Files>
-      <File FileName="Shared/Phone/Device/Logic/IgnoreTime.cs" Line="141" Column="14" />
-      <File FileName="Shared/Phone/Device/Logic/Illumination.cs" Line="170" Column="14" />
-      <File FileName="Shared/Common/ZigbeeColor.cs" Line="348" Column="61" />
-      <File FileName="GateWay.Droid/Assets/Language.ini" Line="606" Column="14" />
-      <File FileName="Shared/Phone/Device/Logic/CurrentDeviceState.cs" Line="428" Column="38" />
-      <File FileName="Shared/Phone/Device/Logic/LogicCommunalPage.cs" Line="434" Column="61" />
-      <File FileName="Shared/R.cs" Line="896" Column="52" />
+      <File FileName="Shared/Phone/Device/Logic/Illumination.cs" Line="40" Column="48" />
+      <File FileName="GateWay.Droid/Assets/Language.ini" Line="615" Column="11" />
+      <File FileName="Shared/Phone/Device/Logic/CurrentDeviceState.cs" Line="1278" Column="39" />
+      <File FileName="Shared/Phone/Device/Logic/LogicCommunalPage.cs" Line="1255" Column="56" />
+      <File FileName="Shared/Phone/Device/Logic/RoomAndDeviceView.cs" />
+      <File FileName="Shared/Phone/Device/Logic/TemplatePage.cs" />
+      <File FileName="Shared/Phone/Device/Logic/LogicIfon.cs" Line="55" Column="42" />
+      <File FileName="Shared/Phone/Device/Logic/Send.cs" Line="270" Column="19" />
+      <File FileName="Shared/Phone/Device/Logic/Nightlight.cs" Line="1" Column="1" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
@@ -17,9 +19,7 @@
           <Node name="GateWay" expanded="True">
             <Node name="GateWay.Droid" expanded="True">
               <Node name="Assets" expanded="True">
-                <Node name="Phone" expanded="True">
-                  <Node name="ZigeeLogic" expanded="True" />
-                </Node>
+                <Node name="Phone" expanded="True" />
               </Node>
             </Node>
             <Node name="Home.IOS" expanded="True">
@@ -32,7 +32,7 @@
                   <Node name="Logic" expanded="True">
                     <Node name="DoorLockLogic" expanded="True" />
                     <Node name="LogicView" expanded="True" />
-                    <Node name="LogicCommunalPage.cs" selected="True" />
+                    <Node name="CurrentDeviceState.cs" selected="True" />
                   </Node>
                 </Node>
                 <Node name="UserCenter" expanded="True">
diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
index e650334..cf9e835 100644
--- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
+++ b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
Binary files differ
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs b/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs
index a98fa44..32005f1 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/CurrentDeviceState.cs
@@ -12,7 +12,7 @@
         /// 閫変腑璇ヨ澶囧姛鑳戒綔涓烘潯浠舵垨鑰呯洰鏍囩殑瑙嗗浘鏂规硶
         /// </summary>
         /// <param name="common">Common.</param>
-        public static void CurrentDeviceView(FrameLayout flMain, CommonDevice common, bool edit, string str)
+        public static void CurrentDeviceView(FrameLayout flMain, CommonDevice common, bool edit, string str,int intValue)
         {
             #region  -------鐣岄潰甯冨眬閮ㄥ垎
             //涓嶈褰撳墠鐣岄潰婊戝姩
@@ -99,33 +99,49 @@
             {
                 if (_if[0]== "condition")
                 {
-                    foreach (var deviceinfo in Common.Logic.CurrentLogic.Conditions)
+                    var deviceinfo = Common.Logic.CurrentLogic.Conditions[intValue];
+                    if (deviceinfo["Type"] == "1")
                     {
-                        if (deviceinfo["Type"] == "1")
+                        if (common.DeviceAddr == deviceinfo["MacAddr"] && common.DeviceEpoint.ToString() == deviceinfo["Epoint"])
                         {
-                            if (common.DeviceAddr == deviceinfo["MacAddr"] && common.DeviceEpoint.ToString() == deviceinfo["Epoint"])
-                            {
-                                devices = deviceinfo;
-                                break;
+                            devices = deviceinfo;
 
-                            }
                         }
                     }
+                    //foreach (var deviceinfo in Common.Logic.CurrentLogic.Conditions)
+                    //{
+                    //    if (deviceinfo["Type"] == "1")
+                    //    {
+                    //        if (common.DeviceAddr == deviceinfo["MacAddr"] && common.DeviceEpoint.ToString() == deviceinfo["Epoint"])
+                    //        {
+                    //            devices = deviceinfo;
+                    //            break;
+                    //        }
+                    //    }
+                    //}
                 }
                 else
                 {
-                    foreach (var deviceinfo in Common.Logic.CurrentLogic.Actions)
+                    var deviceinfo = Common.Logic.CurrentLogic.Actions[intValue];
+                    if (deviceinfo["LinkType"].ToString() == "0")
                     {
-                        if (deviceinfo["LinkType"].ToString() == "0")
-                        {
 
-                            if (deviceinfo["DeviceAddr"].ToString() == common.DeviceAddr && deviceinfo["Epoint"].ToString() == common.DeviceEpoint.ToString())
-                            {
-                                TaskList = deviceinfo["TaskList"] as List<Dictionary<string, string>>;
-                                break;
-                            }
+                        if (deviceinfo["DeviceAddr"].ToString() == common.DeviceAddr && deviceinfo["Epoint"].ToString() == common.DeviceEpoint.ToString())
+                        {
+                            TaskList = deviceinfo["TaskList"] as List<Dictionary<string, string>>;
                         }
                     }
+                    //foreach (var deviceinfo in Common.Logic.CurrentLogic.Actions)
+                    //{
+                    //    if (deviceinfo["LinkType"].ToString() == "0")
+                    //    {
+                    //        if (deviceinfo["DeviceAddr"].ToString() == common.DeviceAddr && deviceinfo["Epoint"].ToString() == common.DeviceEpoint.ToString())
+                    //        {
+                    //            TaskList = deviceinfo["TaskList"] as List<Dictionary<string, string>>;
+                    //            break;
+                    //        }
+                    //    }
+                    //}
                 }
             }
             #endregion
@@ -299,7 +315,6 @@
                         Send.dictionary(deviceConditionsInfo, "AttriButeData2", "0");
 
                         int timeValue = 0;
-                        int progressValue = 0;
                         ///鐐瑰嚮纭浜嬩欢
                         openView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
                         {
@@ -448,7 +463,7 @@
                                             var illumination = new Illumination();
                                             UserView.HomePage.Instance.AddChidren(illumination);
                                             UserView.HomePage.Instance.PageIndex += 1;
-                                            illumination.Show(common, takebackView.titleBtn.Text, progressValue, true);
+                                            illumination.Show(common, takebackView.titleBtn.Text, int.Parse(devices["AttriButeData1"]), true);
                                         }
                                         else
                                         {
@@ -470,7 +485,7 @@
                                         var illumination = new Illumination();
                                         UserView.HomePage.Instance.AddChidren(illumination);
                                         UserView.HomePage.Instance.PageIndex += 1;
-                                        illumination.Show(common,takebackView.titleBtn.Text, progressValue, false);
+                                        illumination.Show(common,takebackView.titleBtn.Text, 0, false);
 
                                     };
                                 }
@@ -513,10 +528,7 @@
 
 
                             }
-                            else if (devices["AttriButeId"] == "0")
-                            {
-                                progressValue = int.Parse(devices["AttriButeData1"]);
-                            }
+                            
                         }
 
                     }
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
index 7778c60..345478d 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DoorLockLogic/LockLogicCommunalPage.cs
@@ -638,6 +638,7 @@
                     actiondevice.selecetddevicestateBtn.Text = state;
 
                     ///缂栬緫
+                    actiondevice.edit.Tag = i.ToString();
                     actiondevice.edit.MouseUpEventHandler += (sender, e) =>
                     {
                         switch (linkType)
@@ -650,7 +651,7 @@
                                     {
                                         var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                                         this.AddChidren(flMain);
-                                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_lockaction");
+                                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_lockaction",int.Parse(actiondevice.edit.Tag.ToString()));
                                     }
                                     else
                                     {
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Illumination.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Illumination.cs
index 0d6c9a0..0b95b1e 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Illumination.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Illumination.cs
@@ -43,7 +43,7 @@
                 Y = Application.GetRealHeight(259 - 184),
                 Height = Application.GetRealHeight(50),
                 Width = Application.GetRealWidth(300),
-                Text =Language.StringByID(MyInternationalizationString.illuminanceValue)+"0lux",
+                Text =Language.StringByID(MyInternationalizationString.illuminanceValue)+ progresValue+"lux",
                 //TextID = MyInternationalizationString.Save,
                 TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
                 TextSize = 12,
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
index 541482f..d937307 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicCommunalPage.cs
@@ -631,6 +631,7 @@
                         selecteddevice.selecetddevicestateBtn.Text = state;
                     }
                     ///缂栬緫
+                    selecteddevice.edit.Tag = i.ToString();
                     selecteddevice.edit.MouseUpEventHandler += (sender, e) =>
                     {
                         switch (Type)
@@ -663,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
                                     {
@@ -1231,6 +1232,7 @@
                         actiondevice.selecetddevicestateBtn.Text = state;
                     }
                     ///缂栬緫
+                    actiondevice.edit.Tag = i.ToString();
                     actiondevice.edit.MouseUpEventHandler += (sender, e) =>
                     {
                         switch (linkType)
@@ -1243,7 +1245,7 @@
                                     {
                                         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
                                     {
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs b/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs
index df45fc1..fd74126 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/LogicIfon.cs
@@ -41,7 +41,8 @@
                             }
 
                         }
-                        else if (common.Type == DeviceType.IASZone) {
+                        else if (common.Type == DeviceType.IASZone)
+                        {
                             var iASZonedevice = common as IASZone;
                             if (iASZonedevice.IasDeviceType == 541)
                             {//鐞冨舰绉诲姩浼犳劅鍣�
@@ -51,7 +52,13 @@
                                     Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype);
                                     return;
                                 }
+                                continue;
                             }
+
+                            Common.Logic.CurrentLogic.Conditions.RemoveAt(i);
+                            Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype);
+                            return;
+
                         }
                         else
                         {
@@ -199,8 +206,7 @@
         /// <summary>
         /// 娣诲姞瀹夐槻杈撳嚭鐨勬柟娉�
         /// </summary>
-        /// <param name="objecttype">Objecttype.</param>
-        /// <param name="o">O.</param>
+        /// <param name="actionsInfo">actionsInfo.</param>
         public static void AddSecurityactions(Dictionary<string, object> actionsInfo)
         {
             for (int i = 0; i < Common.Logic.CurrentLogic.Actions.Count; i++)
@@ -218,8 +224,8 @@
         /// <summary>
         /// 娣诲姞鑷姩鍖栬緭鍑虹殑鏂规硶
         /// </summary>
-        /// <param name="objecttype">Objecttype.</param>
-        /// <param name="o">O.</param>
+        /// <param name="actionsInfo">Objecttype.</param>
+        /// <param name="logic">logic</param>
         public static void AddLogicactions(Common.Logic logic, Dictionary<string, object> actionsInfo)
         {
 
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs b/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs
index feab18b..9472dbe 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/RoomAndDeviceView.cs
@@ -459,7 +459,7 @@
                     devicename.IsSelected = true;
                     var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                     this.AddChidren(flMain);
-                    CurrentDeviceState.CurrentDeviceView(flMain, common, false, IfType);
+                    CurrentDeviceState.CurrentDeviceView(flMain, common, false, IfType,0);
                 };
                 deviceFramelayout.MouseUpEventHandler += devicclick;
                 bjFramelayout.MouseUpEventHandler += devicclick;
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs b/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs
old mode 100755
new mode 100644
index 2d5b82d..b3aa415
--- a/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/TemplatePage.cs
@@ -270,14 +270,15 @@
                             }
                             break;
                     }
-                 
+
                     ///缂栬緫
+                    selecteddevice.edit.Tag = i.ToString();
                     selecteddevice.edit.MouseUpEventHandler += (sender, e) =>
                     {
                         var deviceinof = Method.GetCommonDevice(conditions["MacAddr"], conditions["Epoint"]);
                         var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                         this.AddChidren(flMain);
-                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_mould");
+                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "condition_mould", int.Parse(selecteddevice.edit.Tag.ToString()));
 
                     };
                     ///鍒犻櫎鎺т欢
@@ -403,11 +404,13 @@
                             break;
                     }
                     ///缂栬緫
+
+                    actiondevice.edit.Tag = i;
                     actiondevice.edit.MouseUpEventHandler += (sender, e) => {
                         var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
                         this.AddChidren(flMain);
                         var deviceinof = Method.GetCommonDevice(actions["DeviceAddr"].ToString(), actions["Epoint"].ToString());
-                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_mould");
+                        CurrentDeviceState.CurrentDeviceView(flMain, deviceinof, true, "action_mould",int.Parse(actiondevice.edit.Tag.ToString()));
                     };
                     ///鍒犻櫎鎺т欢
                     actiondevice.del.MouseUpEventHandler += (sender, e) =>

--
Gitblit v1.8.0