| | |
| | |
|
| | | foreach (var data in lookRoom.SceneUIList)
|
| | | {
|
| | | var frameContr = new FrameLayout();
|
| | | frameContr.Height = Application.GetRealHeight(470);
|
| | | frameContr.Gravity = Gravity.CenterHorizontal;
|
| | | //场景控件
|
| | | var frameContr = new ScenePictrueControl();
|
| | | listView.AddChidrenFrame(frameContr);
|
| | |
|
| | | //场景图片
|
| | | var btnPic = new ImageView();
|
| | | btnPic.X = Application.GetRealWidth(179);
|
| | | btnPic.Width = Application.GetRealWidth(844);
|
| | | btnPic.Height = Application.GetRealHeight(420);
|
| | | btnPic.ImagePath = data.IconPath;
|
| | | btnPic.Radius = (uint)Application.GetRealHeight(17);
|
| | | frameContr.AddChidren(btnPic);
|
| | |
|
| | | var btnName = new NormalViewControl(251, 282, true);
|
| | | btnName.X = ControlCommonResourse.XXLeft;
|
| | | btnName.Y = Application.GetRealHeight(58);
|
| | | btnName.BackgroundColor = 0xff333333;
|
| | | btnName.RadiusEx = 17;
|
| | | btnName.Text = data.Name;
|
| | | btnName.TextSize = 15;
|
| | | btnName.TextColor = UserCenterColor.Current.White;
|
| | | btnName.TextAlignment = TextAlignment.Center;
|
| | | frameContr.AddChidren(btnName);
|
| | | frameContr.InitControl(data);
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | var dic = new Dictionary<int, DeviceRowInfo>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | | var typeInfo = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { device });
|
| | | var typeInfo = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device);
|
| | | //按所属ID分组
|
| | | if (dic.ContainsKey(typeInfo.BeloneTextId) == false)
|
| | | {
|
| | |
| | | string path1 = string.Empty;
|
| | | string path2 = string.Empty;
|
| | | //获取图片
|
| | | Common.LocalDevice.Current.GetDeviceBeloneIcon(typeInfo.ConcreteType, ref path1, ref path2);
|
| | | Common.LocalDevice.Current.GetDeviceObjectIcon(typeInfo.ConcreteType, ref path1, ref path2);
|
| | | dic[typeInfo.BeloneTextId].IconPath = path1;
|
| | | }
|
| | | dic[typeInfo.BeloneTextId].listDeviceKeys.Add(Common.LocalDevice.Current.GetDeviceMainKeys(device));
|
| | |
| | | }
|
| | | //这里主要只是获取在线状态
|
| | | var zbway = HdlGatewayLogic.Current.GetLocalGateway(listGwId[i]);
|
| | | var result = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, false, (device) =>
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
|
| | | if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | listCheck.Add(mainkeys);
|
| | | int statu = 0;
|
| | | var list = Common.LocalDevice.Current.GetDeviceListFromGateway(zbway, ref statu, false, ShowErrorMode.NO);
|
| | | if (statu != -1)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | for (int j = 0; j < list.Count; j++)
|
| | | {
|
| | | string mainkeys = Common.LocalDevice.Current.GetDeviceMainKeys(list[i]);
|
| | | if (listView.Parent == null || dicData.ContainsKey(mainkeys) == false || listCheck.Contains(mainkeys) == true)
|
| | | {
|
| | | return;
|
| | | }
|
| | | listCheck.Add(mainkeys);
|
| | |
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null && localDevice.IsOnline != device.IsOnline)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | localDevice.IsOnline = device.IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | | if (device.IsOnline == 1)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | dicData[mainkeys].OnlineCount += 1;
|
| | | dicData[mainkeys].btnOnline.Text = dicData[mainkeys].OnlineCount + "/" + dicData[mainkeys].listDeviceKeys.Count;
|
| | | });
|
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | var localDevice = Common.LocalDevice.Current.GetDevice(mainkeys);
|
| | | if (localDevice != null && localDevice.IsOnline != list[i].IsOnline)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | localDevice.IsOnline = list[i].IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | | if (list[i].IsOnline == 1)
|
| | | {
|
| | | dicData[mainkeys].OnlineCount += 1;
|
| | | dicData[mainkeys].btnOnline.Text = dicData[mainkeys].OnlineCount + "/" + dicData[mainkeys].listDeviceKeys.Count;
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|