陈嘉乐
2021-03-16 6a7a5797af489455bbae8db46c30ec229fc2a020
HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -78,7 +78,7 @@
            };
            pirDeviceFLayout.AddChidren(text2Btn);
            //
            //红外宝数量
            Button numberDeviceBtn = new Button
            {
                Y = Application.GetRealHeight(137),
@@ -105,7 +105,7 @@
                TextID = StringId.dangqianhongwaishebei,
            };
            pirDeviceFLayout.AddChidren(numberDeviceTextBtn);
            //
            //所有红外宝的遥控器数量
            Button currDeviceNumberControlBtn = new Button
            {
                Y = Application.GetRealHeight(137),
@@ -174,8 +174,15 @@
            deviceListFLayout.AddChidren(deviceNameBtn);
            if (Pir.pirDeviceList.Count != 0)
            {
                deviceNameBtn.Text = Pir.pirDeviceList[0].name;
                Pir.currPir = Pir.pirDeviceList[0];
                int sum = 0;
                for (int i = 0; i < Pir.pirDeviceList.Count; i++)
                {
                    sum += Pir.pirDeviceList[i].FunctioList.Count;
                }
                deviceNameBtn.Text = Pir.pirDeviceList[0].name;
                numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge);
                currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge);
            }
            //下拉图标
@@ -274,17 +281,28 @@
                }
            };
            ///
            clickFLayout.MouseUpEventHandler += (sender, e) =>
            {
                DeviceSet deviceSet = new DeviceSet();
                MainPage.BasePageView.AddChidren(deviceSet);
                deviceSet.Show(() => {
                deviceSet.Show(() =>
                {
                    if (Pir.currPir != null)
                    {
                        deviceNameBtn.Text = Pir.currPir.name;
                        deviceNameBtn.Text = Pir.pirDeviceList[0].name;
                        numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge);
                    }
                    int sum = 0;
                    for (int i = 0; i < Pir.pirDeviceList.Count; i++)
                    {
                        sum += Pir.pirDeviceList[i].FunctioList.Count;
                    }
                    currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge);
                });
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
            };
@@ -347,6 +365,29 @@
                    }
                    else
                    {
                        if (DeviceTypeList.Count == 0)
                        {
                            GetDeviceTypeList(true,() =>
                            {
                                DeviceTypeViewClick(if_value);
                            });
                        }
                        else
                        {
                            DeviceTypeViewClick(if_value);
                        }
                    }
                };
            }
            GetDeviceTypeList(false,() => { });
        }
        /// <summary>
        /// 设备进入下一级方法
        /// </summary>
        /// <param name="if_value"></param>
        void DeviceTypeViewClick(int if_value) {
                        var strings = GetTypeString(if_value).Split('-');
                        var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]);
                        if (jobDeviceType == null)
@@ -379,13 +420,6 @@
                    }
                };
            }
            GetDeviceTypeList();
        }
        /// <summary>
        /// 获取品牌支持
        /// </summary>
@@ -551,7 +585,9 @@
        /// <summary>
        /// 读取红外设备类型列表
        /// </summary>
        private void GetDeviceTypeList()
        /// <param name="tag">标识要不要提示(true=提示)</param>
        /// <param name="action">回调函数</param>
        private void GetDeviceTypeList(bool tag,Action action)
        {
            PirSend.GetDeviceTypesList(this, (responsePackNew) =>
            {
@@ -574,11 +610,14 @@
                            }
                        }
                    }
                    action();
                }
                else
                {
                    if (tag) {
                    Method method = new Method();
                    method.ErrorShow(responsePackNew);
                        method.ErrorShow(responsePackNew,"");
                    }
                }
            }, "", "设备类型列表");
        }
@@ -614,7 +653,7 @@
                else
                {
                    Method method = new Method();
                    method.ErrorShow(responsePackNew);
                    method.ErrorShow(responsePackNew,"");
                }
            }, id, "品牌列表");
        }