From 6a7a5797af489455bbae8db46c30ec229fc2a020 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 16 三月 2021 13:20:56 +0800 Subject: [PATCH] 2021-3-16-1 --- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs | 119 +++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 79 insertions(+), 40 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs index b1e7b74..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,7 +135,7 @@ ///绾㈠瀹濈偣鍑讳簨浠� FrameLayout clickFLayout = new FrameLayout(); pirDeviceFLayout.AddChidren(clickFLayout); - + FrameLayout deviceListFLayout = new FrameLayout(); deviceListFLayout.Y = pirDeviceFLayout.Bottom + Application.GetRealHeight(12); @@ -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,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> @@ -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 { - Method method = new Method(); - method.ErrorShow(responsePackNew); + if (tag) { + Method method = new Method(); + method.ErrorShow(responsePackNew,""); + } } }, "", "璁惧绫诲瀷鍒楄〃"); } @@ -614,7 +653,7 @@ else { Method method = new Method(); - method.ErrorShow(responsePackNew); + method.ErrorShow(responsePackNew,""); } }, id, "鍝佺墝鍒楄〃"); } -- Gitblit v1.8.0