old mode 100755
new mode 100644
| | |
| | | /// <summary>
|
| | | /// 场景功能中部背景bodyView(高度为设备菜单的那个白色背景的上部到屏幕底部)
|
| | | /// </summary>
|
| | | public FrameLayout functionSceneBodyView;
|
| | | public NormalFrameLayout functionSceneBodyView;
|
| | | /// <summary>
|
| | | /// 中部背景bodyView(高度为场景功能切换控件的底部到屏幕底部)
|
| | | /// </summary>
|
| | | public FrameLayout functionSceneAutoBodyView;
|
| | | public NormalFrameLayout functionSceneAutoBodyView;
|
| | | /// <summary>
|
| | | /// 右上角添加按钮
|
| | | /// </summary>
|
| | |
| | | /// </summary>
|
| | | public CategoryMainForm()
|
| | | {
|
| | | this.FormID = "CategoryMainForm";
|
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor;
|
| | | instance = this;
|
| | | }
|
| | |
| | | {
|
| | | //先清除吧
|
| | | this.RemoveAll();
|
| | |
|
| | | //初始化头部控件
|
| | | this.InitTopControl();
|
| | | //初始化中间控件
|
| | |
| | | this.AddNormalDeviceReportEvent();
|
| | | //添加传感器状态上报事件
|
| | | this.AddSensorDeviceReportEvent();
|
| | | //开启传感器状态还原的线程
|
| | | this.StartRecoverSenorStatuThread();
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | private void InitTopControl()
|
| | | {
|
| | | //头部FrameLayout
|
| | | this.topFrameLayout = new FrameLayout();
|
| | | this.topFrameLayout = new NormalFrameLayout();
|
| | | topFrameLayout.Y = Application.GetRealHeight(104);
|
| | | topFrameLayout.Height = Application.GetRealHeight(127);
|
| | | topFrameLayout.BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor;
|
| | | this.AddChidren(topFrameLayout);
|
| | | //标题分类
|
| | | var btnTitle = new NormalViewControl(300, 95, true);
|
| | | var btnTitle = new NormalViewControl(400, 95, true);
|
| | | btnTitle.X = ControlCommonResourse.XXLeft;
|
| | | btnTitle.Gravity = Gravity.CenterVertical;
|
| | | btnTitle.TextID = R.MyInternationalizationString.Category;
|
| | |
| | | private void InitMidControls()
|
| | | {
|
| | | //应该是body吧
|
| | | this.bodyFrameLayout = new FrameLayout();
|
| | | this.bodyFrameLayout = new NormalFrameLayout();
|
| | | bodyFrameLayout.Y = topFrameLayout.Bottom;
|
| | | bodyFrameLayout.Height = this.Height - topFrameLayout.Bottom;
|
| | | bodyFrameLayout.BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor;
|
| | |
| | | btnFloorName.Y = Application.GetRealHeight(17);
|
| | | btnFloorName.TextAlignment = TextAlignment.CenterRight;
|
| | | btnFloorName.IsBold = true;
|
| | | btnFloorName.Text = HdlResidenceLogic.Current.GetFloorNameById(Config.Instance.Home.CurrentFloorId);
|
| | | btnFloorName.Text = Common.Config.Instance.Home.GetCurrentFloorName;
|
| | | frameSwitchBack.AddChidren(btnFloorName);
|
| | | btnFloorName.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | var floors = new SelectFloorForm();
|
| | | floors.CurFloorId = Config.Instance.Home.CurrentFloorId;
|
| | | AddChidren(floors);
|
| | | floors.Init(580, 330, Direction.Right);
|
| | | 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);
|
| | | Config.Instance.Home.CurrentFloorId = floorId;
|
| | | HdlRoomLogic.Current.NowCategoryRoom = HdlRoomLogic.Current.GetLoveRoom();
|
| | | //这个时候需要刷新主页
|
| | | UserPage.Instance.RefreshMainPageForm = true;
|
| | | //刷新bodyView
|
| | | this.RefreshBodyView();
|
| | | };
|
| | |
| | | }
|
| | |
|
| | | //目前不知道郭雪城的这个具体放在哪个的位置
|
| | | this.functionSceneAutoBodyView = new FrameLayout();
|
| | | this.functionSceneAutoBodyView = new NormalFrameLayout();
|
| | | functionSceneAutoBodyView.Y = frameSwitchBack.Bottom;
|
| | | functionSceneAutoBodyView.Height = bodyFrameLayout.Height - frameSwitchBack.Bottom;
|
| | | bodyFrameLayout.AddChidren(functionSceneAutoBodyView);
|
| | |
|
| | | //场景,功能,自动化的切换控件
|
| | | var switchContr = new SceneFunctionSwitchControl();
|
| | | switchContr.Y = Application.GetRealHeight(40);
|
| | | switchContr.Width = Application.GetRealWidth(650);
|
| | | switchContr.Gravity = Gravity.CenterVertical;
|
| | | frameSwitchBack.AddChidren(switchContr);
|
| | |
| | | private void InitRoomMenuControl()
|
| | | {
|
| | | //当前楼层的全部房间
|
| | | var lisrRoom = HdlRoomLogic.Current.GetRoomsByCurrentFloorIdAppendLoveRoom();
|
| | | var lisrRoom = HdlRoomLogic.Current.GetRoomsByFloorIdAppendLoveRoom(Config.Instance.Home.CurrentFloorId);
|
| | | 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)
|
| | | {
|
| | |
| | | };
|
| | |
|
| | | //功能和场景bodyView
|
| | | this.functionSceneBodyView = new FrameLayout();
|
| | | this.functionSceneBodyView = new NormalFrameLayout();
|
| | | functionSceneBodyView.Y = roomSwitchContr.Bottom;
|
| | | functionSceneBodyView.Height = functionSceneAutoBodyView.Height - roomSwitchContr.Bottom;
|
| | | functionSceneAutoBodyView.AddChidren(functionSceneBodyView);
|
| | |
| | | frameDeviceBack.AddChidren(listDeviceView);
|
| | |
|
| | | //上一次选择的菜单
|
| | | MainPage.Controls.DeviceFunctionUnallocatedControl oldSelectContr = null;
|
| | | MainPage.Controls.DeviceFunctionMenuControl oldSelectContr = null;
|
| | | DeviceRowInfo nowSelectDeviceInfo = null;
|
| | | foreach (int Textid in dicGroupDevice.Keys)
|
| | | foreach (string strText in dicGroupDevice.Keys)
|
| | | {
|
| | | var rowInfo = dicGroupDevice[Textid];
|
| | | var rowInfo = dicGroupDevice[strText];
|
| | |
|
| | | //设备类型的容器
|
| | | var devieFrame = new FrameLayout();
|
| | |
| | | HorizontalView.AddChidren(devieFrame);
|
| | |
|
| | | //菜单图片控件
|
| | | var deviceObjContr = new MainPage.Controls.DeviceFunctionUnallocatedControl();
|
| | | var deviceObjContr = new MainPage.Controls.DeviceFunctionMenuControl();
|
| | | devieFrame.AddChidren(deviceObjContr);
|
| | | deviceObjContr.InitControl(Language.StringByID(Textid), rowInfo.IconPath, rowInfo.IconPathSelected, rowInfo.listDeviceKeys);
|
| | | deviceObjContr.InitControl(strText, rowInfo.IconPath, rowInfo.IconPathSelected);
|
| | | deviceObjContr.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | //选择的是同一个东西的话,不处理
|
| | | if (nowSelectDeviceInfo.TextId != rowInfo.TextId)
|
| | | if (nowSelectDeviceInfo.Text != rowInfo.Text)
|
| | | {
|
| | | //上一次的菜单取消,本次菜单选择
|
| | | oldSelectContr.SetSelectStatu(false);
|
| | |
| | | {
|
| | | //先清空
|
| | | listView.RemoveAll();
|
| | | this.dicDeviceRowControl = new Dictionary<string, Controls.DeviceRowCommon>();
|
| | |
|
| | | var listDevice = new List<CommonDevice>();
|
| | | for (int i = 0; i < rowInfo.listDeviceKeys.Count; i++)
|
| | |
| | | {
|
| | | cardContr = new Controls.DeviceCurtainRowControl();
|
| | | }
|
| | | //晾衣架 Airer
|
| | | if (device.Type == DeviceType.Airer)
|
| | | {
|
| | | cardContr = new Controls.DeviceAirerRowControl();
|
| | | }
|
| | | //继电器
|
| | | else if (device.Type == DeviceType.OnOffOutput)
|
| | | {
|
| | |
| | | {
|
| | | cardContr = new Controls.DevicePmSensorRowControl();
|
| | | }
|
| | | // 空气质量传感器
|
| | | else if (device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | //获取设备类型
|
| | | var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
|
| | | //空气质量传感器
|
| | | if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.AirQualitySensor)
|
| | | {
|
| | | cardContr = new Controls.DeviceAirQualitySensorRowControl();
|
| | | }
|
| | | else
|
| | | {
|
| | | //温湿度
|
| | | cardContr = new Controls.DeviceTemperatureRowControl();
|
| | | }
|
| | | }
|
| | | //彩灯(调光器)
|
| | | else if (device.Type == DeviceType.DimmableLight)
|
| | | {
|
| | |
| | | {
|
| | | cardContr = new Controls.DeviceSensorRowControl();
|
| | | }
|
| | | //温湿度
|
| | | else if (device.Type == DeviceType.TemperatureSensor)
|
| | | {
|
| | | cardContr = new Controls.DeviceTemperatureRowControl();
|
| | | }
|
| | | //门锁
|
| | | else if (device.Type == DeviceType.DoorLock)
|
| | | {
|
| | | cardContr = new Controls.DeviceDoorLockRowControl();
|
| | | }
|
| | | //色温灯
|
| | | else if (device.Type == DeviceType.ColorTemperatureLight)
|
| | | {
|
| | | cardContr = new Controls.DeviceColorTemperatureRowControl();
|
| | | }
|
| | | //无法识别
|
| | | else
|
| | | if (cardContr == null)
|
| | | {
|
| | | cardContr = new Controls.DeviceRowCommon();
|
| | | //没有状态功能
|
| | |
| | | cardContr.chidrenYaxis = listView.rowSpace / 2;
|
| | | //初始化卡片
|
| | | listView.AddChidren(cardContr);
|
| | | cardContr.InitControl(device);
|
| | | cardContr.InitControl(device, HdlRoomLogic.Current.NowCategoryRoom);
|
| | | //控件记录到缓存中
|
| | | this.dicDeviceRowControl[LocalDevice.Current.GetDeviceMainKeys(device)] = cardContr;
|
| | | //加缓存,然后发命令
|
| | |
| | | }
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | for (int i = 0; i < listContr.Count; i++)
|
| | | int sendCount = 0;
|
| | | while (listView.Parent != null)
|
| | | {
|
| | | if (listView.Parent == null)
|
| | | bool hadSend = false;
|
| | | for (int i = 0; i < listContr.Count; i++)
|
| | | {
|
| | | return;
|
| | | if (listView.Parent == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | //如果还没有接收到数据,则再次发送
|
| | | if (listContr[i].ReceiveResponeResultStatu() == false)
|
| | | {
|
| | | //发送获取状态的命令
|
| | | listContr[i].SendStatuComand();
|
| | | hadSend = true;
|
| | | System.Threading.Thread.Sleep(300);
|
| | | }
|
| | | }
|
| | | System.Threading.Thread.Sleep(200);
|
| | | //发送获取状态的命令
|
| | | listContr[i].SendStatuComand();
|
| | | if (hadSend == false)
|
| | | {
|
| | | //如果已经全部回路都接收了网关回复,则不再二次发送
|
| | | break;
|
| | | }
|
| | | sendCount++;
|
| | | if (sendCount == 2)
|
| | | {
|
| | | //就发2次
|
| | | break;
|
| | | }
|
| | | System.Threading.Thread.Sleep(5000);
|
| | | }
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | |
| | | /// <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(false);
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | listview1.EndHeaderRefreshing();
|
| | | //listview1.Parent为null代表它切换房间了
|
| | | if (result == true && listview1.Parent != null)
|
| | | {
|
| | | //刷新场景的时候,关闭左划菜单的未分配界面
|
| | | MainPage.LeftListRoomViewFrom.Instance?.CloseUnallocatedRoomForm();
|
| | | //在外面清空(特效的问题)
|
| | | 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)
|
| | | {
|
| | | //在滑动控件里面添加一个桌布
|
| | | 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(functionSceneBodyView, arryMsg);
|
| | | 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)
|
| | | {
|
| | | //场景卡片控件
|
| | |
| | | while (remainTime > 0 && this.Parent != null)
|
| | | {
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | sceneContr.SetTimeText(this.GetTimeString(remainTime, hourText, minuText, secondText));
|
| | | });
|
| | | }, ShowErrorMode.NO);
|
| | | remainTime--;
|
| | | }
|
| | | Application.RunOnMainThread(() =>
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (listview.Parent != null)
|
| | | {
|
| | |
| | | //开启Loading特效
|
| | | sceneContr.StartLoadingApreal();
|
| | | }
|
| | | });
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | private void AddNormalDeviceReportEvent()
|
| | | {
|
| | | //设备属性上报(缓存的修改交由 HdlGatewayReceiveLogic 处理)
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewDeviceStatus", ReceiveComandDiv.A设备属性上报, (report) =>
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("CategoryMainFormDeviceStatus", ReceiveComandDiv.A设备属性上报, (report) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //处理一般设备的上报数据
|
| | | string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | //晾衣架上报需要特殊处理,其他上报的回路统一转为端点1
|
| | | var tempList = LocalDevice.Current.GetDevicesByMac(report.DeviceAddr);
|
| | | if (tempList.Count > 0)
|
| | | {
|
| | | var tempDeviceEnum = LocalDevice.Current.GetMyDeviceEnumInfo(tempList);
|
| | | if (tempDeviceEnum.ConcreteType == Common.DeviceConcreteType.Airer)
|
| | | {
|
| | | mainKeys = report.DeviceAddr + "_" + 1;
|
| | | }
|
| | | }
|
| | | if (this.dicDeviceRowControl.ContainsKey(mainKeys) == true)
|
| | | {
|
| | | //刷新卡片信息
|
| | |
| | | //已经接收到网关的反馈 2020.05.09:删除Ack主题
|
| | | this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu();
|
| | | //刷新控件
|
| | | this.dicDeviceRowControl[mainKeys].RefreshControlInfo(locadevice);
|
| | | if (locadevice.Type != DeviceType.IASZone)
|
| | | {
|
| | | //传感器不需要属性上报(但是那个球型传感器居然会属性上报)
|
| | | this.dicDeviceRowControl[mainKeys].RefreshControlInfo(locadevice);
|
| | | }
|
| | | else if (report.DeviceStatusReport.CluterID == 1)
|
| | | {
|
| | | //这个是电量推送
|
| | | this.dicDeviceRowControl[mainKeys].RefreshBatteryStatu();
|
| | | }
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | |
|
| | | //设备在线上报(缓存的修改交由 HdlGatewayReceiveLogic 处理)
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewDeviceOnline", ReceiveComandDiv.A设备在线上报, (report) =>
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("CategoryMainFormDeviceOnline", ReceiveComandDiv.A设备在线上报, (report) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | private void AddSensorDeviceReportEvent()
|
| | | {
|
| | | //传感器上报(缓存的修改交由 HdlGatewayReceiveLogic 处理)
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("UserHomeViewSensor", ReceiveComandDiv.A传感器上报, (report) =>
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("CategoryMainFormSensor", ReceiveComandDiv.A传感器上报, (report) =>
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | |
| | | string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | if (this.dicDeviceRowControl.ContainsKey(mainKeys) == true)
|
| | | {
|
| | | //本地设备对象
|
| | | var locadevice = LocalDevice.Current.GetDevice(mainKeys);
|
| | | //刷新卡片信息
|
| | | this.dicDeviceRowControl[mainKeys].RefreshControlInfo(locadevice);
|
| | | //开启行闪烁特效
|
| | | this.dicDeviceRowControl[mainKeys].StartRowLightAppeal();
|
| | | }
|
| | |
|
| | | }, ShowErrorMode.NO);
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 传感器状态还原_____________________
|
| | |
|
| | | /// <summary>
|
| | | /// 开启传感器状态还原的线程
|
| | | /// </summary>
|
| | | private void StartRecoverSenorStatuThread()
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | while (this.Parent != null)
|
| | | {
|
| | | try
|
| | | {
|
| | | var dicControl = this.dicDeviceRowControl;
|
| | | foreach (var contr in dicControl.Values)
|
| | | {
|
| | | //如果是传感器,则刷新状态
|
| | | if (contr.device.Type == DeviceType.IASZone && contr.Parent != null
|
| | | && ((IASZone)contr.device).iASInfo == null)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | //设备状态必须刷新
|
| | | string statuText = HdlDeviceOtherLogic.Current.GetDeviceStatu(contr.device);
|
| | | contr.SetDeviceStatuText(statuText);
|
| | | //传感器切换为灰色状态
|
| | | contr.SwitchRowStatuAppeal(false);
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | | }
|
| | | System.Threading.Thread.Sleep(8000);
|
| | | }
|
| | | catch { System.Threading.Thread.Sleep(3000); }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | /// 获取分组后的设备
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private Dictionary<int, DeviceRowInfo> GetAllGroupDevice(Common.Room room)
|
| | | private Dictionary<string, DeviceRowInfo> GetAllGroupDevice(Common.Room room)
|
| | | {
|
| | | //全部的设备
|
| | | var listDeviceTemp = HdlRoomLogic.Current.GetRoomListDevice(room);
|
| | |
| | |
|
| | | //根据设备所属类型排序
|
| | | listDevice = LocalDevice.Current.SortDeviceByBelongType(listDevice);
|
| | | var dic = new Dictionary<int, DeviceRowInfo>();
|
| | | var dic = new Dictionary<string, DeviceRowInfo>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | var typeInfo = LocalDevice.Current.GetDeviceBelongEnumInfo(device);
|
| | | //按所属ID分组
|
| | | if (dic.ContainsKey(typeInfo.BeloneTextId) == false)
|
| | | if (dic.ContainsKey(typeInfo.BeloneText) == false)
|
| | | {
|
| | | dic[typeInfo.BeloneTextId] = new DeviceRowInfo();
|
| | | dic[typeInfo.BeloneText] = new DeviceRowInfo();
|
| | | string path1 = string.Empty;
|
| | | string path2 = string.Empty;
|
| | | //获取图片
|
| | | LocalDevice.Current.GetDeviceFunctionTypeMenuIcon(typeInfo.ConcreteType, ref path1, ref path2);
|
| | | dic[typeInfo.BeloneTextId].IconPath = path1;
|
| | | dic[typeInfo.BeloneTextId].IconPathSelected = path2;
|
| | | dic[typeInfo.BeloneTextId].TextId = typeInfo.BeloneTextId;
|
| | | LocalDevice.Current.GetDeviceFunctionTypeMenuIcon(typeInfo, ref path1, ref path2);
|
| | | dic[typeInfo.BeloneText].IconPath = path1;
|
| | | dic[typeInfo.BeloneText].IconPathSelected = path2;
|
| | | dic[typeInfo.BeloneText].Text = typeInfo.BeloneText;
|
| | | }
|
| | | dic[typeInfo.BeloneTextId].listDeviceKeys.Add(LocalDevice.Current.GetDeviceMainKeys(device));
|
| | | dic[typeInfo.BeloneText].listDeviceKeys.Add(LocalDevice.Current.GetDeviceMainKeys(device));
|
| | | }
|
| | | return dic;
|
| | | }
|
| | |
| | | {
|
| | | //把静态变量的这个东西置空
|
| | | instance = null;
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CategoryMainFormDeviceStatus");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CategoryMainFormDeviceOnline");
|
| | | HdlGatewayReceiveLogic.Current.RemoveEvent("CategoryMainFormSensor");
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
| | | private class DeviceRowInfo
|
| | | {
|
| | | /// <summary>
|
| | | /// 文本ID,目前用来做主键
|
| | | /// 文本,目前用来做主键
|
| | | /// </summary>
|
| | | public int TextId = 0;
|
| | | public string Text = string.Empty;
|
| | | /// <summary>
|
| | | /// 图标
|
| | | /// </summary>
|