HDL-ON_Android/Assets/Phone/Public/PopupDialog.png | 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL-ON_Android/HDL-ON_Android.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL-ON_iOS/HDL-ON_iOS.csproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL-ON_iOS/Resources/Phone/Public/PopupDialog.png | 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/HDL_ON.projitems | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
HDL-ON_Android/Assets/Phone/Public/PopupDialog.png
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" /> 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" /> HDL-ON_iOS/Resources/Phone/Public/PopupDialog.png
HDL_ON/Common/Utlis/FloorRoomSelectPopupView.cs
New file @@ -0,0 +1,305 @@ using HDL_ON.Entity; using Shared; using System; using System.Collections.Generic; using System.Text; namespace HDL_ON { /// <summary> /// 楼层及房间的选择界面 /// </summary> public class FloorRoomSelectPopupView { #region ■ 变量声明___________________________ /// <summary> /// 当前选择显示的UID(楼层,或者房间,或者全部) /// </summary> private string nowShowSelectId = DiySelectPopupDialog.ALLSELECT; /// <summary> /// 全部的功能(设备显示分支使用) /// </summary> private List<Function> listAllFun = null; #endregion #region ■ 场景显示___________________________ /// <summary> /// 显示选择场景的界面 /// </summary> /// <param name="btnFloor">楼层名字显示的控件,选择后,内部会自动变更显示文字,可以设置为null</param> /// <param name="SelectEvent">根据选择的条件,筛选之后的场景列表(第一个参数是选择的UID,不管有没有用,总之先返回)</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; } //返回的id是UID 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; } //房间的UID (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) { //用UID转换为roomId 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) { //获取这个楼层下面的全部房间ID 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">楼层名字显示的控件,选择后,内部会自动变更显示文字,可以设置为null</param> /// <param name="i_listAllFun">全部的设备列表,需要手动指定</param> /// <param name="SelectEvent">根据选择的条件,筛选之后的设备列表(第一个参数是选择的UID,不管有没有用,总之先返回)</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; } //返回的id是UID 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; } //房间的UID (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) { //用UID转换为roomId 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) { //获取这个楼层下面的全部房间ID 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 } } HDL_ON/Common/Utlis/FloorSelectPopupDialog.cs
New file @@ -0,0 +1,78 @@ using System; using System.Collections.Generic; using HDL_ON.Entity; namespace HDL_ON { public class FloorSelectPopupDialog { public FloorSelectPopupDialog() { } /// <summary> /// 一级List /// </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); } } } } 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\" /> HDL_ON/UI/UI0-Public/Widget/DiySelectPopupDialog.cs
New file @@ -0,0 +1,630 @@ using 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 /// 自己根据需要调整X、Y坐标 /// </summary> public FrameLayout BackView; /// <summary> /// /// </summary> Button leftAllButton; /// <summary> /// 一级滑动View /// </summary> VerticalScrolViewLayout leftScrolView; /// <summary> /// 二级滑动View /// </summary> VerticalScrolViewLayout rightScrolView; /// <summary> /// 选中回调事件 /// </summary> Action<string> SelectAction; /// <summary> /// 一级List /// </summary> List<RoomCellInfo> mFirstList = new List<RoomCellInfo>(); /// <summary> /// 二级联动List /// </summary> List<List<RoomCellInfo>> mSecondList = new List<List<RoomCellInfo>>(); /// <summary> /// 二级所有List /// </summary> List<RoomCellInfo> mSecondAllList = new List<RoomCellInfo>(); /// <summary> /// RoomSelectPopupDialog /// </summary> /// <param name="SelectAction"></param> public DiySelectPopupDialog() { bodyView = new FrameLayout(); } /// <summary> /// 显示View /// mFirstList、mSecondList不合法都不会显示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> /// 刷新二级联动的VIEW /// </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,//上一级楼层ID }; 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; } } HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -163,146 +163,18 @@ /// </summary> void LoadDialog_ChangeFloor() { EventHandler<MouseEventArgs> eventHandler = (sender, e) => string nowSelectId = null; btnFloor.MouseUpEventHandler += (sender, e) => { var dialog = new Dialog(); var dialogBody = new FrameLayout(); dialog.AddChidren(dialogBody); dialogBody.MouseUpEventHandler += (sender1, e1) => //显示下拉列表 var form = new FloorRoomSelectPopupView(); form.ShowDeviceFunctionView(btnFloor, this.functionList, (selectId, listFunc) => { dialog.Close(); nowSelectId = selectId; //重新加载界面 ShowFunctionRow(listFunc); }, nowSelectId); }; 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(); }; btnFloor.MouseUpEventHandler = eventHandler; btnFloorDownIcon.MouseUpEventHandler = eventHandler; } } } HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs
@@ -1,4 +1,5 @@ using 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(); //判断是否需要隐藏自动化 if (!HideAutoPage) { LoadAutomationPageView(); } LoadEventList(); } @@ -204,6 +215,23 @@ }; 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() @@ -212,13 +240,13 @@ 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; @@ -499,7 +538,7 @@ Action action = () => { LoadSceneFunctionControlZone(); LoadSceneFunctionControlZone(null); }; var aep = new NewSceneMenuListPage(action); MainPage.BasePageView.AddChidren(aep); 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>(); 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() { @@ -320,134 +300,23 @@ /// </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(); }; string nowSelectId = null; btnFloor.MouseUpEventHandler += (sender, e) => { var listAllFun = new List<Function>(); listAllFun.AddRange(unallocatedList); listAllFun.AddRange(allocatedList); var dispalyView = new FrameLayout() //显示下拉界面 var form = new FloorRoomSelectPopupView(); form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) => { 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; nowSelectId = selectId; //重新刷新设备列表 this.LoadFunctionListRow(listFun); }, nowSelectId); }; } dialog.Show(); }; btnFloor.MouseUpEventHandler = eventHandler; btnFloorDownIcon.MouseUpEventHandler = eventHandler; } } //---------------------------------------