From eda3fb873e59544ff36301b51e05aef64f87b0f9 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 27 八月 2021 13:21:21 +0800
Subject: [PATCH] Merge branch 'newBranch1' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into newBranch1

---
 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs |  400 ++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 323 insertions(+), 77 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
index ec6420f..b59e237 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
@@ -11,14 +11,23 @@
         {
             Tag = "PirView";
         }
-        public void Show(List<Library> libraryList,string spk)
+      
+        public void Show(List<Brand> brandList, List<Library> libraryList,string spk) 
         {
+           
+            
             #region 鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             PirDevice.View.TopView topView = new View.TopView();
             topView.topNameBtn.TextID = StringId.pipeiyaokongqi;
             this.AddChidren(topView.FLayoutView());
-            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
+            topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
+            {
+                BrandList brandObj = new BrandList();
+                brandObj.Show(brandList, spk);
+                this.RemoveFromParent();
+
+            };
 
             FrameLayout fLayout = new FrameLayout
             {
@@ -96,10 +105,10 @@
             Button sumBtn = new Button
             {
                 Y = Application.GetRealHeight(267),
-                X = Application.GetRealWidth(170),
-                Width = Application.GetRealWidth(36),
+                X = Application.GetRealWidth(136),
+                Width = Application.GetRealWidth(104),
                 Height = Application.GetRealHeight(17),
-                Text = "(1/20)",
+                Text = $"(1/{libraryList.Count})",
                 TextSize = TextSize.text12,
                 TextColor = CSS.CSS_Color.textCancelColor,
             };
@@ -116,7 +125,7 @@
                 TextSize = TextSize.text16,
                 TextColor = CSS.CSS_Color.textConfirmColor,
                 TextAlignment = TextAlignment.Center,
-                Radius = (uint)Application.GetRealHeight(44),
+                Radius = (uint)Application.GetRealHeight(22),
                 BorderWidth = 1,
                 BorderColor = CSS.CSS_Color.textConfirmColor,
             };
@@ -132,24 +141,27 @@
                 TextSize = TextSize.text16,
                 TextColor = CSS.CSS_Color.textWhiteColor,
                 TextAlignment = TextAlignment.Center,
-                Radius = (uint)Application.GetRealHeight(44),
+                Radius = (uint)Application.GetRealHeight(22),
                 //BorderWidth = 1,
                 //BorderColor = CSS.CSS_Color.textConfirmColor,
                 BackgroundColor = CSS.CSS_Color.textConfirmColor,
             };
             fLayout.AddChidren(succeedBtn);
             #endregion
+
             #region 鐐瑰嚮浜嬩欢
-            //琛ㄧず搴撳垪琛ㄧ储寮曞��
-            int index= 1; 
-            //琛ㄧず娴嬭瘯鐮佺储寮曞��
+            //琛ㄧず搴撳垪琛ㄧ储寮曞��(鐩墠鍙�20涓簱)
+            int index = 1; 
+            //琛ㄧず娴嬭瘯鐮佺储寮曞��(鐩墠鍙祴璇�3涓爜)
             int code = 1;
+            //琛ㄧず娴嬭瘯鏈�鍚庝竴涓爜锛�
+            bool if_bool = false;
             //宸�
             leftIconBtn.MouseUpEventHandler += (sender, e) =>
             {
                 if (index>1) {
                     index--;
-                    sumBtn.Text = "(" + index.ToString() + "/20)";
+                    sumBtn.Text = $"({index.ToString()}/{libraryList.Count})";
                 }
                 code = 1;
                 GetBtnText(testBtn, code, spk);
@@ -157,10 +169,10 @@
             //鍙�
             rightIconBtn.MouseUpEventHandler += (sender, e) =>
             {
-                if (index < 20)
+                if (index < libraryList.Count)
                 {
                     index++;
-                    sumBtn.Text = "(" + index.ToString() + "/20)";
+                    sumBtn.Text = $"({index.ToString()}/{libraryList.Count})";
                 }
                 code = 1;
                 GetBtnText(testBtn, code, spk);
@@ -168,19 +180,32 @@
             //娴嬭瘯Text
             testBtn.MouseUpEventHandler += (sender, e) =>
             {
-                var library = libraryList[index];
+               // testBtn.BackgroundColor = CSS.CSS_Color.viewMiddle;
+                var library = libraryList[index - 1];
                 var control = GetControl(spk, testBtn.TextID, library);
-                CodeTest(control);
+                //鍙戦�佹祴璇曠爜鍛戒护
+                PirMethod.ThreadSend(control, (responsePackNew) => { }, "搴撶爜娴嬭瘯", "frame", this, null);
+                if (code == 3) {
+                    //鏍囪鏈�鍚庨偅涓爜
+                    if_bool = true;
+                }
+            };
+            testBtn.MouseDownEventHandler += (sender, e) =>
+            {
+                //testBtn.BackgroundColor = CSS.CSS_Color.textConfirmColor;
             };
             //鎺у埗澶辫触
             failedBtn.MouseUpEventHandler += (sender, e) =>
             {
-                if (index < 20)
+                if (index < libraryList.Count)
                 {
+                    //鍏堝姞
                     index++;
-                    sumBtn.Text = "(" + index.ToString() + "/20)";
+                    //鏇存柊鏂囨湰
+                    sumBtn.Text = $"({index.ToString()}/{libraryList.Count})";
                 }
                 code = 1;
+                //鏇存柊鐘舵��
                 GetBtnText(testBtn, code, spk);
             };
             //鎺у埗鎴愬姛
@@ -190,17 +215,33 @@
                 {
                     code++;
                 }
+                //鏇存柊鐘舵��
                 GetBtnText(testBtn, code, spk);
-                if (code == 3)
+                if (if_bool)
                 {
-                    var library = libraryList[index];
+                    var library = libraryList[index-1];
                     var control = GetControl(spk, testBtn.TextID, library);
-                    Method method = new Method();
-                    method.ThreadAddControl(control, this,(control1) => {
+                    if (spk == SPK.TvIr)
+                    {
+                        //澶囨敞锛氫紵鍗楄姹傚皬绫崇數瑙嗘崲鎺塻pk=ir.tvxm锛堝惉璇存槸涓存椂瑙e喅鏂规锛�
+                        var brand = brandList.Find((c) => c.id == library.brandId);
+                        if (brand != null)
+                        {
+                            if (brand.brandName.Contains("灏忕背") || brand.brandName.Contains("Xiaomi"))
+                            {
+                                //鏇存崲spk
+                                control.spk = "ir.tvxm";
+                            }
+                        }
+                    }
+                    PirMethod method = new PirMethod();
+                    //鍙戦�佸簱娣诲姞閬ユ帶鍣ㄥ懡浠�
+                    method.ThreadAddControl(control, this, (device) =>  
+                    {
                         MainPage.BasePageView.RemoveViewByTag("PirView");
                         AddControlComplete addControlComplete = new AddControlComplete();
                         MainPage.BasePageView.AddChidren(addControlComplete);
-                        addControlComplete.Show(control1,true);
+                        addControlComplete.Show(device, true);
                         MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                     });
 
@@ -222,11 +263,11 @@
             string value = "";
             switch (spk)
             {
-                case SPK.AcStandard:
+                case SPK.AcIr:
                     {
                         switch (textInt)
                         {
-                            case StringId.dianshi:
+                            case StringId.dianyuan:
                                 {
                                     key = "on_off";
                                     value = "on";
@@ -247,11 +288,11 @@
                         }
                     }
                     break;
-                case SPK.ElectricTV:
+                case SPK.TvIr:
                     {
                         switch (textInt)
                         {
-                            case StringId.dianshi:
+                            case StringId.dianyuan:
                                 {
                                     key = "on_off";
                                     value = "on";
@@ -259,8 +300,8 @@
                                 break;
                             case StringId.yinliangjia:
                                 {
-                                    key = "on_off";
-                                    value = "on";
+                                    key = "volume+";
+                                    value = "50";
                                 }
                                 break;
                             case StringId.jingyin:
@@ -272,67 +313,157 @@
                         }
                     }
                     break;
+                case SPK.FanIr:
+                    {
+                        switch (textInt)
+                        {
+                            case StringId.dianyuan:
+                                {
+                                    key = "on_off";
+                                    value = "on";
+                                }
+                                break;
+                            case StringId.fengsuqiehuan:
+                                {
+                                    key = "speed";
+                                    value = "";
+                                }
+                                break;
+                            case StringId.yaotou:
+                                {
+                                    key = "swing";
+                                    value = "";
+                                }
+                                break;
+                        }
+                    }
+                    break;
+                case SPK.PjtIr:
+                    {
+                        switch (textInt)
+                        {
+                            case StringId.dianyuan:
+                                {
+                                    key = "on_off";
+                                    value = "on";
+                                }
+                                break;
+                            case StringId.yinliangjia:
+                                {
+                                    key = "volume+";
+                                    value = "";
+                                }
+                                break;
+                            case StringId.yinliangjian:
+                                {
+                                    key = "volume-";
+                                    value = "";
+                                }
+                                break;
+                        }
+                    }
+                    break;
+                case SPK.StbIr:
+                    {
+                        switch (textInt)
+                        {
+                            case StringId.dianyuan:
+                                {
+                                    key = "on_off";
+                                    value = "on";
+                                }
+                                break;
+                            case StringId.yinliangjia:
+                                {
+                                    key = "volume+";
+                                    value = "";
+                                }
+                                break;
+                            case StringId.yinliangjian:
+                                {
+                                    key = "volume-";
+                                    value = "";
+                                }
+                                break;
+                        }
+                    }
+                    break;
+                case SPK.DvDIr:
+                    {
+
+                    }
+                    break;
+                case SPK.PurifierIr:
+                    {
+                        switch (textInt)
+                        {
+                            case StringId.dianyuan:
+                                {
+                                    key = "on_off";
+                                    value = "on";
+                                }
+                                break;
+                            case StringId.zidong:
+                                {
+                                    key = "auto";
+                                    value = "";
+                                }
+                                break;
+                            case StringId.jingyin:
+                                {
+                                    key = "mute";
+                                    value = "0";
+                                }
+                                break;
+                        }
+                    }
+                    break;
+                case SPK.HeaterIr:
+                    {
+                        switch (textInt)
+                        {
+                            case StringId.dianyuan:
+                                {
+                                    key = "on_off";
+                                    value = "on";
+                                }
+                                break;
+                            case StringId.wendujia:
+                                {
+                                    key = "temp+";
+                                    value = "";
+                                }
+                                break;
+                            case StringId.wendujian:
+                                {
+                                    key = "temp-";
+                                    value = "";
+                                }
+                                break;
+                        }
+                    }
+                    break;
             }
-            ButtonObj buttonObj = new ButtonObj();
-            buttonObj.Key = key;
+            AttributesStatus buttonObj = new AttributesStatus();
+            buttonObj.key = key;
             buttonObj.value = value;
 
             Control control = new Control();
             control.spk = spk;
             control.name = spk;
-            control.group_id = library.irIndex;
+            control.groupId = library.irIndex;
             control.type = "library";
             control.status.Add(buttonObj);
+            control.deviceId = Pir.currPir.deviceId;
+            control.sid = "";
             string[] strings = library.irCode.Split(',');
-            for (int array = 0; array < strings.Length; array++)
+            for (int arrayStr = 0; arrayStr < strings.Length; arrayStr++) 
             {
-                //var intValue = Convert.ToInt32(strings[array],16);
-                control.library.Add(strings[array]);
+                //var intValue = Convert.ToInt32(strings[arrayStr],16);
+                control.library.Add(strings[arrayStr].Replace("0x",""));
             }
 
             return control;
-        }
-
-        /// <summary>
-        /// 鍙戦�佸簱鐮佹祴璇曞懡浠�
-        /// </summary>
-        /// <param name="control"></param>
-        private void CodeTest(Control control)
-        {
-
-            //鍔犺浇log
-            Loading loading = new Loading();
-            this.AddChidren(loading);
-            HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
-            loading.Start();
-            new System.Threading.Thread(() =>
-            {
-                try
-                {
-                    //鍙戦�佹寜閿垹闄わ紱
-                    responsePackNew = PirSend.CodeTest(control);
-                }
-                catch { }
-                finally
-                {
-                    Application.RunOnMainThread(() =>
-                    {
-                        loading.Hide();
-                        if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
-                        {
-
-                        }
-                        else
-                        {
-                            Method method = new Method();
-                            method.ErrorShow(responsePackNew);
-                        }
-
-                    });
-                }
-
-            })
-            { IsBackground = true }.Start();
         }
 
         /// <summary>
@@ -368,7 +499,7 @@
                         }
                     }
                     break;
-                case SPK.ElectricTV:
+                case SPK.TvIr:
                     {
                         switch (code)
                         {
@@ -390,6 +521,121 @@
                         }
                     }
                     break;
+                case SPK.FanIr:
+                    {
+                        switch (code)
+                        {
+                            case 1:
+                                {
+                                    textValue = StringId.dianyuan;
+                                }
+                                break;
+                            case 2:
+                                {
+                                    textValue = StringId.fengsuqiehuan;
+                                }
+                                break;
+                            case 3:
+                                {
+                                    textValue = StringId.yaotou;
+                                }
+                                break;
+                        }
+                    }
+                    break;
+                case SPK.PjtIr:
+                    {
+                        switch (code)
+                        {
+                            case 1:
+                                {
+                                    textValue = StringId.dianyuan;
+                                }
+                                break;
+                            case 2:
+                                {
+                                    textValue = StringId.yinliangjia;
+                                }
+                                break;
+                            case 3:
+                                {
+                                    textValue = StringId.yinliangjian;
+                                }
+                                break;
+                        }
+                    }
+                    break;
+                case SPK.StbIr:
+                    {
+                        switch (code)
+                        {
+                            case 1:
+                                {
+                                    textValue = StringId.dianyuan;
+                                }
+                                break;
+                            case 2:
+                                {
+                                    textValue = StringId.yinliangjia;
+                                }
+                                break;
+                            case 3:
+                                {
+                                    textValue = StringId.yinliangjian;
+                                }
+                                break;
+                        }
+                    }
+                    break;
+                case SPK.DvDIr:
+                    {
+
+                    }
+                    break;
+                case SPK.PurifierIr:
+                    {
+                        switch (code)
+                        {
+                            case 1:
+                                {
+                                    textValue = StringId.dianyuan;
+                                }
+                                break;
+                            case 2:
+                                {
+                                    textValue = StringId.zidong;
+                                }
+                                break;
+                            case 3:
+                                {
+                                    textValue = StringId.jingyin;
+                                }
+                                break;
+                        }
+                    }
+                    break;
+                case SPK.HeaterIr:
+                    {
+                        switch (code)
+                        {
+                            case 1:
+                                {
+                                    textValue = StringId.dianyuan;
+                                }
+                                break;
+                            case 2:
+                                {
+                                    textValue = StringId.wendujia;
+                                }
+                                break;
+                            case 3:
+                                {
+                                    textValue = StringId.wendujian;
+                                }
+                                break;
+                        }
+                    }
+                    break;
             }
             testBtn.TextID = textValue;
         }

--
Gitblit v1.8.0