wxr
2021-03-25 4975f3d6beb81e3967b1018d629be9c3410b9ea3
Merge branch 'WJC' into temp-wxr
10个文件已修改
525 ■■■■ 已修改文件
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs 132 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -12,13 +12,17 @@
        }
        public void Show(Control control)
        {
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            PirDevice.View.TopView topView = new View.TopView();
            topView.topNameBtn.TextID = StringId.tianjiayaokongqi;
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
            {
                RemoveFromParent();
            };
            FrameLayout editfLayout = new FrameLayout
            {
@@ -146,18 +150,8 @@
                        }
                        //移除添加按钮界面
                        this.RemoveFromParent();
                        for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
                        {
                            var view = MainPage.BasePageView.GetChildren(i);
                            if (view.GetType() == typeof(AddControl))
                            {
                                //找到移除
                                view.RemoveFromParent();
                            }
                        }
                        //移除之前可能存在的界面
                        Method.RemoveView("AddControl");
                        //加载数据界面
                        AddControl addControl = new AddControl();
                        MainPage.BasePageView.AddChidren(addControl);
@@ -167,8 +161,8 @@
                    else
                    {
                        replication.RemView();
                        new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai));
                        Method method = new Method();
                        method.ErrorShow(null,"添加失败");
                    }
                });
