| | |
| | | /// </summary>
|
| | | public CategoryMainForm()
|
| | | {
|
| | | this.FormID = "CategoryMainForm";
|
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor;
|
| | | instance = this;
|
| | | }
|
| | |
| | | //应该是body吧
|
| | | this.bodyFrameLayout = new FrameLayout();
|
| | | bodyFrameLayout.Y = topFrameLayout.Bottom;
|
| | | bodyFrameLayout.Height = Application.GetRealHeight(1549);
|
| | | bodyFrameLayout.Height = this.Height - topFrameLayout.Bottom;
|
| | | bodyFrameLayout.BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor;
|
| | | this.AddChidren(bodyFrameLayout);
|
| | |
|
| | |
| | | floors.changeFloor = true;
|
| | | floors.FloorAction += (floorId) =>
|
| | | {
|
| | | btnFloorName.Text = Config.Instance.Home.GetFloorNameById(floorId);
|
| | | HdlRoomLogic.Current.CurrentRoom = HdlRoomLogic.Current.GetLoveRoom();
|
| | | btnFloorName.Text = HdlResidenceLogic.Current.GetFloorNameById(floorId);
|
| | | HdlRoomLogic.Current.NowCategoryRoom = HdlRoomLogic.Current.GetLoveRoom();
|
| | | //刷新bodyView
|
| | | this.RefreshBodyView();
|
| | | };
|
| | |
| | | //目前不知道郭雪城的这个具体放在哪个的位置
|
| | | this.functionSceneAutoBodyView = new FrameLayout();
|
| | | functionSceneAutoBodyView.Y = frameSwitchBack.Bottom;
|
| | | functionSceneAutoBodyView.Height = Application.GetRealHeight(1423);
|
| | | functionSceneAutoBodyView.Height = bodyFrameLayout.Height - frameSwitchBack.Bottom;
|
| | | bodyFrameLayout.AddChidren(functionSceneAutoBodyView);
|
| | |
|
| | | //场景,功能,自动化的切换控件
|
| | |
| | | {
|
| | | //当前楼层的全部房间
|
| | | var lisrRoom = HdlRoomLogic.Current.GetRoomsByCurrentFloorIdAppendLoveRoom();
|
| | | if (HdlRoomLogic.Current.NowCategoryRoom == null)
|
| | | {
|
| | | //设置第一个为初始房间
|
| | | HdlRoomLogic.Current.NowCategoryRoom = lisrRoom[0];
|
| | | }
|
| | | //房间菜单控件
|
| | | var roomSwitchContr = new RoomDeviceGroupMenuControl(lisrRoom);
|
| | | roomSwitchContr.Y = Application.GetRealHeight(-55);
|
| | | this.functionSceneAutoBodyView.AddChidren(roomSwitchContr);
|
| | | //设置初始值
|
| | | roomSwitchContr.SetDefultIndex(HdlRoomLogic.Current.CurrentRoom.Id);
|
| | | roomSwitchContr.SetDefultIndex(HdlRoomLogic.Current.NowCategoryRoom.Id);
|
| | | //选择事件
|
| | | roomSwitchContr.SelectRoomEvent += (selectRoom) =>
|
| | | {
|
| | | HdlRoomLogic.Current.CurrentRoom = selectRoom;
|
| | | HdlRoomLogic.Current.NowCategoryRoom = selectRoom;
|
| | | //场景
|
| | | if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
|
| | | {
|
| | |
| | | var dicGroupDevice = this.GetAllGroupDevice(room);
|
| | | if (dicGroupDevice.Count == 0)
|
| | | {
|
| | | this.ShowNoFunctionTip();
|
| | | //没有功能{0}请在个人中心--设备管理处添加
|
| | | string[] arryMsg = Language.StringByID(R.MyInternationalizationString.NoFunction).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | this.ShowNotDataImage(functionSceneBodyView, arryMsg);
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 提示没有功能
|
| | | /// </summary>
|
| | | private void ShowNoFunctionTip()
|
| | | {
|
| | | var noFunction = new Button()
|
| | | {
|
| | | Y = Application.GetRealHeight(320),
|
| | | Width = this.GetPictrueRealSize(757),
|
| | | Height = this.GetPictrueRealSize(435),
|
| | | UnSelectedImagePath = "Item/NoFunction.png",
|
| | | Gravity = Gravity.CenterHorizontal
|
| | | };
|
| | | functionSceneBodyView.AddChidren(noFunction);
|
| | |
|
| | | var noFunctionTip = new Button()
|
| | | {
|
| | | Y = noFunction.Bottom + Application.GetRealHeight(32),
|
| | | Height = Application.GetRealHeight(200),
|
| | | Width = Application.GetRealWidth(700),
|
| | | Gravity = Gravity.CenterHorizontal,
|
| | | Text = Language.StringByID(R.MyInternationalizationString.NoFunction).Replace("{\\r\\n}", "\r\n"),
|
| | | TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
|
| | | TextAlignment = TextAlignment.Center,
|
| | | IsMoreLines = true
|
| | | };
|
| | | functionSceneBodyView.AddChidren(noFunctionTip);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化设备列表控件_________________
|
| | |
| | | {
|
| | | cardContr = new Controls.DeviceFreshAirRowControl();
|
| | | }
|
| | | // PM2.5
|
| | | else if (device.Type == DeviceType.PMSensor)
|
| | | {
|
| | | cardContr = new Controls.DevicePmSensorRowControl();
|
| | | }
|
| | | //彩灯(调光器)
|
| | | else if (device.Type == DeviceType.DimmableLight)
|
| | | {
|
| | |
| | | {
|
| | | cardContr = new Controls.DeviceDoorLockRowControl();
|
| | | }
|
| | | //色温灯
|
| | | else if (device.Type == DeviceType.ColorTemperatureLight)
|
| | | {
|
| | | cardContr = new Controls.DeviceColorTemperatureRowControl();
|
| | | }
|
| | | //无法识别
|
| | | else
|
| | | {
|
| | |
| | | cardContr.chidrenYaxis = listView.rowSpace / 2;
|
| | | //初始化卡片
|
| | | listView.AddChidren(cardContr);
|
| | | cardContr.InitControl(device);
|
| | | cardContr.InitControl(device, HdlRoomLogic.Current.NowCategoryRoom);
|
| | | //控件记录到缓存中
|
| | | this.dicDeviceRowControl[LocalDevice.Current.GetDeviceMainKeys(device)] = cardContr;
|
| | | //加缓存,然后发命令
|
| | |
| | | /// <param name="room"></param>
|
| | | private void RefreshSceneView(Room room)
|
| | | {
|
| | | //主人,管理员专用刷新控件
|
| | | VerticalListRefreshControl listview1 = null;
|
| | | //成员专用不能刷新的控件
|
| | | VerticalListControl listview2 = null;
|
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | {
|
| | | //主人,管理员专用刷新控件
|
| | | listview1 = new VerticalListRefreshControl();
|
| | | functionSceneBodyView.AddChidren(listview1);
|
| | | //下拉刷新
|
| | | listview1.BeginHeaderRefreshingAction += () =>
|
| | | {
|
| | | //如果当前是虚拟住宅,则只给个特效
|
| | | if (Common.Config.Instance.Home.IsVirtually == true)
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | System.Threading.Thread.Sleep(1500);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | listview1.EndHeaderRefreshing();
|
| | | });
|
| | | });
|
| | | return;
|
| | | }
|
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | //从网关刷新场景列表
|
| | | bool result = HdlSceneLogic.Current.RefreshSceneUIList();
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | listview1.EndHeaderRefreshing();
|
| | | if (result == true)
|
| | | {
|
| | | //在外面清空(特效的问题)
|
| | | this.functionSceneBodyView.RemoveAll();
|
| | | HdlThreadLogic.Current.RunMainInThread(() =>
|
| | | {
|
| | | //刷新场景分支控件
|
| | | this.RefreshSceneView(room);
|
| | | });
|
| | | }
|
| | | });
|
| | | });
|
| | | };
|
| | | }
|
| | | else
|
| | | {
|
| | | //成员专用不能刷新的控件
|
| | | listview2 = new VerticalListControl();
|
| | | functionSceneBodyView.AddChidren(listview2);
|
| | | }
|
| | |
|
| | | var listScene = new List<SceneUI>();
|
| | | foreach (var sceneId in room.ListSceneId)
|
| | | {
|
| | |
| | | }
|
| | | if (listScene.Count == 0)
|
| | | {
|
| | | this.ShowNoSceneTip();
|
| | | //在滑动控件里面添加一个桌布
|
| | | var frameTable = new FrameLayout();
|
| | | listview1?.AddChidren(frameTable);
|
| | | listview2?.AddChidren(frameTable);
|
| | | //没有场景{0}请点击右上角添加
|
| | | string[] arryMsg = Language.StringByID(R.MyInternationalizationString.NoScene).Split(new string[] { "{0}" }, StringSplitOptions.RemoveEmptyEntries);
|
| | | this.ShowNotDataImage(frameTable, arryMsg);
|
| | | return;
|
| | | }
|
| | |
|
| | | var dicSceneContr = new Dictionary<int, SceneCategoryView>();
|
| | | //主人,管理员专用刷新控件
|
| | | VerticalListRefreshControl listview1 = null;
|
| | | //成员专用不能刷新的控件
|
| | | VerticalListControl listview2 = null;
|
| | | //if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
|
| | | //{
|
| | | // listview1 = new VerticalListRefreshControl();
|
| | | // functionSceneBodyView.AddChidren(listview1);
|
| | | //}
|
| | | //else
|
| | | {
|
| | | listview2 = new VerticalListControl();
|
| | | functionSceneBodyView.AddChidren(listview2);
|
| | | }
|
| | | |
| | | foreach (var scene in listScene)
|
| | | {
|
| | | //场景卡片控件
|
| | |
| | | });
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 显示没有场景
|
| | | /// </summary>
|
| | | private void ShowNoSceneTip()
|
| | | {
|
| | | var noFunction = new Button()
|
| | | {
|
| | | Y = Application.GetRealHeight(320),
|
| | | Width = this.GetPictrueRealSize(757),
|
| | | Height = this.GetPictrueRealSize(435),
|
| | | UnSelectedImagePath = "Item/NoFunction.png",
|
| | | Gravity = Gravity.CenterHorizontal
|
| | | };
|
| | | functionSceneBodyView.AddChidren(noFunction);
|
| | |
|
| | | var noScenceTip = new Button()
|
| | | {
|
| | | Y = noFunction.Bottom + Application.GetRealHeight(32),
|
| | | Height = Application.GetRealHeight(200),
|
| | | Width = Application.GetRealWidth(700),
|
| | | Gravity = Gravity.CenterHorizontal,
|
| | | Text = Language.StringByID(R.MyInternationalizationString.NoScene).Replace("{\\r\\n}", "\r\n"),
|
| | | TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor,
|
| | | TextAlignment = TextAlignment.Center,
|
| | | IsMoreLines = true
|
| | | };
|
| | | functionSceneBodyView.AddChidren(noScenceTip);
|
| | | }
|
| | |
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般设备状态上报___________________
|
| | |
| | | private void AddNormalDeviceReportEvent()
|
| | | {
|
| | | //设备属性上报(缓存的修改交由 HdlGatewayReceiveLogic 处理)
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewDeviceStatus", ReceiveComandDiv.A设备属性上报, (report) =>
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("CategoryMainFormDeviceStatus", ReceiveComandDiv.A设备属性上报, (report) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | {
|
| | | //刷新卡片信息
|
| | | var locadevice = LocalDevice.Current.GetDevice(mainKeys);
|
| | | if (report.DeviceStatusReport.CluterID == 513 && report.DeviceStatusReport.AttriBute[0].AttributeId == 28)
|
| | | {
|
| | | //空调是特殊的,它的开关是属性上报来着.已经接收到网关的反馈
|
| | | this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu();
|
| | | }
|
| | | if (report.DeviceStatusReport.CluterID == 514 && report.DeviceStatusReport.AttriBute[0].AttributeId == 0)
|
| | | {
|
| | | //新风是特殊的,它的开关是属性上报来着.已经接收到网关的反馈
|
| | | this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu();
|
| | | }
|
| | | //已经接收到网关的反馈 2020.05.09:删除Ack主题
|
| | | this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu();
|
| | | //刷新控件
|
| | | this.dicDeviceRowControl[mainKeys].RefreshControlInfo(locadevice);
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | |
|
| | | //设备在线上报(缓存的修改交由 HdlGatewayReceiveLogic 处理)
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewDeviceOnline", ReceiveComandDiv.A设备在线上报, (report) =>
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("CategoryMainFormDeviceOnline", ReceiveComandDiv.A设备在线上报, (report) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | bool bolOnline = LocalDevice.Current.CheckDeviceIsOnline(report);
|
| | | this.dicDeviceRowControl[mainKeys].SetRowOnlineStatu(bolOnline);
|
| | | return;
|
| | | }
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | |
|
| | | //设备控制反馈上报
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewDeviceRespone", ReceiveComandDiv.A节点控制反馈, (report) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | if (this.dicDeviceRowControl.ContainsKey(mainKeys) == true)
|
| | | {
|
| | | //设备卡片
|
| | | var deviceCardContr = this.dicDeviceRowControl[mainKeys];
|
| | | //已经接收到网关的反馈
|
| | | deviceCardContr.SetHadGetResponeResultStatu();
|
| | | }
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | |
| | | private void AddSensorDeviceReportEvent()
|
| | | {
|
| | | //传感器上报(缓存的修改交由 HdlGatewayReceiveLogic 处理)
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewSensor", ReceiveComandDiv.A传感器上报, (report) =>
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("CategoryMainFormSensor", ReceiveComandDiv.A传感器上报, (report) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | string path1 = string.Empty;
|
| | | string path2 = string.Empty;
|
| | | //获取图片
|
| | | LocalDevice.Current.GetDeviceObjectIcon(typeInfo.ConcreteType, ref path1, ref path2);
|
| | | LocalDevice.Current.GetDeviceFunctionTypeMenuIcon(typeInfo.ConcreteType, ref path1, ref path2);
|
| | | dic[typeInfo.BeloneTextId].IconPath = path1;
|
| | | dic[typeInfo.BeloneTextId].IconPathSelected = path2;
|
| | | if (device.Type == DeviceType.FreshAir)
|
| | | {
|
| | | dic[typeInfo.BeloneTextId].IconPath = "Device/FreshAirEpoint.png";
|
| | | dic[typeInfo.BeloneTextId].IconPathSelected = "Device/FreshAirEpointSelected.png";
|
| | | }
|
| | | dic[typeInfo.BeloneTextId].TextId = typeInfo.BeloneTextId;
|
| | | }
|
| | | dic[typeInfo.BeloneTextId].listDeviceKeys.Add(LocalDevice.Current.GetDeviceMainKeys(device));
|
| | |
| | | {
|
| | | //把静态变量的这个东西置空
|
| | | instance = null;
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CategoryMainFormDeviceStatus");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CategoryMainFormDeviceOnline");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CategoryMainFormSensor");
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|