From 94968f63b181eee088dab157881daf50ec5cb56a Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 12 三月 2021 12:00:54 +0800
Subject: [PATCH] 2021-3-12-1

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs          |    4 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs         |    3 
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs |   35 ++++----
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs                |   32 ++++----
 .vs/HDL_APP_Project/xs/UserPrefs.xml                           |   34 +++++---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs           |   30 +++++--
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs             |   76 ------------------
 7 files changed, 83 insertions(+), 131 deletions(-)

diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml
index 6628c5a..96415d5 100644
--- a/.vs/HDL_APP_Project/xs/UserPrefs.xml
+++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,23 +1,32 @@
 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default">
   <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-001674E61438002E" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs">
     <Files>
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="556" Column="32" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="372" Column="62" />
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="250" Column="36" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="31" Column="36" />
-      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="299" Column="32" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" Line="1" Column="1" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="137" Column="63" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" Line="267" Column="73" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="284" Column="22" />
+      <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="302" Column="63" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" Line="155" Column="67" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="165" Column="64" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" Line="267" Column="70" />
       <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs" Line="14" Column="91" />
-      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs" Line="26" Column="35" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs" Line="59" Column="65" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" Line="357" Column="48" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs" Line="200" Column="66" />
+      <File FileName="HDL_ON/Entity/Function/Function.cs" Line="637" Column="18" />
+      <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" Line="13" Column="27" />
     </Files>
     <Pads>
       <Pad Id="ProjectPad">
         <State name="__root__">
           <Node name="HDL_APP_Project" expanded="True">
             <Node name="HDL_ON" expanded="True">
-              <Node name="Entity" expanded="True" />
+              <Node name="DAL" expanded="True">
+                <Node name="Mqtt" expanded="True" />
+              </Node>
+              <Node name="Entity" expanded="True">
+                <Node name="Function" expanded="True" />
+              </Node>
               <Node name="UI" expanded="True">
                 <Node name="UI2" expanded="True">
                   <Node name="3-Intelligence" expanded="True">
@@ -27,7 +36,7 @@
                   </Node>
                   <Node name="4-PersonalCenter" expanded="True">
                     <Node name="PirDevice" expanded="True">
-                      <Node name="Pir.cs" selected="True" />
+                      <Node name="BrandList.cs" selected="True" />
                     </Node>
                   </Node>
                 </Node>
@@ -48,10 +57,7 @@
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
   <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.4b65c4650918" />
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
-    <BreakpointStore>
-      <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" line="323" column="1" />
-      <Breakpoint file="/Users/hdl/Desktop/wjc/HDL_APP_Project/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" relfile="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" line="138" column="1" />
-    </BreakpointStore>
+    <BreakpointStore />
   </MonoDevelop.Ide.DebuggingService.Breakpoints>
   <MultiItemStartupConfigurations />
 </Properties>
\ No newline at end of file
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
index aecbe5b..cc5c709 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -8,7 +8,7 @@
     {
         public AddButton()
         {
-            Tag = "Pir";
+            Tag = "PirView";
         }
         public void Show(Control control)
         {
@@ -170,7 +170,7 @@
                         else
                         {
                             replication.RemView();
-                            new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai));
+                            new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai));
 
                         }
                      
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
index d01e28b..76f446d 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
@@ -9,7 +9,7 @@
     {
         public AddControl()
         {
-            Tag = "Pir";
+            Tag = "PirView";
         }
         public void Show(Control control)
         {
@@ -151,7 +151,6 @@
                         view.RemoveFromParent();
                     }
                 }
-                //MainPage.BasePageView.RemoveViewByTag("Pir");
                 AddControlComplete addControlComplete = new AddControlComplete();
                 MainPage.BasePageView.AddChidren(addControlComplete);
                 addControlComplete.Show(control,false);
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
index 6a20e68..3958f65 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -8,17 +8,24 @@
     {
         public AddControlComplete()
         {
-            Tag = "Pir";
+            Tag = "PirView";
         }
         public void Show(Control control, bool bool_library)
         {
             //鏁版嵁杞崲
             Entity.Function function = new Entity.Function();
-            function.sid = control.sid;
-            function.deviceId = control.deviceId;
-            function.name = control.name;
-            function.spk = control.spk;
-            function.attributes.AddRange(function.attributes);
+            {
+                function.sid = control.sid;
+                function.deviceId = control.deviceId;
+                function.name = control.name;
+                function.spk = control.spk;
+                //function.attributes.AddRange(control.status);
+                //閬ユ帶鍣ㄦ坊鍔犲埌鍒楄〃锛�
+                if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid))
+                {
+                    Pir.currPir.FunctioList.Add(function);
+                }
+            }
             #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             PirDevice.View.TopView topView = new View.TopView();
