| | |
| | | /// <summary>
|
| | | /// 桌布控件
|
| | | /// </summary>
|
| | | private FrameLayout frameTable = null;
|
| | | private NormalFrameLayout frameTable = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | this.ClearBodyFrame();
|
| | |
|
| | | //初始化桌布控件
|
| | | this.frameTable = new FrameLayout();
|
| | | this.frameTable = new NormalFrameLayout();
|
| | | frameTable.Y = Application.GetRealHeight(187);
|
| | | frameTable.Height = bodyFrameLayout.Height - Application.GetRealHeight(187);
|
| | | bodyFrameLayout.AddChidren(frameTable);
|
| | |
| | | bodyFrameLayout.AddChidren(tabControl);
|
| | | tabControl.SelectTabEvent += (tabIndex) =>
|
| | | {
|
| | | if (tabIndex == 1)
|
| | | if (tabIndex == 0)
|
| | | {
|
| | | //显示场景列表
|
| | | this.ShowSceneList();
|
| | |
| | | this.ShowFunctionList();
|
| | | }
|
| | | };
|
| | | tabControl.InitControl();
|
| | | var listTitle = new List<string>();
|
| | | //场景,功能
|
| | | listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence));
|
| | | listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction));
|
| | | tabControl.InitControl(listTitle);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | this.frameTable.RemoveAll();
|
| | | HdlThreadLogic.Current.RunMainInThread(() =>
|
| | | {
|
| | | if (lookRoom.SceneUIList.Count == 0)
|
| | | if (lookRoom.ListSceneId.Count == 0)
|
| | | {
|
| | | //还没有添加场景哦
|
| | | this.ShowNotDataImage(frameTable, Language.StringByID(R.MyInternationalizationString.uDoNotHadAddScenceMsg));
|
| | | return;
|
| | | }
|
| | | var listView = new VerticalFrameControl(29);
|
| | | var listView = new VerticalFrameControl(3);
|
| | | listView.Height = frameTable.Height;
|
| | | frameTable.AddChidren(listView);
|
| | |
|
| | | foreach (var data in lookRoom.SceneUIList)
|
| | | foreach (var dataId in lookRoom.ListSceneId)
|
| | | {
|
| | | var data = HdlSceneLogic.Current.GetSceneUIBySceneId(dataId);
|
| | | if (data == null)
|
| | | {
|
| | | continue;
|
| | | }
|
| | | //场景控件
|
| | | var frameContr = new ScenePictrueControl();
|
| | | listView.AddChidrenFrame(frameContr);
|
| | | listView.AddChidren(frameContr);
|
| | | frameContr.InitControl(data);
|
| | | }
|
| | | });
|
| | |
| | | }
|
| | | }
|
| | | listView.AdjustRealHeight(Application.GetRealHeight(23));
|
| | | //开启设备在线监测
|
| | | this.StartCheckDeviceOnline(listView, listGwId, dicData);
|
| | | //如果不是虚拟住宅
|
| | | if (Common.Config.Instance.Home.IsVirtually == false)
|
| | | {
|
| | | //开启设备在线监测
|
| | | this.StartCheckDeviceOnline(listView, listGwId, dicData);
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | |
| | | private Dictionary<int, DeviceRowInfo> GetAllGroupDevice()
|
| | | {
|
| | | //全部的设备
|
| | | var listDevice = lookRoom.GetRoomListDevice();
|
| | | var listDevice = HdlRoomLogic.Current.GetRoomListDevice(lookRoom);
|
| | | var dic = new Dictionary<int, DeviceRowInfo>();
|
| | | foreach (var device in listDevice)
|
| | | {
|
| | |
| | | string path1 = string.Empty;
|
| | | string path2 = string.Empty;
|
| | | //获取图片
|
| | | Common.LocalDevice.Current.GetDeviceObjectIcon(typeInfo.ConcreteType, ref path1, ref path2);
|
| | | Common.LocalDevice.Current.GetDeviceFunctionTypeMenuIcon(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[j]);
|
| | | 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[j].IsOnline)
|
| | | {
|
| | | //在线状态一样的话,不需要刷新
|
| | | localDevice.IsOnline = list[j].IsOnline;
|
| | | localDevice.ReSave();
|
| | | }
|
| | | if (Common.LocalDevice.Current.CheckDeviceIsOnline(list[j]) == true)
|
| | | {
|
| | | dicData[mainkeys].OnlineCount += 1;
|
| | | dicData[mainkeys].btnOnline.Text = dicData[mainkeys].OnlineCount + "/" + dicData[mainkeys].listDeviceKeys.Count;
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|