From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28
---
ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs | 135 +++++++++++++-------------------------------
1 files changed, 41 insertions(+), 94 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs
index 20a5eea..6edaca7 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Residence/LookRoomSettionForm.cs
@@ -107,30 +107,10 @@
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);
}
});
}
@@ -247,54 +227,16 @@
var dic = new Dictionary<int, DeviceRowInfo>();
foreach (var device in listDevice)
{
- var typeInfo = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<ZigBee.Device.CommonDevice>() { device });
- if (device.Type == DeviceType.IASZone)
+ var typeInfo = Common.LocalDevice.Current.GetDeviceBelongEnumInfo(device);
+ //鎸夋墍灞濱D鍒嗙粍
+ if (dic.ContainsKey(typeInfo.BeloneTextId) == false)
{
- //杩欎釜寮哄埗涓轰紶鎰熷櫒
- typeInfo.BeloneTextId = R.MyInternationalizationString.uDeviceBelongId1200;
- typeInfo.ConcreteType = Common.DeviceConcreteType.Sensor;
- }
- if (device.Type == DeviceType.OnOffOutput)
- {
- string iconPath = string.Empty;
- //缁х數鍣ㄧ殑鏃跺��,闇�瑕佺壒娈婂鐞�
- if (device.DfunctionType == DeviceFunctionType.A寮�鍏�)
- {
- typeInfo.BeloneTextId = R.MyInternationalizationString.uSwitch;
- iconPath = "Device/Switch.png";
- }
- else if (device.DfunctionType == DeviceFunctionType.A鎻掑骇)
- {
- typeInfo.BeloneTextId = R.MyInternationalizationString.uSocket1;
- iconPath = "Device/Socket1.png";
- }
- else if (device.DfunctionType == DeviceFunctionType.A鐏厜)
- {
- typeInfo.BeloneTextId = R.MyInternationalizationString.uLight;
- iconPath = "Device/Light.png";
- }
- else
- {
- //缁х數鍣�
- typeInfo.BeloneTextId = R.MyInternationalizationString.uDeviceBelongId2300;
- iconPath = "Device/Relay.png";
- }
- if (dic.ContainsKey(typeInfo.BeloneTextId) == false)
- {
- dic[typeInfo.BeloneTextId] = new DeviceRowInfo();
- dic[typeInfo.BeloneTextId].IconPath = iconPath;
- }
- }
- else
- {
- if (dic.ContainsKey(typeInfo.BeloneTextId) == false)
- {
- dic[typeInfo.BeloneTextId] = new DeviceRowInfo();
- string path1 = string.Empty;
- string path2 = string.Empty;
- Common.LocalDevice.Current.GetDeviceBeloneIcon(typeInfo.ConcreteType, ref path1, ref path2);
- dic[typeInfo.BeloneTextId].IconPath = path1;
- }
+ dic[typeInfo.BeloneTextId] = new DeviceRowInfo();
+ string path1 = string.Empty;
+ string path2 = string.Empty;
+ //鑾峰彇鍥剧墖
+ 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));
}
@@ -324,31 +266,36 @@
}
//杩欓噷涓昏鍙槸鑾峰彇鍦ㄧ嚎鐘舵��
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;
+ }
+ }
+ });
+ }
}
});
}
--
Gitblit v1.8.0