@@ -193,16 +200,12 @@
             //瀹屾垚鐐瑰嚮浜嬩欢
             saveView.btnClick.MouseUpEventHandler += (sender, e) =>
             {
-                MainPage.BasePageView.RemoveViewByTag("AddControl");
-                MainPage.BasePageView.RemoveViewByTag("Pir");
-                if (null == Pir.currPir.FunctioList.Find((c) => c.sid == function.sid))
-                {
-                    Pir.currPir.FunctioList.Add(function);
-                }
-                //Entity.FunctionAttributes functionAttributes = new Entity.FunctionAttributes();
-                //functionAttributes.key
-
-
+                //鍓嶉潰鐣岄潰
+               // this.RemoveFromParent();
+                MainPage.BasePageView.RemoveViewByTag("PirView");
+                //涓荤晫闈�
+                MainPage.BasePageView.RemoveViewByTag("PirMain");
+                
             };
             #endregion
         }
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
index e640385..8ef498e 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
@@ -140,10 +140,12 @@
             fLayout.AddChidren(succeedBtn);
             #endregion
             #region 鐐瑰嚮浜嬩欢
-            //琛ㄧず搴撳垪琛ㄧ储寮曞��
-            int index= 1; 
-            //琛ㄧず娴嬭瘯鐮佺储寮曞��
+            //琛ㄧず搴撳垪琛ㄧ储寮曞��(鐩墠鍙�20涓簱)
+            int index = 1; 
+            //琛ㄧず娴嬭瘯鐮佺储寮曞��(鐩墠鍙祴璇�3涓爜)
             int code = 1;
+            //琛ㄧず娴嬭瘯鏈�鍚庝竴涓爜锛�
+            bool if_bool = false;
             //宸�
             leftIconBtn.MouseUpEventHandler += (sender, e) =>
             {
@@ -165,22 +167,31 @@
                 code = 1;
                 GetBtnText(testBtn, code, spk);
             };
+           
             //娴嬭瘯Text
             testBtn.MouseUpEventHandler += (sender, e) =>
             {
                 var library = libraryList[index];
                 var control = GetControl(spk, testBtn.TextID, library);
+                //鍙戦�佹祴璇曠爜鍛戒护
                 CodeTest(control);
+                if (code == 3) {
+                    //鏍囪鏈�鍚庨偅涓爜
+                    if_bool = true;
+                }
             };
             //鎺у埗澶辫触
             failedBtn.MouseUpEventHandler += (sender, e) =>
             {
                 if (index < 20)
                 {
+                    //鍏堝姞
                     index++;
+                    //鏇存柊鏂囨湰
                     sumBtn.Text = "(" + index.ToString() + "/20)";
                 }
                 code = 1;
+                //鏇存柊鐘舵��
                 GetBtnText(testBtn, code, spk);
             };
             //鎺у埗鎴愬姛
@@ -190,17 +201,20 @@
                 {
                     code++;
                 }
+                //鏇存柊鐘舵��
                 GetBtnText(testBtn, code, spk);
