陈嘉乐
2021-03-18 783f19a056f29c892c4f852f1da37233951bdb95
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -15,7 +15,7 @@
        /// 临时储存设备类型列表
        /// </summary>
        List<DeviceType> DeviceTypeList = new List<DeviceType>();
        public void Show()
        public void Show(Entity.Function function)
        {
            #region 界面布局
            this.BackgroundColor = CSS.CSS_Color.viewMiddle;
@@ -79,6 +79,19 @@
            if (Pir.pirDeviceList.Count != 0)
            {
                //if (function != null)
                //{
                //    Pir pir = new Pir();
                //    pir.name = function.name;
                //    pir.deviceId = function.deviceId;
                //    pir.sid = function.sid;
                //    Pir.currPir = pir;
                //}
                //else
                //{
                //    Pir.currPir = Pir.pirDeviceList[0];
                //}
                //默认第一个红外宝
                Pir.currPir = Pir.pirDeviceList[0];
                int sum = 0;
@@ -91,6 +104,7 @@
                mainView.numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge);
                mainView.currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge);
            }
            ///设备管理的点击事件
            mainView.clickBtn.MouseUpEventHandler += (sender, e) =>
            {
@@ -214,83 +228,16 @@
            }
            GetBrandList(jobDeviceType.id, (brandList) =>
            {
                var brandSupportStrList = GetBrandSupport(if_value);
                var strList = new List<string>();
                for (int str = 0; str < brandList.Count; str++)
                {
                    string s = brandList[str].brandName;
                    var bool_if = brandSupportStrList.Find((c) => s.Contains(c));
                    if (bool_if != null)
                    {
                        strList.Add(s);
                    }
                }
                Application.RunOnMainThread(() =>
                {
                    BrandList brandObj = new BrandList();
                    MainPage.BasePageView.AddChidren(brandObj);
                    brandObj.Show(brandList, strList, strings[1]);
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                    brandObj.Show(brandList, strings[1]);
                });
            });
        }
        /// <summary>
        /// 获取品牌支持
        /// </summary>
        /// <param name="index">索引值</param>
        private List<string> GetBrandSupport(int index)
        {
            List<string> strList = new List<string>();
            switch (index)
            {
                case 1:
                    {
                        strList.Add("格力");
                        strList.Add("美的");
                        strList.Add("海尔");
                        strList.Add("松下");
                        strList.Add("海信");
                        strList.Add("长虹");
                    }
                    break;
                case 2:
                    {
                        strList.Add("创维");
                        strList.Add("TCL");
                        strList.Add("海信");
                        strList.Add("长虹");
                        strList.Add("海尔");
                        strList.Add("三星");
                        strList.Add("乐视");
                        strList.Add("索尼");
                        strList.Add("LG乐金");
                    }
                    break;
                case 3:
                    {
                    }
                    break;
                case 4:
                    {
                    }
                    break;
                case 5:
                    {
                    }
                    break;
                case 6:
                    {
                    }
                    break;
            }
            return strList;
        }
        /// <summary>
        /// 获取设备类型str
        /// </summary>
@@ -315,7 +262,7 @@
                case 3:
                    {
                        //风扇
                        type = "fan-" + SPK.ElectricFan;
                        // type = "fan-" + SPK.ElectricFan;
                    }
                    break;
                case 4:
@@ -405,7 +352,7 @@
        /// </summary>
        /// <param name="tag">标识要不要提示(true=提示)</param>
        /// <param name="action">回调函数</param>
        public  void GetDeviceTypeList(bool tag, Action action)
        public void GetDeviceTypeList(bool tag, Action action)
        {
            PirSend.GetDeviceTypesList(this, (responsePackNew) =>
            {
@@ -443,7 +390,7 @@
        /// <summary>
        /// 读取红外设备类型的品牌列表
        /// </summary>
        public  void GetBrandList(string id, Action<List<Brand>> actionBrand)
        public void GetBrandList(string id, Action<List<Brand>> actionBrand)
        {
            List<Brand> brandList = new List<Brand>();
            PirSend.GetDeviceTypesList(this, (responsePackNew) =>