From 7a11998bb4d64d8fce3aef1ed7918553832baf02 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 16 三月 2021 13:25:35 +0800 Subject: [PATCH] 2021-3-16-2 --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs | 135 ++++++++++++++++++++++++++++++--------------- 1 files changed, 90 insertions(+), 45 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs index 902b7ee..cfa6492 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs +++ b/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), @@ -135,14 +135,7 @@ ///绾㈠瀹濈偣鍑讳簨浠� FrameLayout clickFLayout = new FrameLayout(); pirDeviceFLayout.AddChidren(clickFLayout); - clickFLayout.MouseUpEventHandler += (sender, e) => - { - DeviceSet deviceSet = new DeviceSet(); - MainPage.BasePageView.AddChidren(deviceSet); - deviceSet.Show(); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - }; FrameLayout deviceListFLayout = new FrameLayout(); deviceListFLayout.Y = pirDeviceFLayout.Bottom + Application.GetRealHeight(12); @@ -181,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); } //涓嬫媺鍥炬爣 @@ -281,7 +281,31 @@ } }; + /// + clickFLayout.MouseUpEventHandler += (sender, e) => + { + DeviceSet deviceSet = new DeviceSet(); + MainPage.BasePageView.AddChidren(deviceSet); + 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; + }; #endregion int line = 0; for (int i = 1, j = 0; i <= 7; i++, j++) @@ -341,45 +365,61 @@ } 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> @@ -451,7 +491,7 @@ case 2: { //鐢佃 - type = "tv-" + SPK.ElectricTV; + type = "tv-" + SPK.TvIr; } break; case 3: @@ -545,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) => { @@ -568,11 +610,14 @@ } } } + action(); } else { - Method method = new Method(); - method.ErrorShow(responsePackNew); + if (tag) { + Method method = new Method(); + method.ErrorShow(responsePackNew,""); + } } }, "", "璁惧绫诲瀷鍒楄〃"); } @@ -608,7 +653,7 @@ else { Method method = new Method(); - method.ErrorShow(responsePackNew); + method.ErrorShow(responsePackNew,""); } }, id, "鍝佺墝鍒楄〃"); } -- Gitblit v1.8.0