@@ -176,6 +170,14 @@
        }
        /// <summary>
        /// 移除界面
        /// </summary>
        public override void RemoveFromParent()
        {
            //刷新指定界面
            Method.RefreshView("PirMain");
            base.RemoveFromParent();
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs
@@ -24,7 +24,7 @@
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
            {
                this.RemoveFromParent();
            };
@@ -71,7 +71,7 @@
            };
            this.AddChidren(saveLayout);
            saveLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
            //暂时隐藏排序功能
            Button paixuBtn = new Button
            {
                Width = Application.GetRealWidth(375 - 16 * 2),
@@ -82,7 +82,7 @@
                TextSize = TextSize.text14,
                TextColor = CSS.CSS_Color.textTipColor,
            };
            saveLayout.AddChidren(paixuBtn);
            //saveLayout.AddChidren(paixuBtn);
            Button saveBtn = new Button
            {
@@ -140,20 +140,13 @@
            //保存点击事件
            saveBtn.MouseUpEventHandler += (sender, e) =>
            {
               //移除当前界面
                //移除当前界面
                this.RemoveFromParent();
                //可能之前已经存在该界面
                for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
                {
                    var view = MainPage.BasePageView.GetChildren(i);
                    if (view.GetType() == typeof(AddControlComplete))
                    {
                        view.RemoveFromParent();
                    }
                }
                Method.RemoveView("AddControlComplete");
                AddControlComplete addControlComplete = new AddControlComplete();
                MainPage.BasePageView.AddChidren(addControlComplete);
                addControlComplete.Show(control,false);
                addControlComplete.Show(control, false);
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            #endregion
@@ -166,112 +159,19 @@
        void RefreshView(VerticalScrolViewLayout vv, bool if_bool, Control control)
        {
            vv.RemoveAll();
            //定义一个变量记录行数
            int sum = 0;
            if (control.status.Count % 3 == 0)
            View.Buttons buttons = new View.Buttons();
            buttons.AddButton2(vv, control.status, (obj) =>
            {
                sum = control.status.Count / 3;
            }
            else
            {
                sum = control.status.Count / 3 + 1;
            }
            //计算加载出来的数据需要的高度
            int h = 16 + sum * (16 + 44) + 104 + 76;
            int line = 0;
            //按钮的父控件
            var FLayout = new FrameLayout
            {
                Height = Application.GetRealWidth(h),
            };
            vv.AddChidren(FLayout);
            for (int i = 1, j = 0; i <= control.status.Count; i++, j++)
            {
                var nameObj = control.status[i - 1];
                //按钮
                var buttonNameBtn = new Button
                Method.ThreadSend(control, (responsePackNew) =>
                {
                    Y = Application.GetRealHeight(16 + line * (16 + 44)),
                    X = Application.GetRealWidth(16 + (16 + 104) * j),
                    Width = Application.GetRealWidth(104),
                    Height = Application.GetRealHeight(44),
                    Text = nameObj.value,
                    TextSize = TextSize.text16,
                    TextColor = CSS.CSS_Color.textColor,
                    TextAlignment = TextAlignment.Center,
                    Radius = (uint)Application.GetRealHeight(18),
                    BorderWidth = 1,
                    BorderColor = CSS.CSS_Color.textCancelColor,
                };
                FLayout.AddChidren(buttonNameBtn);
                //删除图标
                var delIconBtn = new Button
                {
                    UnSelectedImagePath = "PirIcon/delbuton.png",
                    Y = Application.GetRealHeight(12 + line * (16 + 44)),
                    X = Application.GetRealWidth((16 + 92) + (104 + 16) * j),
                    Width = Application.GetRealWidth(16),
                    Height = Application.GetRealWidth(16),
                    Tag = nameObj,
                };
                if (if_bool)
                {
                    FLayout.AddChidren(delIconBtn);
                }
                //删除图标的点击事件
                delIconBtn.MouseUpEventHandler += (sender, e) =>
                {
                    var obj = delIconBtn.Tag as Entity.AttributesStatus;
                    //加载log
                    Loading loading = new Loading();
                    this.AddChidren(loading);
                    HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
                    loading.Start();
                    new System.Threading.Thread(() =>
                    var buttonObj = control.status.Find((c) => c.value == obj.value);
                    if (buttonObj != null)
                    {
                        try
                        {
                            //发送按键删除;
                            responsePackNew = PirSend.CodeRemove(obj, control.deviceId);
                        }
                        catch { }
                        finally
                        {
                            Application.RunOnMainThread(() =>
                            {
                                loading.Hide();
                                if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
                                {
                                    var buttonObj = control.status.Find((c) => c.value == obj.value);
                                    if (buttonObj != null)
                                    {
                                        control.status.Remove(buttonObj);
                                    }
                                    RefreshView(vv, true, control);
                                }
                                else {
                                    Method method = new Method();
                                    method.ErrorShow(responsePackNew,"");
                                }
                            });
                        }
                    })
                    { IsBackground = true }.Start();
                };
                if (i % 3 == 0)
                {
                    //满一行重置j=0值;
                    j = -1;
                    line += 1;
                }
            }
                        control.status.Remove(buttonObj);
                    }
                    RefreshView(vv, true, control);
                }, "删除按键", "fram", this, null, obj);
            }, if_bool);
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -12,26 +12,12 @@
        }
        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(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();
            topView.topNameBtn.TextID = StringId.tianjiayaokongqi;
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); };
            topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { RemoveFromParent(); };
            FrameLayout fLayout = new FrameLayout
            {
@@ -41,7 +27,7 @@
                Width = Application.GetRealWidth(375),
            };
            this.AddChidren(fLayout);
            //
            //成功图标
            Button iconBtn = new Button
            {
                Y = Application.GetRealHeight(28),
@@ -96,7 +82,7 @@
            quyuPatchView.frameLayout.Y = namePatchView.frameLayout.Bottom;
            this.AddChidren(quyuPatchView.FLayoutView());
            quyuPatchView.btnText1.TextID = StringId.suoshuquyu;
            quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function);
            quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(GetFunction(control.deviceId));
            //继续添加
            Button addBtn = new Button
@@ -124,17 +110,23 @@
                List<string> list = new List<string>();
                for (int i = 0; i < Pir.currPir.FunctioList.Count; i++)
                {
                    //添加所有遥控名称列表
                    list.Add(Pir.currPir.FunctioList[i].name);
                }
                Method method = new Method();
                method.EditControlName(StringId.editName, list, control.name, (name, dialog) =>
                {
                    //发送更新名称命令
                    Method.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) =>
                    {
                        //关闭窗口
                        dialog.Close();
                        //更新备注
                        namePatchView.btnText2.Text = name;
                        function.name = name;
                        //更新临时设备名称
                        control.name = name;
                        //更换内存设备名称
                        GetFunction(control.deviceId).name = name;
                    }, "修改名称", "dialog", null, dialog);
                }, () => { });
            };
