tzy
2021-03-26 3cebdfad56d78ba04a214fccd1b942a010aeba77
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
@@ -12,10 +12,10 @@
            Tag = "PirView";
        }
      
        public void Show(List<Brand> brandList,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();
@@ -108,7 +108,7 @@
                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,
            };
@@ -160,7 +160,7 @@
            {
                if (index>1) {
                    index--;
                    sumBtn.Text = "(" + index.ToString() + "/20)";
                    sumBtn.Text = $"({index.ToString()}/{libraryList.Count})";
                }
                code = 1;
                GetBtnText(testBtn, code, spk);
@@ -168,10 +168,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);
@@ -180,10 +180,10 @@
            //测试Text
            testBtn.MouseUpEventHandler += (sender, e) =>
            {
                var library = libraryList[index-1];
                var library = libraryList[index - 1];
                var control = GetControl(spk, testBtn.TextID, library);
                //发送测试码命令
                CodeTest(control);
                Method.ThreadSend(control, (responsePackNew) => { }, "库码测试", "frame", this, null);
                if (code == 3) {
                    //标记最后那个码
                    if_bool = true;
@@ -192,12 +192,12 @@
            //控制失败
            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;
                //更新状态
@@ -214,16 +214,16 @@
                GetBtnText(testBtn, code, spk);
                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, (cont) =>
                    method.ThreadAddControl(control, this, (device) =>
                    {
                        MainPage.BasePageView.RemoveViewByTag("PirView");
                        AddControlComplete addControlComplete = new AddControlComplete();
                        MainPage.BasePageView.AddChidren(addControlComplete);
                        addControlComplete.Show(cont, true);
                        addControlComplete.Show(device, true);
                        MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    });
@@ -316,47 +316,6 @@
            }
            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>