From 5986f63b75bd81c6cef262c670e9251c038cbf5d Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期二, 17 十二月 2019 17:21:07 +0800 Subject: [PATCH] 合并一个版本 --- ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs | 190 ++++++++++++++++------------------------------- 1 files changed, 66 insertions(+), 124 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs index 184c54c..20a5eea 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs @@ -17,10 +17,6 @@ /// </summary> private Common.Room lookRoom = null; /// <summary> - /// 褰撳墠閫夋嫨鐨勫垎鏀紝1锛氬満鏅� 2锛氬姛鑳� - /// </summary> - private int nowSelectIndex = 1; - /// <summary> /// 妗屽竷鎺т欢 /// </summary> private FrameLayout frameTable = null; @@ -52,17 +48,14 @@ //娓呯┖bodyFrame this.ClearBodyFrame(); - //鍒濆鍖栧垎鏀帶浠� - this.InitSwitchControl(); - //鍒濆鍖栨甯冩帶浠� this.frameTable = new FrameLayout(); frameTable.Y = Application.GetRealHeight(187); frameTable.Height = bodyFrameLayout.Height - Application.GetRealHeight(187); bodyFrameLayout.AddChidren(frameTable); - //鏄剧ず鍦烘櫙鍒楄〃 - this.ShowSceneList(); + //鍒濆鍖栧垎鏀帶浠� + this.InitSwitchControl(); } /// <summary> @@ -70,93 +63,23 @@ /// </summary> private void InitSwitchControl() { - var btnTemp = new NormalViewControl(10, 10, false); - btnTemp.TextID = R.MyInternationalizationString.uScence; - - //鍦烘櫙妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) - var frameScene = new FrameLayoutControl(); - frameScene.UseClickStatu = false; - frameScene.Height = Application.GetRealHeight(90); - frameScene.Width = btnTemp.GetRealWidthByText(16); - frameScene.X = ControlCommonResourse.XXLeft; - frameScene.Y = Application.GetRealHeight(40); - bodyFrameLayout.AddChidren(frameScene); - //鍦烘櫙 - var btnScene = new NormalViewControl(frameScene.Width, Application.GetRealHeight(63), false); - btnScene.Text = btnTemp.Text; - btnScene.TextSize = 16; - btnScene.TextColor = UserCenterColor.Current.TextColor2; - frameScene.AddChidren(btnScene, ChidrenBindMode.BindEventOnly); - //搴曠嚎 - var btnSceneLine = new NormalViewControl(40, 10, true); - btnSceneLine.Y = btnScene.Bottom + Application.GetRealHeight(14); - btnSceneLine.X = btnScene.X + btnScene.Width / 2 - Application.GetRealWidth(40) / 2; - btnSceneLine.Radius = (uint)Application.GetRealHeight(10) / 2; - btnSceneLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; - frameScene.AddChidren(btnSceneLine, ChidrenBindMode.BindEventOnly); - - btnTemp.TextID = R.MyInternationalizationString.uFunction; - //鍔熻兘妗�(鐐瑰嚮鑼冨洿鏈夌偣灏忥紝闇�瑕佹墿澶у畠鐨勭偣鍑昏寖鍥�) - var frameFunc = new FrameLayoutControl(); - frameFunc.UseClickStatu = false; - frameFunc.Height = Application.GetRealHeight(90); - frameFunc.Width = btnTemp.GetRealWidthByText(16); - frameFunc.X = frameScene.Right + Application.GetRealWidth(58); - frameFunc.Y = Application.GetRealHeight(40); - bodyFrameLayout.AddChidren(frameFunc); - //鍔熻兘 - var btnFunc = new NormalViewControl(frameFunc.Width, Application.GetRealHeight(63), false); - btnFunc.Text = btnTemp.Text; - btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3; - frameFunc.AddChidren(btnFunc, ChidrenBindMode.BindEventOnly); - //搴曠嚎 - var btnFuncLine = new NormalViewControl(40, 10, true); - btnFuncLine.Y = btnFunc.Bottom + Application.GetRealHeight(14); - btnFuncLine.X = btnFunc.X + btnFunc.Width / 2 - Application.GetRealWidth(40) / 2; - btnFuncLine.Radius = (uint)Application.GetRealHeight(10) / 2; - btnFuncLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor; - frameFunc.AddChidren(btnFuncLine, ChidrenBindMode.BindEventOnly); - btnFuncLine.Visible = false; - - frameScene.ButtonClickEvent += (sender, e) => + var tabControl = new SceneFunctionSwitchControl(); + tabControl.Y = Application.GetRealHeight(40); + bodyFrameLayout.AddChidren(tabControl); + tabControl.SelectTabEvent += (tabIndex) => { - //鍦烘櫙鍒嗘敮閫夋嫨 - if (this.nowSelectIndex == 1) + if (tabIndex == 1) { - return; + //鏄剧ず鍦烘櫙鍒楄〃 + this.ShowSceneList(); } - this.nowSelectIndex = 1; - - btnScene.TextSize = 16; - btnScene.TextColor = UserCenterColor.Current.TextColor2; - btnFunc.TextSize = 14; - btnFunc.TextColor = UserCenterColor.Current.TextGrayColor3; - btnSceneLine.Visible = true; - btnFuncLine.Visible = false; - - //鏄剧ず鍦烘櫙鍒楄〃 - this.ShowSceneList(); - }; - - frameFunc.ButtonClickEvent += (sender, e) => - { - //鍔熻兘鍒嗘敮閫夋嫨 - if (this.nowSelectIndex == 2) + else { - return; + //鏄剧ず鍔熻兘鍒楄〃 + this.ShowFunctionList(); } - this.nowSelectIndex = 2; - - btnScene.TextSize = 14; - btnScene.TextColor = UserCenterColor.Current.TextGrayColor3; - btnFunc.TextSize = 16; - btnFunc.TextColor = UserCenterColor.Current.TextColor2; - btnFuncLine.Visible = true; - btnSceneLine.Visible = false; - - //鏄剧ず鍔熻兘鍒楄〃 - this.ShowFunctionList(); }; + tabControl.InitControl(); } #endregion @@ -170,27 +93,44 @@ { //娓呯┖妗屽竷 this.frameTable.RemoveAll(); - - var listView = new VerticalFrameControl(29); - listView.Height = frameTable.Height; - frameTable.AddChidren(listView); - HdlThreadLogic.Current.RunMainInThread(() => { - if (this.frameTable == null) + if (lookRoom.SceneUIList.Count == 0) { + //杩樻病鏈夋坊鍔犲満鏅摝 + this.ShowNotDataImage(frameTable, Language.StringByID(R.MyInternationalizationString.uDoNotHadAddScenceMsg)); return; } + var listView = new VerticalFrameControl(29); + listView.Height = frameTable.Height; + frameTable.AddChidren(listView); + foreach (var data in lookRoom.SceneUIList) { var frameContr = new FrameLayout(); frameContr.Height = Application.GetRealHeight(470); + frameContr.Gravity = Gravity.CenterHorizontal; listView.AddChidrenFrame(frameContr); + //鍦烘櫙鍥剧墖 - var btnPic = new PicViewControl(878, 470, true); - btnPic.Gravity = Gravity.CenterHorizontal; - btnPic.UnSelectedImagePath = data.IconPath; + var btnPic = new ImageView(); + btnPic.X = Application.GetRealWidth(179); + btnPic.Width = Application.GetRealWidth(844); + btnPic.Height = Application.GetRealHeight(420); + btnPic.ImagePath = data.IconPath; + btnPic.Radius = (uint)Application.GetRealHeight(17); frameContr.AddChidren(btnPic); + + var btnName = new NormalViewControl(251, 282, true); + btnName.X = ControlCommonResourse.XXLeft; + btnName.Y = Application.GetRealHeight(58); + btnName.BackgroundColor = 0xff333333; + btnName.RadiusEx = 17; + btnName.Text = data.Name; + btnName.TextSize = 15; + btnName.TextColor = UserCenterColor.Current.White; + btnName.TextAlignment = TextAlignment.Center; + frameContr.AddChidren(btnName); } }); } @@ -207,27 +147,30 @@ //娓呯┖妗屽竷 this.frameTable.RemoveAll(); - var frameBack = new FrameLayout(); - frameBack.X = ControlCommonResourse.XXLeft; - frameBack.BackgroundColor = UserCenterColor.Current.White; - frameBack.Width = bodyFrameLayout.Width; - frameBack.Height = Application.GetRealHeight(1650); - frameBack.Radius = (uint)Application.GetMinRealAverage(20); - frameTable.AddChidren(frameBack); - - var listView = new VerticalListControl(23); - listView.Y = Application.GetRealHeight(23); - listView.Height = Application.GetRealHeight(1549 - 23); - frameBack.AddChidren(listView); - HdlThreadLogic.Current.RunMainInThread(() => { - if (listView == null) - { - return; - } //鑾峰彇鍒嗙粍鍚庣殑璁惧鍒楄〃 var dicGroupDevice = this.GetAllGroupDevice(); + if (dicGroupDevice.Count == 0) + { + //杩樻病鏈夋坊鍔犺澶囧摝 + this.ShowNotDataImage(frameTable, Language.StringByID(R.MyInternationalizationString.uDoNotHadAddDeviceMsg)); + return; + } + + var frameBack = new FrameLayout(); + frameBack.X = ControlCommonResourse.XXLeft; + frameBack.BackgroundColor = UserCenterColor.Current.White; + frameBack.Width = bodyFrameLayout.Width; + frameBack.Height = Application.GetRealHeight(1650); + frameBack.Radius = (uint)Application.GetRealHeight(58); + frameTable.AddChidren(frameBack); + + var listView = new VerticalListControl(23); + listView.Y = Application.GetRealHeight(23); + listView.Height = Application.GetRealHeight(1549 - 23); + frameBack.AddChidren(listView); + var dicData = new Dictionary<string, DeviceRowInfo>(); var listGwId = new List<string>(); foreach (var textId in dicGroupDevice.Keys) @@ -370,27 +313,26 @@ /// <param name="dicData">浠ュ洖璺綔涓虹储寮曞幓鎸囧畾瀵硅薄</param> private void StartCheckDeviceOnline(VerticalListControl listView, List<string> listGwId, Dictionary<string, DeviceRowInfo> dicData) { - HdlThreadLogic.Current.RunThread(async () => + HdlThreadLogic.Current.RunThread(() => { + var listCheck = new HashSet<string>(); for (int i = 0; i < listGwId.Count; i++) { - if (listView == null) + if (listView.Parent == null) { return; } //杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵�� var zbway = HdlGatewayLogic.Current.GetLocalGateway(listGwId[i]); - var result = await Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, (device) => + var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, (device) => { string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device); - if (listView.Parent == null) + if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true) { return; } - if (listView == null || dicData.ContainsKey(mainkeys) == false) - { - return; - } + listCheck.Add(mainkeys); + var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys); if (localDevice != null && localDevice.IsOnline != device.IsOnline) { -- Gitblit v1.8.0