@@ -142,22 +134,22 @@
            quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                Method method = new Method();
                method.ManagementPosition(function, () =>
                method.ManagementPosition(GetFunction(control.deviceId), () =>
                {
                    //更新区域
                    quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(function);
                    quyuPatchView.btnText2.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(GetFunction(control.deviceId));
                });
            };
            //继续添加点击事件
            addBtn.MouseUpEventHandler += (sender, e) =>
            {
                if (bool_library)
                {
                {//继续添加库的遥控器
                    Method.RefreshView("PirMain");//刷新指点界面
                    this.RemoveFromParent();
                    RefreshView();
                }
                else
                {
                {//继续添加自定义的遥控器
                    Method method = new Method();
                    method.AddControl(this, (controlDevice) =>
                    {
@@ -171,26 +163,36 @@
            //完成点击事件
            saveView.btnClick.MouseUpEventHandler += (sender, e) =>
            {
                //刷新指点界面
                Method.RefreshView("PirMain");
                //移除所有界面
                MainPage.BasePageView.RemoveViewByTag("PirView");
                RefreshView();
            };
            #endregion
        }
        /// <summary>
        /// 刷新红外宝主界面
        /// 查找设备对象
        /// </summary>
        void RefreshView()
        /// <param name="deviceId">设备ID</param>
        /// <returns></returns>
        public Entity.Function GetFunction(string deviceId)
        {
            var fun = Pir.currPir.FunctioList.Find((c) => c.deviceId == deviceId);
            if (fun != null)
            {
                return fun;
            }
            return new Entity.Function();
        }
            //移除红外宝根界面
            MainPage.BasePageView.RemoveViewByTag("PirMain");
            //重新加载界面
            var page = new PirMain();
            MainPage.BasePageView.AddChidren(page);
            page.Show();
            MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
        /// <summary>
        /// 移除界面
        /// </summary>
        public override void RemoveFromParent()
        {
            //刷新指定界面
            Method.RefreshView("PirMain");
            base.RemoveFromParent();
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
@@ -9,6 +9,7 @@
    {
        public EditControl()
        {
            Tag = "PirView";
        }
        public void Show(Entity.Function control,Action<Entity.Function> action)
        {
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs
@@ -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;
@@ -218,12 +218,12 @@
                    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>
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -8,13 +8,13 @@
{
    public class Method
    {
        /// <summary>
        /// 红外宝程序主入口
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="function"></param>
        public void MainView(FrameLayout frame, Entity.Function function,Action action)
        public void MainView(FrameLayout frame, Entity.Function function, Action action)
        {
            Pir pirDevice = new Pir();
            if (function != null)
@@ -37,6 +37,7 @@
                    PirMain.BackAction += () =>
                    {
                        action?.Invoke();
                        PirMain.BackAction = null;
                    };
                });
            }, Pir.currPir);
@@ -142,7 +143,13 @@
                            {
                                if (device != null)
                                {
                                    control.deviceId = device.deviceId;
                                    //遥控器添加到列表;
                                    if (null == Pir.currPir.FunctioList.Find((c) => c.deviceId == device.deviceId))
                                    {
                                        Pir.currPir.FunctioList.Add(device);
                                    }
                                    frame.RemoveFromParent();//添加成功关闭弹窗
                                    action(control);
                                }
@@ -246,7 +253,7 @@
                            {
                                loading.Hide();
                                Method method = new Method();
                                method.ErrorShow(null,"读取红外宝列表失败");
                                method.ErrorShow(null, "读取红外宝列表失败");
                            }
                        }
                        catch { }
@@ -365,9 +372,10 @@
        /// <param name="view">判断log父控件</param>
        /// <param name="frame">log父控件</param>
        /// <param name="dialog">log父控件</param>
        public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str,string view, FrameLayout frame, Dialog dialog)
        /// <param name="attributesStatus">学习按键</param>
        public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str, string view, FrameLayout frame, Dialog dialog, Entity.AttributesStatus attributesStatus=null)
        {
            //加载log
            Loading loading = new Loading();
            if (view == "dialog")
@@ -395,7 +403,10 @@
                    }
                    else if (str == "删除按键")
                    {
                        // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name);
                        if (attributesStatus != null)
                        {
                            responsePackNew = PirSend.CodeRemove(attributesStatus, control.deviceId);
                        }
                    }
                    else if (str == "获取设备详情")
                    {
@@ -405,6 +416,10 @@
                    else if (str == "获取遥控器列表")
                    {
                        responsePackNew = PirSend.ControlList(control.deviceId);
                    }
                    else if (str == "库码测试")
                    {
                        responsePackNew = PirSend.CodeTest(control);
                    }
                }
                catch { }
@@ -420,7 +435,28 @@
                        else
                        {
                            Method method = new Method();
                            method.ErrorShow(responsePackNew, "");
                            //自定义错误提示文本
                            string eorroText = "";
                            if (str == "删除")
                            {
                            }
                            else if (str == "修改名称")
                            {
                            }
                            else if (str == "删除按键")
                            {
                            }
                            else if (str == "获取设备详情")
                            {
                            }
                            else if (str == "获取遥控器列表")
                            {
                            }
                            else if (str == "库码测试")
                            {
                            }
                            method.ErrorShow(responsePackNew, eorroText);
                        }
                    });
@@ -504,6 +540,10 @@
            {
                str = Language.StringByID(StringId.huoqushujushibao);
            }
            else if (text == "添加失败")
            {
                str = Language.StringByID(StringId.tianjiashibai);
            }
            else
            {
                if (responsePackNew != null)
@@ -550,6 +590,79 @@
                case 3: { } break;
            }
        }
        /// <summary>
        ///指定刷新界面
        /// </summary>
        /// <param name="strView">判断字符</param>
        public static void RefreshView(string strView)
        {
            //标记是不是已经刷新完成
            bool if_bool = false;
            for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
            {
                var view = MainPage.BasePageView.GetChildren(i);
                if (strView == "PirMain")
                {
                    if (view.GetType() == typeof(PirMain))
                    {
                        //强制转换对象
                        var f = (PirMain)view;
                        //移除所有子控件
                        f.RemoveAll();
                        //重新加载UI
                        f.Show();
                        //退出for循环
                        //break;
                        if_bool = true;
                    }
                }
                if (if_bool)
                {
                    //退出for循环
                    break;
                }
            }
        }
        /// <summary>
        /// 指定删除界面
        /// </summary>
        /// <param name="strView">判断字符</param>
        public static void RemoveView(string strView)
        {
            for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
            {
                var view = MainPage.BasePageView.GetChildren(i);
                if (strView == "PirMain")
                {
                    if (view.GetType() == typeof(PirMain))
                    {
                        //移除界面
                        view.RemoveFromParent();
                    }
                }
                else if (strView == "AddControl")
                {
                    if (view.GetType() == typeof(AddControl))
                    {
                        //找到移除
                        view.RemoveFromParent();
                    }
                }
                else if (strView == "AddControlComplete")
                {
                    if (view.GetType() == typeof(AddControlComplete))
                    {
                        //找到移除
                        view.RemoveFromParent();
                    }
                }
            }
        }
    }
    [Serializable]
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs
@@ -54,7 +54,7 @@
        /// </summary>
        public List<string> library = new List<string>();
        /// <summary>
        ///
        /// 学习按键列表
        /// </summary>
        public List<AttributesStatus> status = new List<AttributesStatus>();
    }
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -91,12 +91,7 @@
                SetPir setPir = new SetPir();
                MainPage.BasePageView.AddChidren(setPir);
                setPir.Show(() =>
                {
                    //BackAction();
                    ////刷新界面
                    UIView(vv);
                });
                setPir.Show();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
            ///添加遥控器图标点击事件
