From 23420922845c9e77019a55c3b3e3271eb1ec261e Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 13 七月 2020 11:42:18 +0800 Subject: [PATCH] 新版本 --- ZigbeeApp/Shared/Phone/Category/AdjustTargetAddDeviceForm.cs | 96 ++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 81 insertions(+), 15 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Category/AdjustTargetAddDeviceForm.cs b/ZigbeeApp/Shared/Phone/Category/AdjustTargetAddDeviceForm.cs index 9e3167a..540e15e 100755 --- a/ZigbeeApp/Shared/Phone/Category/AdjustTargetAddDeviceForm.cs +++ b/ZigbeeApp/Shared/Phone/Category/AdjustTargetAddDeviceForm.cs @@ -42,6 +42,10 @@ /// 璁惧鍒楄〃鎺т欢 /// </summary> private VerticalListControl listDeviceView = null; + /// <summary> + /// 褰撳墠閫夋嫨鐨勬ゼ灞� + /// </summary> + private string nowSelectFloorId = string.Empty; #endregion @@ -57,6 +61,8 @@ //璁剧疆澶撮儴淇℃伅 base.SetTitleText(Language.StringByID(R.MyInternationalizationString.AddFunction)); + //鍒濆鍖栧彸涓婅鐨勬帶浠� + this.InitTopRightMenuControl(); //鍒濆鍖栦腑閮ㄤ俊鎭� this.InitMiddleFrame(); } @@ -66,8 +72,58 @@ /// </summary> private void InitMiddleFrame() { + //娓呯┖body + this.ClearBodyFrame(); //鍒濆鍖栨埧闂磋彍鍗曟帶浠� this.InitRoomMenuControl(); + } + + /// <summary> + /// 鍒濆鍖栧彸涓婅鐨勬帶浠� + /// </summary> + private void InitTopRightMenuControl() + { + //鑾峰彇妤煎眰 + var dicFloor = HdlRoomLogic.Current.GetFloorSortList(); + if (dicFloor.Count == 0) + { + return; + } + var btnIconContr = new MostRightIconControl(69, 69); + btnIconContr.UnSelectedImagePath = "Item/Drop_Down.png"; + topFrameLayout.AddChidren(btnIconContr); + btnIconContr.InitControl(); + + var btnFloor = new NormalViewControl(300, 69, true); + btnFloor.Gravity = Gravity.CenterVertical; + btnFloor.X = btnIconContr.X + btnIconContr.btnIcon.X - Application.GetRealWidth(300); + btnFloor.TextAlignment = TextAlignment.CenterRight; + topFrameLayout.AddChidren(btnFloor); + + foreach (var floorId in dicFloor.Keys) + { + //绗竴涓ゼ灞� + this.nowSelectFloorId = floorId; + btnFloor.Text = dicFloor[floorId]; + break; + } + + btnIconContr.ButtonClickEvent += (sender, e) => + { + //妤煎眰鑿滃崟 + var contr = new TopRightFloorMenuControl(dicFloor.Count, 2, this.nowSelectFloorId, Language.StringByID(R.MyInternationalizationString.SelectFloor)); + foreach (var floorId in dicFloor.Keys) + { + contr.AddRowMenu(floorId, () => + { + //璁板綍璧烽�夋嫨鐨処D + this.nowSelectFloorId = floorId; + btnFloor.Text = dicFloor[this.nowSelectFloorId]; + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(); + }); + } + }; } #endregion @@ -98,7 +154,10 @@ roomSwitchContr.SelectRoomEvent += (selectRoom) => { //鍦ㄥ闈㈡竻绌�(鐗规晥鐨勯棶棰�) - this.deviceFunctionMenuContr?.RemoveAll(); + if (this.deviceFunctionMenuContr != null && this.deviceFunctionMenuContr.Parent != null) + { + this.deviceFunctionMenuContr.RemoveAll(); + } this.listDeviceView?.RemoveAll(); HdlThreadLogic.Current.RunMainInThread(() => @@ -116,7 +175,10 @@ this.btnFinishControl = new BottomClickButton(); btnFinishControl.TextID = R.MyInternationalizationString.uFinish; bodyFrameLayout.AddChidren(btnFinishControl); - btnFinishControl.Visible = false; + if (this.dicNewListTask == null || this.dicNewListTask.Count == 0) + { + btnFinishControl.Visible = false; + } btnFinishControl.ButtonClickEvent += (sender, e) => { //鍥炶皟鍑芥暟 @@ -136,20 +198,24 @@ /// <returns></returns> private List<Room> GetCanShowRoomList() { - //鍏堝皢鍒楄〃Dictionary鍖� - this.dicNewListTask = new Dictionary<string, List<Safeguard.TaskListInfo>>(); - this.dicOldListTask = new Dictionary<string, List<Safeguard.TaskListInfo>>(); - foreach (var data in this.listAdjustTarget) + if (this.dicNewListTask == null) { - if (data.Type == 0) + //鍏堝皢鍒楄〃Dictionary鍖� + this.dicNewListTask = new Dictionary<string, List<Safeguard.TaskListInfo>>(); + this.dicOldListTask = new Dictionary<string, List<Safeguard.TaskListInfo>>(); + foreach (var data in this.listAdjustTarget) { - //鍙璁惧 - string mainkey = LocalDevice.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint); - dicOldListTask[mainkey] = data.TaskList; + if (data.Type == 0) + { + //鍙璁惧 + string mainkey = LocalDevice.Current.GetDeviceMainKeys(data.DeviceAddr, data.Epoint); + dicOldListTask[mainkey] = data.TaskList; + } } } + //褰撳墠妤煎眰鐨勫叏閮ㄦ埧闂� - var lisrRoom = HdlRoomLogic.Current.GetRoomsByCurrentFloorIdAppendLoveRoom(); + var lisrRoom = HdlRoomLogic.Current.GetRoomsByFloorIdAppendLoveRoom(this.nowSelectFloorId); var listShowRoom = new List<Room>(); foreach (var room in lisrRoom) { @@ -181,7 +247,7 @@ var dicGroupDevice = this.GetAllGroupDevice(room); //鍙垵濮嬪寲涓�娆� - if (this.deviceFunctionMenuContr == null) + if (this.deviceFunctionMenuContr == null || this.deviceFunctionMenuContr.Parent == null) { //璁惧鑿滃崟鐨勭櫧鑹茶儗鏅� var functionBack1 = new FrameLayout(); @@ -256,7 +322,7 @@ HdlThreadLogic.Current.RunMainInThread(() => { //鍒濆鍖栬澶囧垪琛ㄦ帶浠� - this.InitListDeviceControls(listDeviceView, rowInfo, room); + this.InitListDeviceControls(listDeviceView, rowInfo); }); } }; @@ -273,7 +339,7 @@ if (nowSelectDeviceInfo != null) { //鍒濆鍖栭粯璁ょ殑璁惧鍒楄〃鎺т欢 - this.InitListDeviceControls(listDeviceView, nowSelectDeviceInfo, room); + this.InitListDeviceControls(listDeviceView, nowSelectDeviceInfo); } } @@ -286,7 +352,7 @@ /// </summary> /// <param name="listView"></param> /// <param name="rowInfo"></param> - private void InitListDeviceControls(VerticalListControl listView, DeviceRowInfo rowInfo, Room i_room) + private void InitListDeviceControls(VerticalListControl listView, DeviceRowInfo rowInfo) { //鍏堟竻绌� listView.RemoveAll(); -- Gitblit v1.8.0