陈嘉乐
2021-02-23 780b8b391bc92fba473291ec8151df5860749408
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs
copy from HDL_ON/UI/UI2/3-Intelligence/Automation/EmptyClass.cs copy to HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs
File was copied from HDL_ON/UI/UI2/3-Intelligence/Automation/EmptyClass.cs
@@ -4,20 +4,21 @@
using System.Collections.Generic;
using System.Text;
namespace HDL_ON.UI.UI2.Intelligence.Automation
namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice
{
    public class EmptyClass : FrameLayout
    public class BrandList : FrameLayout
    {
        public BrandList()
        {
            Tag = "PirView";
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list">表示该列表元素A-Z字母筛选显示出来</param>
        /// <param name="list6">表示该列表元素显示在list前面(该列表元素不做A-Z字母筛选),没有可以为list6=null</param>
        /// <param name="action">返回选中文本</param>
        public void Show(List<string> list, List<string> list6, Action<string> action)
        public void Show(List<string> list, List<string> list6)
        {
            //string text = "30";
            //byte[] bytes = new byte[text.Length / 2];
            //for (int i = 0, j = 0; i < bytes.Length; j += 2, i++)
@@ -27,8 +28,6 @@
            //}
            ////把byte数组转换成文字
            //string str = System.Text.Encoding.UTF8.GetString(bytes);
            var frameLayout = new FrameLayout
            {
                BackgroundColor = CSS.CSS_Color.viewTop,
@@ -59,7 +58,14 @@
                UnSelectedImagePath = "LogicIcon/back.png",
            };
            frameLayout.AddChidren(backBtn);
            backBtn.MouseUpEventHandler += (sen, e) =>
            var clickBackBtn = new Button
            {
                Width = Application.GetRealWidth(12+16+20),
                Height = Application.GetRealWidth(20+20),
                Y = Application.GetRealHeight(32),
            };
            frameLayout.AddChidren(clickBackBtn);
            clickBackBtn.MouseUpEventHandler += (sen, e) =>
            {
                this.RemoveFromParent();
            };
@@ -86,16 +92,7 @@
            };
            this.AddChidren(fram);
            //var list11 = new List<string> {
            //   "爱你", "哎呦","埃及","哈弗换壳哈弗", "爱德华多v","俺几个疯了",
            //    "拜了", "巴士", "百夫",  "百合地理课你打算", "不度老骥伏枥", "比到九点",
            //    "车站","测试","此地", "才看见好得快","吃软饭","从看见二十多",
            //   "等待机会吧","的客户", "多喝点", "登记哦然后", "打电话",
            //     "恩肤霜看就看了", "饿死os","恶魔城","儿科联动", "恩六颗子弹拉拉裤洗澡了","发大学生发发",
            //    "真厉害i发多少", "知道你付款了发", "尬酒回复",  "改进的话", "天天速度回答", "太好了开车",
            //    "减肥的看过","桡出口处那","如果觉得", "很舒服的","吃软饭","从看见二十多",
            //   "龙卷风亏大发","去好看", "多喝点", "好浪费好", "打电话"};
            if (list == null)
            {
                list = new List<string>();
@@ -105,10 +102,7 @@
                list6 = new List<string>();
            }
            var list1 = GetDateList(list);
            list1.Add("1");
            list1.InsertRange(0, list6);
            var vv = new VerticalScrolViewLayout();
            fram.AddChidren(vv);
@@ -125,10 +119,9 @@
                        listStr.Add(s);
                    }
                }
                RefreshLayout(vv, listStr, action);
                RefreshLayout(vv, listStr);
            };
            #region A-Z
@@ -140,7 +133,7 @@
                Width = Application.GetRealWidth(10 + 6),
            };
            fram.AddChidren(a_zFra);
            var list2 = GetList();
            var list2 = GetList();
            for (int i = 0; i < list2.Count; i++)
            {
@@ -183,11 +176,7 @@
            }
            #endregion
            RefreshLayout(vv, list1,action);
            RefreshLayout(vv, list1);
        }
        /// <summary>
@@ -195,7 +184,7 @@
        /// </summary>
        /// <param name="vv">父控件</param>
        /// <param name="list">显示列表</param>
        private void RefreshLayout(VerticalScrolViewLayout vv, List<string> list,Action<string> action)
        private void RefreshLayout(VerticalScrolViewLayout vv, List<string> list)
        {
            vv.RemoveAll();
            foreach (var str in list)
@@ -235,10 +224,10 @@
                vv.AddChidren(rowLayout);
                clickBtn.MouseUpEventHandler += (sen, e) =>
                {
                    //找到索引值
                    var index = list.IndexOf(clickBtn.Tag.ToString());
                    ////找到索引值
                    //var index = list.IndexOf(clickBtn.Tag.ToString());
                    this.RemoveFromParent();
                    //this.RemoveFromParent();
                };
            }
@@ -261,7 +250,6 @@
                return false;
            }
        }
        /// <summary>
        /// 获取显示列表
        /// </summary>
@@ -300,7 +288,6 @@
            }
            return list;
        }
        /// <summary>
        /// 获取A-Z字母列表
        /// </summary>
@@ -321,7 +308,6 @@
            }
            return list;
        }
        /// <summary>
        /// 获取汉字首字母
        /// </summary>
@@ -346,34 +332,7 @@
                iCnChar = i1 * 256 + i2;
            }
            //expresstion
            //table of the constant list
            // 'A'; //45217..45252
            // 'B'; //45253..45760
            // 'C'; //45761..46317
            // 'D'; //46318..46825
            // 'E'; //46826..47009
            // 'F'; //47010..47296
            // 'G'; //47297..47613
            // 'H'; //47614..48118
            // 'J'; //48119..49061
            // 'K'; //49062..49323
            // 'L'; //49324..49895
            // 'M'; //49896..50370
            // 'N'; //50371..50613
            // 'O'; //50614..50621
            // 'P'; //50622..50905
            // 'Q'; //50906..51386
            // 'R'; //51387..51445
            // 'S'; //51446..52217
            // 'T'; //52218..52697
            //没有U,V
            // 'W'; //52698..52979
            // 'X'; //52980..53640
            // 'Y'; //53689..54480
            // 'Z'; //54481..55289
            // iCnChar match the constant 
            if ((iCnChar >= 45217) && (iCnChar <= 45252))
@@ -473,3 +432,4 @@
        }
    }
}