From 2bc230cf2e7a7329c2329b07307a47b059835bbc Mon Sep 17 00:00:00 2001 From: WJC <wjc@hdlchina.com.cn> Date: 星期五, 18 十月 2019 10:20:52 +0800 Subject: [PATCH] 2019-10-18-1 --- ZigbeeApp/Shared/Phone/UserCenter/Safety/AddSceneAlarmTargetListForm.cs | 125 +++++++++++++++++++++++------------------ 1 files changed, 69 insertions(+), 56 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Safety/AddSceneAlarmTargetListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Safety/AddSceneAlarmTargetListForm.cs index 2b7cdbd..7aea3f8 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/Safety/AddSceneAlarmTargetListForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Safety/AddSceneAlarmTargetListForm.cs @@ -8,20 +8,22 @@ /// <summary> /// 娣诲姞鍦烘櫙鐨勫垪琛ㄧ晫闈� /// </summary> - public class AddSceneAlarmTargetListForm : UserCenterCommonForm + public class AddSceneAlarmTargetListForm : EditorCommonForm { + #region 鈻� 鍙橀噺澹版槑___________________________ + /// <summary> /// 鍒楄〃鎺т欢 /// </summary> - private VerticalScrolViewLayout listView = null; + private VerticalListControl listView = null; /// <summary> /// 闃插尯ID(杩欎釜涓滆タ浼间箮鏄敮涓�鐨�) /// </summary> private int zoonID = 0; - /// <summary> - /// 鏈湴瀛樺湪鐨勫満鏅� - /// </summary> - private List<Common.SceneRoomUI> listScene = null; + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ /// <summary> /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) @@ -31,70 +33,82 @@ public void ShowForm(int i_zoonID, List<Common.SceneRoomUI> i_listScene) { this.zoonID = i_zoonID; - this.listScene = i_listScene; //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uScence)); - //瀹屾垚 - var btnfinish = new TopLayoutFinshView(); - topFrameLayout.AddChidren(btnfinish); - btnfinish.MouseUpEventHandler += (sender, e) => - { - //淇濆瓨鍦烘櫙鍒板畨闃� - this.SaveSceneToSafety(); - }; - //鍒濆鍖栦腑閮ㄤ俊鎭� - this.InitMiddleFrame(); + this.InitMiddleFrame(i_listScene); } /// <summary> /// 鍒濆鍖栦腑閮ㄤ俊鎭� /// </summary> - private void InitMiddleFrame() + /// <param name="listScene">鐜板瓨鐨勫満鏅�</param> + private void InitMiddleFrame(List<Common.SceneRoomUI> listScene) { - //鍦烘櫙鍒楄〃 - var btnTitle = new TitleViewControl(); - btnTitle.TextColor = UserCenterColor.Current.TextGrayColor; - btnTitle.Y = Application.GetRealHeight(60); - btnTitle.Text = Language.StringByID(R.MyInternationalizationString.uScence) + Language.StringByID(R.MyInternationalizationString.uList); - bodyFrameLayout.AddChidren(btnTitle); + //娓呯┖bodyFrame + this.ClearBodyFrame(); - this.listView = new VerticalScrolViewLayout(); - this.listView.Y = btnTitle.Bottom; - this.listView.Height = bodyFrameLayout.Height - btnTitle.Bottom; - bodyFrameLayout.AddChidren(this.listView); + //瀹屾垚 + var btnfinish = new BottomClickButton(); + btnfinish.TextID = R.MyInternationalizationString.uFinish; + bodyFrameLayout.AddChidren(btnfinish); + btnfinish.ButtonClickEvent += (sender, e) => + { + //淇濆瓨鍦烘櫙鍒板畨闃� + this.SaveSceneToSafety(); + }; - new System.Threading.Thread(() => + this.listView = new VerticalListControl(29); + listView.Y = Application.GetRealHeight(-6); + listView.Height = btnfinish.Y - ControlCommonResourse.BottomButtonAndListViewSpace + Application.GetRealHeight(6); + listView.BackgroundColor = UserCenterColor.Current.White; + bodyFrameLayout.AddChidren(listView); + + HdlThreadLogic.Current.RunThread(() => { //鑾峰彇鏈湴瀹夐槻鐨勫満鏅� - Dictionary<int, string> dicScene = Common.LocalSafeguard.Current.GetLocalSceneByZoneID(this.zoonID); - foreach (var scene in this.listScene) + Dictionary<int, string> dicScene = HdlSafeguardLogic.Current.GetLocalSceneByZoneID(this.zoonID); + if (this.Parent == null) { - //濡傛灉瀹夐槻閲岄潰宸茬粡娣诲姞鏈夛紝鍒欎笉鍐嶆樉绀� - if (dicScene.ContainsKey(scene.sceneUI.Id) == true) - { - continue; - } - Application.RunOnMainThread(() => - { - //娣诲姞鍦烘櫙琛� - this.AddSceneRowLayout(scene); - }); + return; } - }) - { IsBackground = true }.Start(); + Application.RunOnMainThread(() => + { + int count = listScene.Count - 1; + for (int i = 0; i < listScene.Count; i++) + { + //濡傛灉瀹夐槻閲岄潰宸茬粡娣诲姞鏈夛紝鍒欎笉鍐嶆樉绀� + if (dicScene.ContainsKey(listScene[i].sceneUI.Id) == true) + { + continue; + } + var row = new SceneSimpleSelectControl(listScene[i].sceneUI, listView.rowSpace / 2); + listView.AddChidren(row); + row.InitControl(); + if (i != count) + { + //搴曠嚎 + row.AddBottomLine(); + } + } + if (listView.ChildrenCount > 0) + { + int realHeight = (listView.GetChildren(listView.ChildrenCount - 1).Height) * listView.ChildrenCount + Application.GetRealHeight(23); + if (realHeight < listView.Height) + { + //璋冩暣鐪熷疄楂樺害 + listView.Height = realHeight; + } + } + }); + }); } - /// <summary> - /// 娣诲姞鍦烘櫙琛� - /// </summary> - /// <param name="i_Scene"></param> - private void AddSceneRowLayout(Common.SceneRoomUI i_Scene) - { - var row = new SceneSelectRow(this.listView, i_Scene); - } + #endregion + + #region 鈻� 淇濆瓨鍦烘櫙___________________________ /// <summary> /// 淇濆瓨鍦烘櫙鍒板畨闃� @@ -110,14 +124,14 @@ { break; } - var row = (SceneSelectRow)myView; + var row = (SceneSimpleSelectControl)myView; if (row.IsSelected == false) { continue; } var actionObj = new Safeguard.AlarmActionObj(); actionObj.Type = 1; - actionObj.ScenesId = row.sceneRoomUI.sceneUI.Id; + actionObj.ScenesId = row.Scene.Id; listAction.Add(actionObj); } if (listAction.Count == 0) @@ -134,7 +148,7 @@ this.ShowProgressBar(); //娣诲姞鎶ヨ鐩爣鍒板畨闃� - bool success = await Common.LocalSafeguard.Current.AddAlarmTagetToSafety(this.zoonID, listAction); + bool success = await HdlSafeguardLogic.Current.AddAlarmTagetToSafety(this.zoonID, listAction); //鍏抽棴杩涘害鏉� this.CloseProgressBar(); @@ -142,12 +156,11 @@ { Application.RunOnMainThread(() => { - //鍒锋柊涓�瑙堢敾闈� - this.LoadFormMethodByName("AlarmTargetSettionForm", "SetMiddleInfo"); //鍏抽棴鑷韩 this.CloseForm(); }); } } + #endregion } } -- Gitblit v1.8.0