From f4c86f68b900bd506ef7214b2ae9bd23a9d2ffa8 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期六, 19 十二月 2020 17:48:11 +0800 Subject: [PATCH] 完成筛选房间的功能 --- HDL-ON_Android/HDL-ON_Android.csproj | 1 HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs | 78 +++ HDL-ON_iOS/Resources/Phone/Public/PopupDialog.png | 0 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs | 231 ++------- HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | 150 ----- HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs | 59 + HDL-ON_iOS/HDL-ON_iOS.csproj | 1 HDL-ON_Android/Assets/Phone/Public/PopupDialog.png | 0 HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs | 305 ++++++++++++ HDL_ON/HDL_ON.projitems | 3 HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs | 630 +++++++++++++++++++++++++ 11 files changed, 1,128 insertions(+), 330 deletions(-) diff --git a/HDL-ON_Android/Assets/Phone/Public/PopupDialog.png b/HDL-ON_Android/Assets/Phone/Public/PopupDialog.png new file mode 100755 index 0000000..6c95d58 --- /dev/null +++ b/HDL-ON_Android/Assets/Phone/Public/PopupDialog.png Binary files differ diff --git a/HDL-ON_Android/HDL-ON_Android.csproj b/HDL-ON_Android/HDL-ON_Android.csproj index 998d684..5fe7cda 100644 --- a/HDL-ON_Android/HDL-ON_Android.csproj +++ b/HDL-ON_Android/HDL-ON_Android.csproj @@ -662,6 +662,7 @@ <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\CozyIcon.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\MeetingGuestsIcon.png" /> <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\ReadIcon.png" /> + <AndroidAsset Include="Assets\Phone\Public\PopupDialog.png" /> </ItemGroup> <ItemGroup> <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> diff --git a/HDL-ON_iOS/HDL-ON_iOS.csproj b/HDL-ON_iOS/HDL-ON_iOS.csproj index c6d98cf..2660c79 100644 --- a/HDL-ON_iOS/HDL-ON_iOS.csproj +++ b/HDL-ON_iOS/HDL-ON_iOS.csproj @@ -635,6 +635,7 @@ <BundleResource Include="Resources\Phone\FunctionIcon\Light\CozyIcon.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Light\MeetingGuestsIcon.png" /> <BundleResource Include="Resources\Phone\FunctionIcon\Light\ReadIcon.png" /> + <BundleResource Include="Resources\Phone\Public\PopupDialog.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> diff --git a/HDL-ON_iOS/Resources/Phone/Public/PopupDialog.png b/HDL-ON_iOS/Resources/Phone/Public/PopupDialog.png new file mode 100755 index 0000000..6c95d58 --- /dev/null +++ b/HDL-ON_iOS/Resources/Phone/Public/PopupDialog.png Binary files differ diff --git a/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs b/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs new file mode 100755 index 0000000..e0f3720 --- /dev/null +++ b/HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs @@ -0,0 +1,305 @@ +锘縰sing HDL_ON.Entity; +using Shared; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HDL_ON +{ + /// <summary> + /// 妤煎眰鍙婃埧闂寸殑閫夋嫨鐣岄潰 + /// </summary> + public class FloorRoomSelectPopupView + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + /// <summary> + /// 褰撳墠閫夋嫨鏄剧ず鐨刄ID(妤煎眰,鎴栬�呮埧闂�,鎴栬�呭叏閮�) + /// </summary> + private string nowShowSelectId = DiySelectPopupDialog.ALLSELECT; + /// <summary> + /// 鍏ㄩ儴鐨勫姛鑳�(璁惧鏄剧ず鍒嗘敮浣跨敤) + /// </summary> + private List<Function> listAllFun = null; + + #endregion + + #region 鈻� 鍦烘櫙鏄剧ず___________________________ + + /// <summary> + /// 鏄剧ず閫夋嫨鍦烘櫙鐨勭晫闈� + /// </summary> + /// <param name="btnFloor">妤煎眰鍚嶅瓧鏄剧ず鐨勬帶浠�,閫夋嫨鍚�,鍐呴儴浼氳嚜鍔ㄥ彉鏇存樉绀烘枃瀛�,鍙互璁剧疆涓簄ull</param> + /// <param name="SelectEvent">鏍规嵁閫夋嫨鐨勬潯浠�,绛涢�変箣鍚庣殑鍦烘櫙鍒楄〃(绗竴涓弬鏁版槸閫夋嫨鐨刄ID,涓嶇鏈夋病鏈夌敤,鎬讳箣鍏堣繑鍥�)</param> + /// <param name="i_defultSelectId">榛樿鍝釜涓洪�夋嫨鐘舵��</param> + public void ShowSceneView(Button btnFloor, Action<string, List<Scene>> SelectEvent, string i_defultSelectId = null) + { + //娓呯紦瀛� + this.ClearMemory(); + + if (string.IsNullOrEmpty(i_defultSelectId) == true) + { + i_defultSelectId = DiySelectPopupDialog.ALLSELECT; + } + + //杩斿洖鐨刬d鏄疷ID + new FloorSelectPopupDialog().ShowView((selectValue) => + { + this.nowShowSelectId = selectValue; + //鍒锋柊妤煎眰鐨勬樉绀哄悕瀛� + this.RefreshFloorShowName(btnFloor); + + //鑾峰彇鍙互鏄剧ず鐨勫満鏅垪琛� + var listScene = this.GetCanShowListScene(); + SelectEvent?.Invoke(this.nowShowSelectId, listScene); + SelectEvent = null; + + }, i_defultSelectId); + } + + /// <summary> + /// 鑾峰彇鑳藉鏄剧ず鐨勫満鏅� + /// </summary> + /// <returns></returns> + public List<Scene> GetCanShowListScene() + { + var listScene = new List<Scene>(); + + //鍏堢湅鐪嬪綋鍓嶉�夋嫨鐨勬樉绀虹被鍨� 1:鍏ㄩ儴 2:妤煎眰 3:鎴块棿 + var selectType = this.CheckSelectFloorIdType(); + if (selectType == 1) + { + return FunctionList.List.scenes; + } + + //鎴块棿鐨刄ID (key:uid value:roomId) + var dicRoomUid = new Dictionary<string, string>(); + foreach (var roomInfo in SpatialInfo.CurrentSpatial.RoomList) + { + dicRoomUid[roomInfo.uid] = roomInfo.roomId; + } + //鎴块棿 + if (selectType == 3) + { + //鐢║ID杞崲涓簉oomId + string roomId = dicRoomUid.ContainsKey(this.nowShowSelectId) == true ? dicRoomUid[this.nowShowSelectId] : string.Empty; + foreach (var scene in FunctionList.List.scenes) + { + //鍒ゆ柇杩欎釜鍦烘櫙鏄惁鏄繖涓埧闂寸殑 + if (scene.roomIds.Contains(roomId) == true) + { + listScene.Add(scene); + } + } + } + //妤煎眰 + else if (selectType == 2) + { + //鑾峰彇杩欎釜妤煎眰涓嬮潰鐨勫叏閮ㄦ埧闂碔D + var listRoomId = new List<string>(); + foreach (var roomInfo in SpatialInfo.CurrentSpatial.RoomList) + { + //鍒ゆ柇鏄笉鏄繖涓ゼ灞傜殑 + if (roomInfo.parentId == this.nowShowSelectId) + { + listRoomId.Add(roomInfo.roomId); + } + } + foreach (var scene in FunctionList.List.scenes) + { + //鍒ゆ柇杩欎釜鍦烘櫙鏄惁鏄繖涓埧闂寸殑 + foreach (var roomid in listRoomId) + { + if (scene.roomIds.Contains(roomid) == true) + { + listScene.Add(scene); + } + } + } + } + return listScene; + } + + #endregion + + #region 鈻� 璁惧鏄剧ず___________________________ + + /// <summary> + /// 鏄剧ず閫夋嫨鍦烘櫙鐨勭晫闈� + /// </summary> + /// <param name="btnFloor">妤煎眰鍚嶅瓧鏄剧ず鐨勬帶浠�,閫夋嫨鍚�,鍐呴儴浼氳嚜鍔ㄥ彉鏇存樉绀烘枃瀛�,鍙互璁剧疆涓簄ull</param> + /// <param name="i_listAllFun">鍏ㄩ儴鐨勮澶囧垪琛�,闇�瑕佹墜鍔ㄦ寚瀹�</param> + /// <param name="SelectEvent">鏍规嵁閫夋嫨鐨勬潯浠�,绛涢�変箣鍚庣殑璁惧鍒楄〃(绗竴涓弬鏁版槸閫夋嫨鐨刄ID,涓嶇鏈夋病鏈夌敤,鎬讳箣鍏堣繑鍥�)</param> + /// <param name="i_defultSelectId">榛樿鍝釜涓洪�夋嫨鐘舵��</param> + public void ShowDeviceFunctionView(Button btnFloor, List<Function> i_listAllFun, Action<string, List<Function>> SelectEvent, string i_defultSelectId = null) + { + //娓呯紦瀛� + this.ClearMemory(); + this.listAllFun = new List<Function>(); + this.listAllFun.AddRange(i_listAllFun); + + if (string.IsNullOrEmpty(i_defultSelectId) == true) + { + i_defultSelectId = DiySelectPopupDialog.ALLSELECT; + } + + //杩斿洖鐨刬d鏄疷ID + new FloorSelectPopupDialog().ShowView((selectValue) => + { + this.nowShowSelectId = selectValue; + //鍒锋柊妤煎眰鐨勬樉绀哄悕瀛� + this.RefreshFloorShowName(btnFloor); + + //鑾峰彇鍙互鏄剧ず鐨勮澶囧垪琛� + var listDevice = this.GetCanShowListDevice(); + SelectEvent?.Invoke(this.nowShowSelectId, listDevice); + SelectEvent = null; + + }, i_defultSelectId); + } + + /// <summary> + /// 鑾峰彇鑳藉鏄剧ず鐨勮澶� + /// </summary> + /// <returns></returns> + public List<Function> GetCanShowListDevice() + { + var listFunction = new List<Function>(); + + //鍏堢湅鐪嬪綋鍓嶉�夋嫨鐨勬樉绀虹被鍨� 1:鍏ㄩ儴 2:妤煎眰 3:鎴块棿 + var selectType = this.CheckSelectFloorIdType(); + if (selectType == 1) + { + return this.listAllFun; + } + + //鎴块棿鐨刄ID (key:uid value:roomId) + var dicRoomUid = new Dictionary<string, string>(); + foreach (var roomInfo in SpatialInfo.CurrentSpatial.RoomList) + { + dicRoomUid[roomInfo.uid] = roomInfo.roomId; + } + //鎴块棿 + if (selectType == 3) + { + //鐢║ID杞崲涓簉oomId + string roomId = dicRoomUid.ContainsKey(this.nowShowSelectId) == true ? dicRoomUid[this.nowShowSelectId] : string.Empty; + foreach (var func in this.listAllFun) + { + //鍒ゆ柇杩欎釜鍦烘櫙鏄惁鏄繖涓埧闂寸殑 + if (func.roomIds.Contains(roomId) == true) + { + listFunction.Add(func); + } + } + } + //妤煎眰 + else if (selectType == 2) + { + //鑾峰彇杩欎釜妤煎眰涓嬮潰鐨勫叏閮ㄦ埧闂碔D + var listRoomId = new List<string>(); + foreach (var roomInfo in SpatialInfo.CurrentSpatial.RoomList) + { + //鍒ゆ柇鏄笉鏄繖涓ゼ灞傜殑 + if (roomInfo.parentId == this.nowShowSelectId) + { + listRoomId.Add(roomInfo.roomId); + } + } + foreach (var func in this.listAllFun) + { + //鍒ゆ柇杩欎釜鍦烘櫙鏄惁鏄繖涓埧闂寸殑 + foreach (var roomid in listRoomId) + { + if (func.roomIds.Contains(roomid) == true) + { + listFunction.Add(func); + } + } + } + } + return listFunction; + } + + #endregion + + #region 鈻� 涓�鑸柟娉昣__________________________ + + /// <summary> + /// 鍒锋柊妤煎眰鐨勬樉绀哄悕瀛� + /// </summary> + /// <param name="btnFloorName"></param> + private void RefreshFloorShowName(Button btnFloorName) + { + if (btnFloorName == null) + { + return; + } + //鍏堢湅鐪嬪綋鍓嶉�夋嫨鐨勬樉绀虹被鍨� 1:鍏ㄩ儴 2:妤煎眰 3:鎴块棿 + var selectType = this.CheckSelectFloorIdType(); + if (selectType == 1) + { + //鍏ㄩ儴 + btnFloorName.Text = Language.StringByID(StringId.All); + } + //鎴块棿 + else if (selectType == 3) + { + foreach (var roomInfo in SpatialInfo.CurrentSpatial.RoomList) + { + if (roomInfo.uid == this.nowShowSelectId) + { + btnFloorName.Text = roomInfo.floorName + roomInfo.roomName; + return; + } + } + } + //妤煎眰 + else if (selectType == 2) + { + foreach (var floorInfo in SpatialInfo.CurrentSpatial.FloorList) + { + if (floorInfo.uid == this.nowShowSelectId) + { + btnFloorName.Text = floorInfo.roomName; + } + } + } + } + + /// <summary> + /// 鍒ゆ柇褰撳墠鎵�閫夌殑ID鐨勭被鍨� 1:鍏ㄩ儴 2:妤煎眰 3:鎴块棿 + /// </summary> + /// <returns></returns> + private int CheckSelectFloorIdType() + { + if (this.nowShowSelectId == DiySelectPopupDialog.ALLSELECT) + { + //鍏ㄩ儴 + return 1; + } + foreach (var floorInfo in SpatialInfo.CurrentSpatial.FloorList) + { + if (floorInfo.uid == this.nowShowSelectId) + { + //褰撳墠閫夋嫨鐨勬槸妤煎眰ID + return 2; + } + } + //涓嶅嚭鎰忓,搴旇鏄埧闂翠簡 + return 3; + } + + /// <summary> + /// 娓呴櫎缂撳瓨 + /// </summary> + public void ClearMemory() + { + //鍒濆鍊� + this.nowShowSelectId = DiySelectPopupDialog.ALLSELECT; + this.listAllFun = null; + } + + #endregion + } +} diff --git a/HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs b/HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs new file mode 100755 index 0000000..58130ee --- /dev/null +++ b/HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs @@ -0,0 +1,78 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.Entity; + +namespace HDL_ON +{ + public class FloorSelectPopupDialog + { + public FloorSelectPopupDialog() + { + } + + /// <summary> + /// 涓�绾ist + /// </summary> + List<RoomCellInfo> mFirstList = new List<RoomCellInfo>(); + /// <summary> + /// 浜岀骇鑱斿姩List + /// </summary> + List<List<RoomCellInfo>> mSecondList = new List<List<RoomCellInfo>>(); + + /// <summary> + /// + /// </summary> + public void ShowView(Action<string> selectAction, string selectTag = DiySelectPopupDialog.ALLSELECT) + { + + var floorList = SpatialInfo.CurrentSpatial.FloorList; + var roomList = SpatialInfo.CurrentSpatial.RoomList; + + if (floorList == null || floorList.Count == 0) + { + //娌℃湁妤煎眰鍙姞杞芥埧闂� + if (roomList == null) + { + Utlis.WriteLine("roomList null"); + return; + } + + mFirstList.Clear(); + foreach (var room in roomList) + { + mFirstList.Add(new RoomCellInfo() { Title = room.roomName, TagId = room.uid }); + } + var roomSelectPopupDialog = new DiySelectPopupDialog(); + roomSelectPopupDialog.ShowView(mFirstList, null, selectAction, selectTag); + } + else + { + mFirstList.Clear(); + mSecondList.Clear(); + //涓�绾ф暟缁勪负妤煎眰 + foreach (var floor in floorList) + { + mFirstList.Add(new RoomCellInfo() { Title = floor.roomName, TagId = floor.uid }); + var mList = new List<RoomCellInfo>(); + var allRoom = roomList.FindAll((room) => room.parentId == floor.uid); + foreach (var mRoom in allRoom) + { + mList.Add(new RoomCellInfo() { Title = mRoom.roomName, TagId = mRoom.uid }); + } + + if(mList == null) + { + mList = new List<RoomCellInfo>(); + } + mSecondList.Add(mList); + } + + var roomSelectPopupDialog = new DiySelectPopupDialog(); + roomSelectPopupDialog.ShowView(mFirstList, mSecondList, selectAction, selectTag); + + } + + } + + } +} diff --git a/HDL_ON/HDL_ON.projitems b/HDL_ON/HDL_ON.projitems index ccdf966..e3319b5 100644 --- a/HDL_ON/HDL_ON.projitems +++ b/HDL_ON/HDL_ON.projitems @@ -262,6 +262,9 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneAddPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Light\ColorTureLampPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Light\ColorTureLampPageBLL.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Common\Utlis\FloorRoomSelectPopupView.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Common\Utlis\FloorSelectPopupDialog.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)UI\UI0-Public\Widget\DiySelectPopupDialog.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)UI\" /> diff --git a/HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs b/HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs new file mode 100755 index 0000000..2d885b4 --- /dev/null +++ b/HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs @@ -0,0 +1,630 @@ +锘縰sing System; +using System.Collections.Generic; +using HDL_ON.UI.CSS; +using Shared; + +namespace HDL_ON +{ + /// <summary> + /// 妤煎眰DiySelectPopupDialog + /// </summary> + public class DiySelectPopupDialog : Dialog + { + /// <summary> + /// ALLSELECT + /// </summary> + public const string ALLSELECT = "ALLSELECT"; + + /// bodyView + /// </summary> + FrameLayout bodyView; + /// <summary> + /// 搴曢儴View + /// 鑷繁鏍规嵁闇�瑕佽皟鏁碭銆乊鍧愭爣 + /// </summary> + public FrameLayout BackView; + /// <summary> + /// + /// </summary> + Button leftAllButton; + /// <summary> + /// 涓�绾ф粦鍔╒iew + /// </summary> + VerticalScrolViewLayout leftScrolView; + /// <summary> + /// 浜岀骇婊戝姩View + /// </summary> + VerticalScrolViewLayout rightScrolView; + /// <summary> + /// 閫変腑鍥炶皟浜嬩欢 + /// </summary> + Action<string> SelectAction; + /// <summary> + /// 涓�绾ist + /// </summary> + List<RoomCellInfo> mFirstList = new List<RoomCellInfo>(); + /// <summary> + /// 浜岀骇鑱斿姩List + /// </summary> + List<List<RoomCellInfo>> mSecondList = new List<List<RoomCellInfo>>(); + /// <summary> + /// 浜岀骇鎵�鏈塋ist + /// </summary> + List<RoomCellInfo> mSecondAllList = new List<RoomCellInfo>(); + + /// <summary> + /// RoomSelectPopupDialog + /// </summary> + /// <param name="SelectAction"></param> + public DiySelectPopupDialog() + { + bodyView = new FrameLayout(); + + } + + /// <summary> + /// 鏄剧ずView + /// mFirstList銆乵SecondList涓嶅悎娉曢兘涓嶄細鏄剧ずView + /// mSecondList 涓嶄紶涓洪粯璁や竴绾� + /// </summary> + /// <param name="mFirstList"></param> + /// <param name="mSecondList"></param> + public void ShowView(List<RoomCellInfo> mFirstList, List<List<RoomCellInfo>> mSecondList, Action<string> SelectAction, string selectTagId = ALLSELECT) + { + if (mFirstList == null) + { + Utlis.WriteLine("mFirstList null"); + return; + } + //娉ㄥ唽鍥炶皟浜嬩欢 + this.SelectAction = SelectAction; + //浜屾槸鍚﹂渶瑕佷簩绾у垽鏂� + if (mSecondList == null || mSecondList.Count == 0) + { + //涓�绾� + this.mFirstList = mFirstList; + //View鏄剧ず + ShowOneBaseView(); + //鏁版嵁鍐呭濉厖 + RefreshOneBaseView(selectTagId); + } + else + { + if (mFirstList.Count != mSecondList.Count) + { + Utlis.WriteLine("鏁版嵁 涓嶈仈鍔ㄥ紓甯�"); + return; + } + //浜岀骇鑱斿姩 + this.mFirstList = mFirstList; + this.mSecondList = mSecondList; + this.mSecondAllList.Clear(); + foreach(var list in mSecondList) + { + foreach (var data in list) + { + this.mSecondAllList.Add(data); + } + } + + //View鏄剧ず + ShowDoubleBaseView(); + //鏁版嵁鍐呭濉厖 + RefreshDoubleBaseView(); + // + SetSelectTagId(selectTagId); + + } + this.Show(); + } + + + /// <summary> + /// + /// </summary> + void SelectAll() + { + RefreshSelectButton(leftScrolView, ALLSELECT); + var all = new RoomCellInfo() + { + TagId = ALLSELECT, + Title = "ALL", + }; + LoadRightScrolView(all, this.mSecondAllList); + } + + /// <summary> + /// 鏍规嵁tagID閫変腑 + /// </summary> + void SetSelectTagId(string tagId) + { + if (string.IsNullOrEmpty(tagId) || tagId == ALLSELECT) + { + SelectAll(); + } + else + { + + var tagInfo = mFirstList.Find((m) => m.TagId == tagId); + if (tagInfo != null) + { + var index = mFirstList.IndexOf(tagInfo); + if (index < mSecondList.Count) + { + RefreshSelectButton(leftScrolView, tagId); + LoadRightScrolView(tagInfo, mSecondList[index]); + return; + } + else + { + SelectAll(); + } + } + else + { + SelectAll(); + } + } + } + + #region 浜岀骇鑱斿姩閫夋嫨鏁堟灉 + /// <summary> + /// 鏄剧ず浜岀骇view + /// </summary> + void ShowDoubleBaseView() + { + bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1; + this.AddChidren(bodyView); + bodyView.MouseUpEventHandler = (sender, e) => + { + this.Close(); + }; + + BackView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(104), + Width = Application.GetRealWidth(283), + Height = Application.GetRealWidth(242), + }; + bodyView.AddChidren(BackView); + + var backImageView = new ImageView(){ + Width = BackView.Width, + Height = BackView.Height, + ImagePath = "Public/PopupDialog.png" + }; + BackView.AddChidren(backImageView); + + leftAllButton = new Button() + { + Y = Application.GetRealWidth(14), + X = Application.GetRealWidth(24), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + TextID = StringId.All, + IsSelected = true, + //IsBold = true, + }; + BackView.AddChidren(leftAllButton); + //鍒嗗壊绾� + var lineView1 = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = leftAllButton.Bottom, + X = leftAllButton.X, + BackgroundColor = CSS_Color.DividingLineColor, + }; + BackView.AddChidren(lineView1); + + leftScrolView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(8), + Y = leftAllButton.Bottom, + Height = Application.GetRealWidth(176), + Width = Application.GetRealWidth(128), + VerticalScrollBarEnabled = false, + }; + BackView.AddChidren(leftScrolView); + + rightScrolView = new VerticalScrolViewLayout() + { + X = leftScrolView.Right + Application.GetRealWidth(12), + Y = Application.GetRealWidth(58), + Height = Application.GetRealWidth(176), + Width = Application.GetRealWidth(128), + VerticalScrollBarEnabled = false, + }; + BackView.AddChidren(rightScrolView); + + leftAllButton.MouseUpEventHandler = (sender, e) => + { + leftAllButton.IsSelected = true; + + //鍔犺浇鍏ㄩ儴 + SelectAll(); + }; + } + + /// <summary> + /// 鍒锋柊浜岀骇鑱斿姩鐨刅IEW + /// </summary> + void RefreshDoubleBaseView() + { + leftScrolView.RemoveAll(); + for (var i = 0; i < mFirstList.Count; i++) + { + AddSelectButton(leftScrolView, mFirstList[i], mSecondList[i]); + } + } + + /// <summary> + /// scrolView閲岄潰Button 閫変腑鏁堟灉浜掓枼 + /// </summary> + /// <param name="scrolView"></param> + /// <param name="selectBtnTag"></param> + void RefreshSelectButton(VerticalScrolViewLayout scrolView, string selectBtnTag) + { + try + { + if (leftAllButton != null) + { + leftAllButton.IsSelected = selectBtnTag == ALLSELECT; + } + + if (scrolView != null) + { + for (int i = 0; i < scrolView.ChildrenCount; i++) + { + if (scrolView.GetChildren(i).GetType() == typeof(FrameLayout)) + { + var cellView = (FrameLayout)scrolView.GetChildren(i); + for (int j = 0; j < cellView.ChildrenCount; j++) + { + if (cellView.GetChildren(j).GetType() == typeof(Button)) + { + var titleButton = (Button)cellView.GetChildren(j); + var o = titleButton.GetTagByKey("BtnKey"); + if (o != null && o.ToString() == selectBtnTag) + { + titleButton.IsSelected = true; + } + else + { + titleButton.IsSelected = false; + } + } + } + } + } + } + } + catch + { + + } + } + + /// <summary> + /// 娣诲姞涓�绾фゼ灞傞�夋嫨CellView + /// </summary> + /// <param name="scrolView"></param> + /// <param name="firstData"></param> + /// <param name="rightList"></param> + void AddSelectButton(VerticalScrolViewLayout scrolView, RoomCellInfo firstData, List<RoomCellInfo> rightList) + { + var cellView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + Tag = "cell" + }; + scrolView.AddChidren(cellView); + + var titleButton = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = firstData.Title, + }; + cellView.AddChidren(titleButton); + titleButton.AddTag("BtnKey", firstData.TagId); + + //椤堕儴鍒嗗壊绾� + var lineView = new FrameLayout() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(1), + Width = Application.GetRealWidth(112), + BackgroundColor = CSS_Color.DividingLineColor, + Y = cellView.Height - Application.GetRealHeight(1), + }; + cellView.AddChidren(lineView); + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + //cellView.BackgroundColor = CSS_Color.viewTranslucence; + RefreshSelectButton(scrolView, firstData.TagId); + LoadRightScrolView(firstData, rightList); + }; + + titleButton.MouseUpEventHandler = eventHandler; + cellView.MouseUpEventHandler = eventHandler; + + //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => + //{ + // cellView.BackgroundColor = CSS_Color.TopViewColor; + //}; + + //titleButton.MouseDownEventHandler = mousDownEventHandler; + //cellView.MouseDownEventHandler = mousDownEventHandler; + } + + + + /// <summary> + /// 鍔犺浇浜岀骇婊戝姩View + /// </summary> + /// <param name="firstData"></param> + /// <param name="rightList"></param> + void LoadRightScrolView(RoomCellInfo firstData, List<RoomCellInfo> rightList) + { + rightScrolView.RemoveAll(); + + //娣诲姞椤堕儴鍒嗗壊绾� + var lineView2 = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + BackgroundColor = CSS_Color.DividingLineColor, + }; + rightScrolView.AddChidren(lineView2); + //娣诲姞鍏ㄩ儴鎸夐挳 + var allInfo = new RoomCellInfo() + { + Title = Language.StringByID(StringId.All), + TagId = firstData.TagId,//涓婁竴绾фゼ灞侷D + }; + AddRightSelectButton(rightScrolView, allInfo, true); + + for (var i = 0; i < rightList.Count; i++) + { + AddRightSelectButton(rightScrolView, rightList[i]); + } + + } + + /// <summary> + /// 娣诲姞浜岀骇閫夋嫨CellView + /// </summary> + /// <param name="scrolView"></param> + /// <param name="secondData"></param> + /// <param name="isSelected"></param> + void AddRightSelectButton(VerticalScrolViewLayout scrolView, RoomCellInfo secondData, bool isSelected = false) + { + var cellView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + }; + scrolView.AddChidren(cellView); + + var titleButton = new Button() + { + //X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = secondData.Title, + IsSelected = isSelected + }; + cellView.AddChidren(titleButton); + + var lineView = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = cellView.Height - Application.GetRealHeight(1), + BackgroundColor = CSS_Color.DividingLineColor, + }; + cellView.AddChidren(lineView); + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + this.Close(); + //鍥炶皟閫変腑绱㈠紩 + SelectAction?.Invoke(secondData.TagId); + }; + + titleButton.MouseUpEventHandler = eventHandler; + cellView.MouseUpEventHandler = eventHandler; + + + } + + #endregion + + + #region 鍙湁涓�绾х殑鑱斿姩 + /// <summary> + /// 閮芥樉绀轰竴绾х殑 + /// </summary> + void ShowOneBaseView() + { + bodyView.BackgroundColor = CSS_Color.DialogTransparentColor1; + this.AddChidren(bodyView); + bodyView.MouseUpEventHandler = (sender, e) => + { + this.Close(); + }; + + BackView = new FrameLayout() + { + X = Application.GetRealWidth(10), + Y = Application.GetRealHeight(104), + Width = Application.GetRealWidth(160), + Height = Application.GetRealWidth(198), + }; + bodyView.AddChidren(BackView); + + var backImageView = new ImageView() + { + Width = BackView.Width, + Height = BackView.Height, + ImagePath = "PersonalCenter/HomeList3bg.png" + }; + BackView.AddChidren(backImageView); + + leftAllButton = new Button() + { + Y = Application.GetRealWidth(14), + X = Application.GetRealWidth(24), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextAlignment = TextAlignment.CenterLeft, + TextID = StringId.All, + //IsBold = true, + }; + BackView.AddChidren(leftAllButton); + //鍒嗗壊绾� + var lineView1 = new FrameLayout() + { + Width = Application.GetRealWidth(112), + Height = Application.GetRealHeight(1), + Y = leftAllButton.Bottom, + X = leftAllButton.X, + BackgroundColor = CSS_Color.DividingLineColor, + }; + BackView.AddChidren(lineView1); + + leftScrolView = new VerticalScrolViewLayout() + { + X = Application.GetRealWidth(8), + Y = leftAllButton.Bottom, + Height = Application.GetRealWidth(132), + Width = Application.GetRealWidth(144), + VerticalScrollBarEnabled = false, + }; + BackView.AddChidren(leftScrolView); + + leftAllButton.MouseUpEventHandler = (sender, e) => + { + this.Close(); + SelectAction?.Invoke(ALLSELECT); + }; + } + + /// <summary> + /// + /// </summary> + /// <param name="tagId"></param> + void RefreshOneBaseView(string tagId) + { + if (leftAllButton != null) + { + leftAllButton.IsSelected = tagId == ALLSELECT; + } + leftScrolView.RemoveAll(); + for (var i = 0; i < mFirstList.Count; i++) + { + AddOneSelectButton(leftScrolView, mFirstList[i], tagId); + } + } + + /// <summary> + /// 娣诲姞涓�绾фゼ灞傞�夋嫨CellView + /// </summary> + /// <param name="scrolView"></param> + /// <param name="firstIndex"></param> + /// <param name="firstText"></param> + void AddOneSelectButton(VerticalScrolViewLayout scrolView, RoomCellInfo firstData, string tagId) + { + var cellView = new FrameLayout() + { + Height = Application.GetRealWidth(44), + Tag = "cell" + }; + scrolView.AddChidren(cellView); + + var titleButton = new Button() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealWidth(44), + TextColor = CSS_Color.FirstLevelTitleColor, + SelectedTextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.TextFontSize, + TextAlignment = TextAlignment.CenterLeft, + Text = firstData.Title, + }; + cellView.AddChidren(titleButton); + titleButton.IsSelected = firstData.TagId == tagId; + titleButton.AddTag("BtnKey", firstData.TagId); + + //椤堕儴鍒嗗壊绾� + var lineView = new FrameLayout() + { + X = Application.GetRealWidth(16), + Height = Application.GetRealHeight(1), + Width = Application.GetRealWidth(112), + BackgroundColor = CSS_Color.DividingLineColor, + Y = cellView.Height - Application.GetRealHeight(1), + }; + cellView.AddChidren(lineView); + + EventHandler<MouseEventArgs> eventHandler = (sender, e) => + { + this.Close(); + //鍥炶皟閫変腑绱㈠紩 + SelectAction?.Invoke(firstData.TagId); + }; + + titleButton.MouseUpEventHandler = eventHandler; + cellView.MouseUpEventHandler = eventHandler; + + //EventHandler<MouseEventArgs> mousDownEventHandler = (sender, e) => + //{ + // cellView.BackgroundColor = CSS_Color.TopViewColor; + //}; + + //titleButton.MouseDownEventHandler = mousDownEventHandler; + //cellView.MouseDownEventHandler = mousDownEventHandler; + } + + + + #endregion + + + #region 閫夋嫨妤煎眰鍜屾埧闂翠笓鐢� + + + #endregion + + + } + + /// <summary> + /// + /// </summary> + public class RoomCellInfo + { + /// <summary> + /// + /// </summary> + public string Title; + /// <summary> + /// + /// </summary> + public string TagId; + } +} diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs index cac5d2c..c140558 100755 --- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs +++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs @@ -163,146 +163,18 @@ /// </summary> void LoadDialog_ChangeFloor() { - EventHandler<MouseEventArgs> eventHandler = (sender, e) => - { - var dialog = new Dialog(); - var dialogBody = new FrameLayout(); - dialog.AddChidren(dialogBody); - dialogBody.MouseUpEventHandler += (sender1, e1) => - { - dialog.Close(); - }; - - var dispalyView = new FrameLayout() - { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(100), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(110), - BackgroundImagePath = "PersonalCenter/HomeList1bg.png", - }; - dialogBody.AddChidren(dispalyView); - - var contentView = new VerticalScrolViewLayout() - { - X = Application.GetRealWidth(8), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(45 * 2), - ScrollEnabled = false - }; - dispalyView.AddChidren(contentView); - - if (SpatialInfo.CurrentSpatial.RoomList.Count < 2) - { - } - else if (SpatialInfo.CurrentSpatial.RoomList.Count < 3) - { - dispalyView = new FrameLayout() - { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(100), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(155), - BackgroundImagePath = "PersonalCenter/HomeList2bg.png", - }; - dialogBody.AddChidren(dispalyView); - - contentView.Height = Application.GetRealHeight(45 * 3); - dispalyView.AddChidren(contentView); - } - else if (SpatialInfo.CurrentSpatial.RoomList.Count < 4) - { - dispalyView = new FrameLayout() - { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(100), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(200), - BackgroundImagePath = "PersonalCenter/HomeList3bg.png", - }; - dialogBody.AddChidren(dispalyView); - - contentView.Height = Application.GetRealHeight(45 * 4); - dispalyView.AddChidren(contentView); - } - else - { - dispalyView = new FrameLayout() - { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(100), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(245), - BackgroundImagePath = "PersonalCenter/HomeList4bg.png", - }; - dialogBody.AddChidren(dispalyView); - - contentView.Height = Application.GetRealHeight(45 * 5); - contentView.ScrollEnabled = true; - dispalyView.AddChidren(contentView); - } - - - List<Room> roomList = new List<Room>(); - roomList.Add(new Room() { roomName = Language.StringByID(StringId.All) }); - roomList.AddRange(SpatialInfo.CurrentSpatial.RoomList); - foreach (var tempRoom in roomList) - { - var roomName = tempRoom.roomName; - if (roomName != Language.StringByID(StringId.All)) - { - contentView.AddChidren(new Button() - { - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(1), - BackgroundColor = CSS_Color.BackgroundColor - }); - } - var btnHomeName = new Button() - { - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(44), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS_Color.FirstLevelTitleColor, - SelectedTextColor = CSS_Color.MainColor, - Text = roomName, - TextSize = CSS_FontSize.SubheadingFontSize, - IsSelected = btnFloor.Text == roomName, - IsMoreLines = true, - }; - contentView.AddChidren(btnHomeName); - - btnHomeName.MouseUpEventHandler += (senderH, en) => - { - dialog.Close(); - btnFloor.Text = roomName; - if (roomName == Language.StringByID(StringId.All)) - { - ShowFunctionRow(functionList); - } - else - { - var showList = new List<Function>(); - foreach (var sf in functionList) - { - if(sf.roomIds.Contains(tempRoom.roomId)) - { - showList.Add(sf); - } - } - ShowFunctionRow(showList); - } - }; - } - - dialog.Show(); + string nowSelectId = null; + btnFloor.MouseUpEventHandler += (sender, e) => + { + //鏄剧ず涓嬫媺鍒楄〃 + var form = new FloorRoomSelectPopupView(); + form.ShowDeviceFunctionView(btnFloor, this.functionList, (selectId, listFunc) => + { + nowSelectId = selectId; + //閲嶆柊鍔犺浇鐣岄潰 + ShowFunctionRow(listFunc); + }, nowSelectId); }; - - btnFloor.MouseUpEventHandler = eventHandler; - btnFloorDownIcon.MouseUpEventHandler = eventHandler; } } } \ No newline at end of file diff --git a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs index 6f1aa84..efac389 100755 --- a/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs @@ -1,4 +1,5 @@ 锘縰sing System; +using System.Collections.Generic; using HDL_ON.DriverLayer; using HDL_ON.Entity; using HDL_ON.UI.CSS; @@ -20,6 +21,10 @@ /// 鍦烘櫙鍐呭鏄剧ず鍖哄煙 /// </summary> FrameLayout floorChangeView; + /// <summary> + /// 妤煎眰鎴块棿閫夋嫨鐨勪笅鎷夊璞� + /// </summary> + FloorRoomSelectPopupView floorRoomSelectView = null; Button btnSceneTilte; #region 鍦烘櫙搴曢儴鍒囨崲鏄剧ず鍖哄煙 @@ -70,7 +75,9 @@ bodyView.AddChidren(topView); //涓嶆槸A缃戝叧鎴栬�呮槸鎴愬憳 鍙厑璁告坊鍔犲満鏅殣钘忚嚜鍔ㄥ寲 - if (DB_ResidenceData.Instance.GatewayType != 1 || DB_ResidenceData.Instance.CurrentRegion.IsOthreShare) + var HideAutoPage = DB_ResidenceData.Instance.GatewayType != 1 || DB_ResidenceData.Instance.CurrentRegion.IsOthreShare; + //鍒ゆ柇鏄惁闇�瑕侀殣钘忚嚜鍔ㄥ寲 + if (HideAutoPage) { btnSceneTilte = new Button() { @@ -147,7 +154,11 @@ bodyView.AddChidren(contentPageView); LoadScenePageView(); - LoadAutomationPageView(); + //鍒ゆ柇鏄惁闇�瑕侀殣钘忚嚜鍔ㄥ寲 + if (!HideAutoPage) + { + LoadAutomationPageView(); + } LoadEventList(); } @@ -202,23 +213,40 @@ TextAlignment = TextAlignment.CenterLeft, Text = DB_ResidenceData.Instance.CurFloor.roomName, }; - floorChangeView.AddChidren(btnFloor); + floorChangeView.AddChidren(btnFloor); + + string nowSelectId = null; + btnFloor.MouseUpEventHandler += (sender, e) => + { + if (this.floorRoomSelectView == null) + { + //鍏堝垵濮嬪寲 + this.floorRoomSelectView = new FloorRoomSelectPopupView(); + } + //鏄剧ず涓嬫媺鍒楄〃 + this.floorRoomSelectView.ShowSceneView(btnFloor, (selectId, listScene) => + { + nowSelectId = selectId; + //閲嶆柊鍒锋柊鍦烘櫙鍒楄〃 + this.LoadSceneFunctionControlZone(listScene); + }, nowSelectId); + }; #endregion - + sceneFunctionView = new VerticalScrolViewLayout() { Y = floorChangeView.Bottom, Height = Application.GetRealHeight(667 - 64 - 49 - 52 + 30), }; scenePageView.AddChidren(sceneFunctionView); - LoadSceneFunctionControlZone(); + LoadSceneFunctionControlZone(null); } /// <summary> /// 鍔犺浇鍦烘櫙鍔熻兘鏄剧ず鍖哄煙 /// </summary> - void LoadSceneFunctionControlZone() + void LoadSceneFunctionControlZone(List<Scene> listScene) { //topView.AddChidren(btnAddIcon); @@ -227,7 +255,18 @@ try { int index = 0; - foreach (var scene in FunctionList.List.scenes) + //鑾峰彇鑳藉鏄剧ず鐨勫満鏅� + if (listScene == null) + { + //鍒濆鍊� + if (this.floorRoomSelectView == null) + { + //鍏堝垵濮嬪寲 + this.floorRoomSelectView = new FloorRoomSelectPopupView(); + } + listScene = this.floorRoomSelectView.GetCanShowListScene(); + } + foreach (var scene in listScene) { //if (scene.roomIds.Count == 0)//濡備綍鍦ㄦ埧闂村凡缁忕Щ闄や簡杩欎釜鍔熻兘锛屽垯鏀惰棌鐣岄潰涔熶笉浼氬啀鏄剧ず //{ @@ -374,7 +413,7 @@ LoadEvent_ControlScene(btnCoverd,btnName,btnZone, scene); btnSettingIcon.MouseUpEventHandler = (sender, e) => { Action backAction = () => { - LoadSceneFunctionControlZone(); + LoadSceneFunctionControlZone(null); }; Action refreshAction = () => { btnName.Text = scene.name; @@ -406,7 +445,7 @@ contentPageView.AddChidren(automationPage); UI2.Intelligence.Automation.MainView.automationPage = automationPage; UI2.Intelligence.Automation.MainView.MainShow(); - } + } #endregion } @@ -499,7 +538,7 @@ Action action = () => { - LoadSceneFunctionControlZone(); + LoadSceneFunctionControlZone(null); }; var aep = new NewSceneMenuListPage(action); MainPage.BasePageView.AddChidren(aep); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs index 3b77f9e..0ad5aaf 100755 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs @@ -21,22 +21,14 @@ /// </summary> Button btnFloor; - /// <summary> - /// 绛涢�夐�夋嫨涓嬫媺鍥炬爣 - /// </summary> - Button btnScreenIcon; + ///// <summary> + ///// 绛涢�夐�夋嫨涓嬫媺鍥炬爣 + ///// </summary> + //Button btnScreenIcon; /// <summary> /// 绛涢�夋枃鏈樉绀� /// </summary> Button btnScreenText; - /// <summary> - /// 绛涢�夋潯浠�1 - /// </summary> - string screen1; - /// <summary> - /// 绛涢�夋潯浠�2 - /// </summary> - string screen2; VerticalScrolViewLayout functionListView; @@ -102,28 +94,28 @@ showdFunctionTypeRow.AddChidren(btnFloor); - btnScreenIcon = new Button() - { - Width = Application.GetMinRealAverage(16), - Height = Application.GetMinRealAverage(16), - X = Application.GetRealWidth(122), - Y = Application.GetRealHeight(18), - UnSelectedImagePath = "Public/DownIcon.png", - }; - showdFunctionTypeRow.AddChidren(btnScreenIcon); + //btnScreenIcon = new Button() + //{ + // Width = Application.GetMinRealAverage(16), + // Height = Application.GetMinRealAverage(16), + // X = Application.GetRealWidth(122), + // Y = Application.GetRealHeight(18), + // UnSelectedImagePath = "Public/DownIcon.png", + //}; + //showdFunctionTypeRow.AddChidren(btnScreenIcon); - btnScreenText = new Button() - { - X = btnScreenIcon.Right, - Y = Application.GetRealHeight(18), - Width = Application.GetRealWidth(200), - Height = Application.GetMinRealAverage(16), - TextColor = CSS_Color.FirstLevelTitleColor, - TextSize = CSS_FontSize.PromptFontSize_FirstLevel, - TextAlignment = TextAlignment.CenterLeft, - TextID = StringId.Screen - }; - showdFunctionTypeRow.AddChidren(btnScreenText); + //btnScreenText = new Button() + //{ + // X = btnScreenIcon.Right, + // Y = Application.GetRealHeight(18), + // Width = Application.GetRealWidth(200), + // Height = Application.GetMinRealAverage(16), + // TextColor = CSS_Color.FirstLevelTitleColor, + // TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + // TextAlignment = TextAlignment.CenterLeft, + // TextID = StringId.Screen + //}; + //showdFunctionTypeRow.AddChidren(btnScreenText); #endregion @@ -153,7 +145,7 @@ } } - LoadFunctionListRow(); + LoadFunctionListRow(null); LoadEventList(); } @@ -162,12 +154,16 @@ /// 鏄剧ず鍔熻兘Row /// </summary> /// <param name="showUnallocated">鏄惁鏄樉绀烘湭鍒嗛厤</param> - void LoadFunctionListRow() + void LoadFunctionListRow(List<Function> functions) { functionListView.RemoveAll(); - List<Function> functions = new List<Function>(); - functions.AddRange(unallocatedList); - functions.AddRange(allocatedList); + if (functions == null) + { + //鍒濆鍊� + functions = new List<Function>(); + functions.AddRange(unallocatedList); + functions.AddRange(allocatedList); + } foreach (var function in functions) { if (function.functionCategory != FunctionCategory.Light && @@ -176,22 +172,6 @@ ) { continue; - } - //鎸夋ゼ灞傜瓫閫� - if (!string.IsNullOrEmpty(screen1)) - { - if (!function.roomIds.Contains(screen1)) - { - continue; - } - } - //鎸夌被鍨嬬瓫閫� - if (!string.IsNullOrEmpty(screen2)) - { - //if (!function.functionType!= screen2) - //{ - // continue; - //} } functionListView.AddChidren(new Button() { @@ -319,135 +299,24 @@ /// 浣忓畢鍒楄〃鐐瑰嚮浜嬩欢 /// </summary> void LoadDialog_ChangeFloor() - { - EventHandler<MouseEventArgs> eventHandler = (sender, e) => { - var dialog = new Dialog(); - var dialogBody = new FrameLayout(); - dialog.AddChidren(dialogBody); - dialogBody.MouseUpEventHandler += (sender1, e1) => { - dialog.Close(); - }; - - var dispalyView = new FrameLayout() - { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(100), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(110), - BackgroundImagePath = "PersonalCenter/HomeList1bg.png", - }; - dialogBody.AddChidren(dispalyView); - - var contentView = new VerticalScrolViewLayout() - { - X = Application.GetRealWidth(8), - Y = Application.GetRealHeight(15), - Width = Application.GetRealWidth(150), - Height = Application.GetRealHeight(45 * 2), - ScrollEnabled = false - }; - dispalyView.AddChidren(contentView); - - if (SpatialInfo.CurrentSpatial.FloorList.Count < 2) - { - } - else if (SpatialInfo.CurrentSpatial.FloorList.Count < 3) - { - dispalyView = new FrameLayout() - { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(100), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(155), - BackgroundImagePath = "PersonalCenter/HomeList2bg.png", - }; - dialogBody.AddChidren(dispalyView); - - contentView.Height = Application.GetRealHeight(45 * 3); - dispalyView.AddChidren(contentView); - } - else if (SpatialInfo.CurrentSpatial.FloorList.Count < 4) - { - dispalyView = new FrameLayout() - { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(100), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(200), - BackgroundImagePath = "PersonalCenter/HomeList3bg.png", - }; - dialogBody.AddChidren(dispalyView); - - contentView.Height = Application.GetRealHeight(45 * 4); - dispalyView.AddChidren(contentView); - } - else - { - dispalyView = new FrameLayout() - { - X = Application.GetRealWidth(10), - Y = Application.GetRealHeight(100), - Width = Application.GetRealWidth(160), - Height = Application.GetRealHeight(245), - BackgroundImagePath = "PersonalCenter/HomeList4bg.png", - }; - dialogBody.AddChidren(dispalyView); - - contentView.Height = Application.GetRealHeight(45 * 5); - contentView.ScrollEnabled = true; - dispalyView.AddChidren(contentView); - } - - - List<string> chooseList = new List<string>(); - chooseList.Add(Language.StringByID(StringId.All)); - foreach (var f in SpatialInfo.CurrentSpatial.FloorList) - { - chooseList.Add(f.roomName); - } - - foreach (var floor in chooseList) - { - if (floor != Language.StringByID(StringId.All)) - { - contentView.AddChidren(new Button() - { - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(1), - BackgroundColor = CSS.CSS_Color.BackgroundColor - }); - } - var btnHomeName = new Button() - { - Gravity = Gravity.CenterHorizontal, - Width = Application.GetRealWidth(112), - Height = Application.GetRealHeight(44), - TextAlignment = TextAlignment.CenterLeft, - TextColor = CSS.CSS_Color.FirstLevelTitleColor, - SelectedTextColor = CSS.CSS_Color.MainColor, - Text = floor, - TextSize = CSS.CSS_FontSize.SubheadingFontSize, - IsSelected = btnFloor.Text == floor, - IsMoreLines = true, - Tag = floor - }; - contentView.AddChidren(btnHomeName); - - btnHomeName.MouseUpEventHandler += (senderH, en) => - { - dialog.Close(); - btnFloor.Text = floor; - }; - } - - dialog.Show(); + { + string nowSelectId = null; + btnFloor.MouseUpEventHandler += (sender, e) => + { + var listAllFun = new List<Function>(); + listAllFun.AddRange(unallocatedList); + listAllFun.AddRange(allocatedList); + + //鏄剧ず涓嬫媺鐣岄潰 + var form = new FloorRoomSelectPopupView(); + form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) => + { + nowSelectId = selectId; + //閲嶆柊鍒锋柊璁惧鍒楄〃 + this.LoadFunctionListRow(listFun); + }, nowSelectId); }; - - btnFloor.MouseUpEventHandler = eventHandler; - btnFloorDownIcon.MouseUpEventHandler = eventHandler; } - } //--------------------------------------- -- Gitblit v1.8.0