New file |
| | |
| | | using Shared; |
| | | using HDL_ON.Stan; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.UI.CSS; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock |
| | | { |
| | | /// <summary> |
| | | /// 视频门锁列表界面 |
| | | /// </summary> |
| | | public class VideoDoorLockListPage : EditorCommonForm |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 门锁设备列表 |
| | | /// </summary> |
| | | private List<Function> listDevice = new List<Function>(); |
| | | /// <summary> |
| | | /// 电池控件列表(key:设备的sid) |
| | | /// </summary> |
| | | private Dictionary<string, BatteryPersentControl> dicBatteryContr = new Dictionary<string, BatteryPersentControl>(); |
| | | /// <summary> |
| | | /// 列表控件 |
| | | /// </summary> |
| | | private VerticalListControl listView = null; |
| | | /// <summary> |
| | | /// 删除设备后需要更新界面的回调 |
| | | /// </summary> |
| | | public Action action; |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | public VideoDoorLockListPage(Action action) { |
| | | this.action = action; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建) |
| | | /// </summary> |
| | | /// <param name="i_listDevice">门锁设备列表</param> |
| | | public void ShowForm(List<Function> i_listDevice) |
| | | { |
| | | this.listDevice.AddRange(i_listDevice); |
| | | //智能门锁 |
| | | base.SetTitleText(Language.StringByID(StringId.shipinmensuo)); |
| | | |
| | | //初始化中部信息 |
| | | this.InitMiddleFrame(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化中部信息 |
| | | /// </summary> |
| | | private void InitMiddleFrame() |
| | | { |
| | | //清空bodyFrame |
| | | this.ClearBodyFrame(); |
| | | |
| | | string nowSelectId = string.Empty; |
| | | //楼层下拉图标 |
| | | var btnFloor = new NormalViewControl(500, Application.GetRealHeight(16), false); |
| | | var btnFloorIcon = new IconViewControl(16); |
| | | btnFloorIcon.X = HdlControlResourse.XXLeft; |
| | | btnFloorIcon.Y = Application.GetRealHeight(18); |
| | | btnFloorIcon.UnSelectedImagePath = "Public/DownIcon.png"; |
| | | bodyFrameLayout.AddChidren(btnFloorIcon); |
| | | btnFloorIcon.ButtonClickEvent += (sender, e) => |
| | | { |
| | | //显示下拉列表 |
| | | var form = new FloorRoomSelectPopupView(); |
| | | form.ShowDeviceFunctionView(btnFloor, this.listDevice, (selectId, listFunc) => |
| | | { |
| | | btnFloor.Width = btnFloor.GetRealWidthByText();//重置文本宽度 |
| | | nowSelectId = selectId; |
| | | //重新初始化门锁列表控件 |
| | | this.InitDoorListControl(listFunc); |
| | | |
| | | }, nowSelectId); |
| | | }; |
| | | //楼层 |
| | | btnFloor.X = btnFloorIcon.Right + Application.GetRealWidth(2); |
| | | btnFloor.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnFloor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel; |
| | | btnFloor.Text = DB_ResidenceData.Instance.CurFloor.roomName; |
| | | //btnFloor.Width = btnFloor.GetRealWidthByText(); |
| | | bodyFrameLayout.AddChidren(btnFloor); |
| | | //让它相对图标居中 |
| | | btnFloor.Y = btnFloorIcon.Y + (btnFloorIcon.Height - btnFloor.Height) / 2; |
| | | btnFloor.ButtonClickEvent += (sender, e) => |
| | | { |
| | | btnFloorIcon.ButtonClickEvent(null, null); |
| | | }; |
| | | |
| | | //列表控件 |
| | | this.listView = new VerticalListControl(); |
| | | listView.Y = Application.GetRealHeight(53); |
| | | listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(53); |
| | | bodyFrameLayout.AddChidren(listView); |
| | | |
| | | //初始化门锁列表控件 |
| | | this.InitDoorListControl(this.listDevice); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 添加门锁控件_______________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化门锁列表控件 |
| | | /// </summary> |
| | | private void InitDoorListControl(List<Function> i_listDevice) |
| | | { |
| | | this.listView.RemoveAll(); |
| | | this.dicBatteryContr = new Dictionary<string, BatteryPersentControl>(); |
| | | |
| | | //生成门锁控件 |
| | | foreach (var device in i_listDevice) |
| | | { |
| | | this.AddDoorControl(device); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加门锁控件 |
| | | /// </summary> |
| | | /// <param name="i_device">门锁对象</param> |
| | | private void AddDoorControl(Function i_device) |
| | | { |
| | | //白色背景容器 |
| | | var frameBack = new FrameLayoutStatuControl(); |
| | | frameBack.Width = Application.GetRealWidth(343); |
| | | frameBack.Height = Application.GetRealHeight(96); |
| | | frameBack.Radius = (uint)Application.GetRealWidth(12); |
| | | frameBack.Gravity = Gravity.CenterHorizontal; |
| | | frameBack.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | this.listView.AddChidren(frameBack); |
| | | //门锁图标 |
| | | var btnIcon = new IconViewControl(32); |
| | | btnIcon.X = Application.GetRealWidth(10); |
| | | btnIcon.Y = Application.GetRealHeight(15); |
| | | btnIcon.UnSelectedImagePath = "FunctionIcon/DoorLock/DoorLock.png"; |
| | | frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEvent); |
| | | //设备名字 |
| | | var btnName = new Button(); |
| | | btnName.X = btnIcon.Right + Application.GetRealWidth(12); |
| | | btnName.Y = Application.GetRealHeight(12); |
| | | btnName.Width = Application.GetRealWidth(150); |
| | | btnName.Height = Application.GetRealHeight(20); |
| | | btnName.TextColor = CSS_Color.FirstLevelTitleColor; |
| | | btnName.TextAlignment = TextAlignment.CenterLeft; |
| | | btnName.Text = i_device.name; |
| | | frameBack.AddChidren(btnName, ChidrenBindMode.BindEvent); |
| | | //房间 |
| | | var btnRoom = new Button(); |
| | | btnRoom.X = btnName.X; |
| | | btnRoom.Y = btnName.Bottom + Application.GetRealHeight(4); |
| | | btnRoom.Width = Application.GetRealWidth(150); |
| | | btnRoom.Height = Application.GetRealHeight(15); |
| | | btnRoom.TextColor = CSS_Color.PromptingColor1; |
| | | btnRoom.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; |
| | | btnRoom.TextAlignment = TextAlignment.CenterLeft; |
| | | btnRoom.Text = i_device.GetRoomListName(); |
| | | frameBack.AddChidren(btnRoom, ChidrenBindMode.BindEvent); |
| | | //电池图标 |
| | | var btnBattery = new BatteryPersentControl(); |
| | | btnBattery.Y = Application.GetRealHeight(62); |
| | | //frameBack.AddChidren(btnBattery, ChidrenBindMode.BindEvent); |
| | | btnBattery.InitControl(); |
| | | btnBattery.SetValue(80); |
| | | btnBattery.X = frameBack.Width - btnBattery.Width - Application.GetRealWidth(12); |
| | | this.dicBatteryContr[i_device.sid] = btnBattery; |
| | | frameBack.ButtonClickEvent += (sender, e) => |
| | | { |
| | | |
| | | var form = new VideoDoorLockPage(i_device, btnName, btnRoom, CommonMethod.Comerom.function,()=> { |
| | | this.CloseForm(); |
| | | this.action?.Invoke(); |
| | | }); |
| | | MainPage.BasePageView.AddChidren(form); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | form.Show(); |
| | | |
| | | }; |
| | | |
| | | //底部再加个间距 |
| | | var frameSpace = new FrameLayout(); |
| | | frameSpace.Height = Application.GetRealHeight(12); |
| | | this.listView.AddChidren(frameSpace); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region ■ 设备状态推送_______________________ |
| | | |
| | | /// <summary> |
| | | /// 设备状态推送 |
| | | /// </summary> |
| | | /// <param name="i_LocalDevice"></param> |
| | | public override void DeviceStatuPush(Function i_LocalDevice) |
| | | { |
| | | //不是目标设备 |
| | | if (this.dicBatteryContr.ContainsKey(i_LocalDevice.sid) == false) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | } |