| | |
| | | }; |
| | | pirDeviceFLayout.AddChidren(text2Btn); |
| | | |
| | | // |
| | | //红外宝数量 |
| | | Button numberDeviceBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(137), |
| | |
| | | TextID = StringId.dangqianhongwaishebei, |
| | | }; |
| | | pirDeviceFLayout.AddChidren(numberDeviceTextBtn); |
| | | // |
| | | //所有红外宝的遥控器数量 |
| | | Button currDeviceNumberControlBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(137), |
| | |
| | | ///红外宝点击事件 |
| | | FrameLayout clickFLayout = new FrameLayout(); |
| | | pirDeviceFLayout.AddChidren(clickFLayout); |
| | | |
| | | |
| | | |
| | | FrameLayout deviceListFLayout = new FrameLayout(); |
| | | deviceListFLayout.Y = pirDeviceFLayout.Bottom + Application.GetRealHeight(12); |
| | |
| | | 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); |
| | | } |
| | | |
| | | //下拉图标 |
| | |
| | | } |
| | | |
| | | }; |
| | | |
| | | /// |
| | | 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; |
| | | }; |
| | |
| | | } |
| | | else |
| | | { |
| | | var strings = GetTypeString(if_value).Split('-'); |
| | | var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]); |
| | | if (jobDeviceType == null) |
| | | if (DeviceTypeList.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | GetBrandList(jobDeviceType.id, (brandList) => |
| | | { |
| | | var brandSupportStrList = GetBrandSupport(if_value); |
| | | var strList = new List<string>(); |
| | | for (int str = 0; str < brandList.Count; str++) |
| | | GetDeviceTypeList(true,() => |
| | | { |
| | | string s = brandList[str].brandName; |
| | | var bool_if = brandSupportStrList.Find((c) => s.Contains(c)); |
| | | if (bool_if != null) |
| | | { |
| | | strList.Add(s); |
| | | } |
| | | DeviceTypeViewClick(if_value); |
| | | |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | BrandList brandObj = new BrandList(); |
| | | MainPage.BasePageView.AddChidren(brandObj); |
| | | brandObj.Show(brandList, strList, strings[1]); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | |
| | | }); |
| | | |
| | | } |
| | | else |
| | | { |
| | | DeviceTypeViewClick(if_value); |
| | | } |
| | | } |
| | | |
| | | |
| | | }; |
| | | |
| | | } |
| | | GetDeviceTypeList(); |
| | | 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) |
| | | { |
| | | return; |
| | | } |
| | | 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; |
| | | }); |
| | | |
| | | }); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取品牌支持 |
| | | /// </summary> |
| | |
| | | /// <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) => |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | action(); |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew); |
| | | if (tag) { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew,""); |
| | | } |
| | | } |
| | | }, "", "设备类型列表"); |
| | | } |
| | |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew); |
| | | method.ErrorShow(responsePackNew,""); |
| | | } |
| | | }, id, "品牌列表"); |
| | | } |