-                if (code == 3)
+                if (if_bool)
                 {
                     var library = libraryList[index];
                     var control = GetControl(spk, testBtn.TextID, library);
                     Method method = new Method();
-                    method.ThreadAddControl(control, this,(cont) => { 
+                    //鍙戦�佸簱娣诲姞閬ユ帶鍣ㄥ懡浠�
+                    method.ThreadAddControl(control, this, (cont) =>
+                    {
                         MainPage.BasePageView.RemoveViewByTag("PirView");
                         AddControlComplete addControlComplete = new AddControlComplete();
                         MainPage.BasePageView.AddChidren(addControlComplete);
-                        addControlComplete.Show(cont,true);
+                        addControlComplete.Show(cont, true);
                         MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                     });
 
@@ -325,8 +339,8 @@
                         }
                         else
                         {
-                            Method method = new Method();
-                            method.ErrorShow(responsePackNew);
+                            //Method method = new Method();
+                            //method.ErrorShow(responsePackNew);
                         }
 
                     });
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
index addde93..cc1412a 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -228,7 +228,8 @@
         /// <summary>
         /// 鑾峰彇閬ユ帶鍣ㄥ垪琛�
         /// </summary>
-        public static void GetControlList(Action actio)
+        /// <param name="action">鍥炶皟鍑芥暟</param>
+        public static void GetControlList(Action action)
         {
 
             new System.Threading.Thread(() =>
@@ -272,81 +273,10 @@
 
                     Application.RunOnMainThread(() =>
                     {
-                        actio();
-                    });
-                }
-
-            })
-            { IsBackground = true }.Start();
-
-        }
-        /// <summary>
-        /// 鑾峰彇閬ユ帶鍣ㄥ垪琛�
-        /// </summary>
-        /// <param name="frame">log鍥炬爣鍔犺浇鐣岄潰</param>
-        /// <param name="action">鍥炶皟鍑芥暟</param>
-        public static void GetControlList1(FrameLayout frame, Action action)
-        {
-            //鍔犺浇log
-            Loading loading = new Loading();
-            frame.AddChidren(loading);
-            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-            loading.Start();
-            new System.Threading.Thread(() =>
-            {
-                try
-                {
-                    for (int i = 0; i < Pir.pirDeviceList.Count; i++)
-                    {
-                        var pirDevice = Pir.pirDeviceList[i];
-                        try
-                        {
-                            responsePackNew = PirSend.ControlList(pirDevice);
-
-                        }
-                        catch { }
-                        finally
-                        {
-                            Application.RunOnMainThread(() =>
-                            {
-                                try
-                                {
-                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                                    {
-                                        var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
-                                        for (int a = 0; a < jArray.Count; a++)
-                                        {
-                                            var jay = jArray[a];
-                                            //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
-                                            var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
-                                            var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str);
-                                            if (pirJosn != null)
-                                            {
-                                                if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid))
-                                                {
-                                                    pirDevice.FunctioList.Add(pirJosn);
-                                                }
-                                            }
-
-                                        }
-                                    }
-                                   
-                                }
-                                catch { }
-
-                            });
-                        }
-                    }
-                }
-                catch { }
-                finally
-                {
-                    Application.RunOnMainThread(() =>
-                    {
-                        loading.Hide();
                         action();
                     });
                 }
+
             })
             { IsBackground = true }.Start();
 
diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
index 2f1cc37..9ec777a 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
@@ -25,22 +25,22 @@
     [System.Serializable]
     public class Control
     {
-        ///// <summary>
-        ///// 绾㈠瀹濊澶嘔d
-        ///// </summary>
-        //public string deviceId = "";
-        ///// <summary>
-        ///// sid
-        ///// </summary>
-        //public string sid = "";
-        ///// <summary>
-        ///// 绾㈠閬ユ帶鍣ㄥ悕绉�
-        ///// </summary>
-        //public string name = "";
-        ///// <summary>
-        ///// 绾㈠閬ユ帶鍣╯pk
-        ///// </summary>
-        //public string spk = "ir.module";
+        /// <summary>
+        /// 绾㈠瀹濊澶嘔d
+        /// </summary>
+        public string deviceId = "";
+        /// <summary>
+        /// sid
+        /// </summary>
+        public string sid = "";
+        /// <summary>
+        /// 绾㈠閬ユ帶鍣ㄥ悕绉�
+        /// </summary>
+        public string name = "";
+        /// <summary>
+        /// 绾㈠閬ユ帶鍣╯pk
+        /// </summary>
+        public string spk = "ir.module";
         /// <summary>
         /// library=搴撶被鍨�, learn=涓嶉渶瑕侀澶栬拷鍔犲睘鎬�
         /// </summary>

--
Gitblit v1.8.0