@@ -362,7 +357,6 @@
        public override void RemoveFromParent()
        {
            BackAction();
            BackAction = null;
            base.RemoveFromParent();
        }
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
@@ -10,19 +10,16 @@
    {
        public SetPir()
        {
            Tag = "PirMain";
            Tag = "PirView";
        }
        Action backAction;
        public void Show(Action action)
        public void Show()
        {
            backAction = action;
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
            Intelligence.Automation.LogicView.TopView topView = new Intelligence.Automation.LogicView.TopView();
            this.AddChidren(topView.FLayoutView());
            topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
            {
                //action();
                RemoveFromParent();
            };
            topView.topNameBtn.TextID = StringId.setlogic;
@@ -113,16 +110,8 @@
                            Pir.pirDeviceList.Remove(Pir.currPir);
                        }
                        dialog.Close();
                        action();
                        this.RemoveFromParent();
                        for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
                        {
                            var view = MainPage.BasePageView.GetChildren(i);
                            if (view.GetType() == typeof(PirMain))
                            {
                                view.RemoveFromParent();
                            }
                        }
                        Method.RemoveView("PirMain");
                    }, "删除", "dialog", null, dialog);
                }, () =>
@@ -141,8 +130,10 @@
        /// </summary>
        public override void RemoveFromParent()
        {
            backAction();
            //刷新PirMain界面
            Method.RefreshView("PirMain");
            base.RemoveFromParent();
        }
    }
}
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs
@@ -62,6 +62,83 @@
        /// <summary>
        /// 动态加载按钮列表
        /// </summary>
        /// <param name="vv">父控件</param>
        /// <param name="list">数据列表</param>
        /// <param name="action">回调</param>
        /// <param name="if_bool">表示是否显示删除图标</param>
        public void AddButton2(VerticalScrolViewLayout vv, List<Entity.AttributesStatus> list, Action<Entity.AttributesStatus> action, bool if_bool)
        {
            //定义一个变量记录行数
            int sum = 0;
            if (list.Count % 3 == 0)
            {
                sum = list.Count / 3;
            }
            else
            {
                sum = list.Count / 3 + 1;
            }
            //计算加载出来的数据需要的高度
            int h = 16 + sum * (16 + 44) + 104 + 76;
            int line = 0;
            //按钮的父控件
            var FLayout = new FrameLayout
            {
                Height = Application.GetRealWidth(h),
            };
            vv.AddChidren(FLayout);
            for (int i = 1, j = 0; i <= list.Count; i++, j++)
            {
                var nameObj = list[i - 1];
                //按钮
                var buttonNameBtn = new Button
                {
                    Y = Application.GetRealHeight(16 + line * (16 + 44)),
                    X = Application.GetRealWidth(16 + (16 + 104) * j),
                    Width = Application.GetRealWidth(104),
                    Height = Application.GetRealHeight(44),
                    Text = nameObj.value,
                    TextSize = TextSize.text16,
                    TextColor = CSS.CSS_Color.textColor,
                    TextAlignment = TextAlignment.Center,
                    Radius = (uint)Application.GetRealHeight(18),
                    BorderWidth = 1,
                    BorderColor = CSS.CSS_Color.textCancelColor,
                };
                FLayout.AddChidren(buttonNameBtn);
                //删除图标
                var delIconBtn = new Button
                {
                    UnSelectedImagePath = "PirIcon/delbuton.png",
                    Y = Application.GetRealHeight(12 + line * (16 + 44)),
                    X = Application.GetRealWidth((16 + 92) + (104 + 16) * j),
                    Width = Application.GetRealWidth(16),
                    Height = Application.GetRealWidth(16),
                    Tag = nameObj,
                };
                if (if_bool)
                {
                    FLayout.AddChidren(delIconBtn);
                }
                //删除图标的点击事件
                delIconBtn.MouseUpEventHandler += (sender, e) =>
                {
                    var obj = delIconBtn.Tag as Entity.AttributesStatus;
                    action(obj);
                };
                if (i % 3 == 0)
                {
                    //满一行重置j=0值;
                    j = -1;
                    line += 1;
                }
            }
        }
        /// <summary>
        /// 动态加载按钮列表
        /// </summary>
        /// <param name="FLayout">父控件</param>
        /// <param name="action">回调</param>
        /// <param name="sum">多少个FrameLayout控件</param>