using System;
using System.Collections.Generic;
using HDL_ON.Entity;
namespace HDL_ON
{
public class FloorSelectPopupDialog
{
public FloorSelectPopupDialog()
{
}
///
/// 一级List
///
List mFirstList = new List();
///
/// 二级联动List
///
List> mSecondList = new List>();
///
///
///
public void ShowView(Action 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();
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();
}
mSecondList.Add(mList);
}
var roomSelectPopupDialog = new DiySelectPopupDialog();
roomSelectPopupDialog.ShowView(mFirstList, mSecondList, selectAction, selectTag);
}
}
}
}