From 351bdda734832d821a9764b0cde8be5d83c4ec50 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 01 十二月 2022 09:56:25 +0800
Subject: [PATCH] 2022年12月01日09:56:23
---
ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs | 115 +++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 74 insertions(+), 41 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs b/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs
index 26f077a..55ae1c5 100755
--- a/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/Category/CategoryMainForm.cs
@@ -92,7 +92,7 @@
this.AddChidren(topFrameLayout);
//鏍囬鍒嗙被
var btnTitle = new NormalViewControl(400, 95, true);
- btnTitle.X = HdlControlResourse.XXLeft;
+ btnTitle.X = ControlCommonResourse.XXLeft;
btnTitle.Gravity = Gravity.CenterVertical;
btnTitle.TextID = R.MyInternationalizationString.Category;
btnTitle.TextSize = 24;
@@ -108,7 +108,7 @@
topFrameLayout.AddChidren(btnTopRightAdd);
btnTopRightAdd.ButtonClickEvent += (sender, e) =>
{
- if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
+ if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
{
//娣诲姞鍦烘櫙
var form = new AddOrEditorSceneForm();
@@ -119,7 +119,7 @@
this.RefreshBodyView();
};
}
- else if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2)
+ else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2)
{
//娣诲姞鑷姩鍖�
Device.Logic.SkipView.SkipAddLogic(0);
@@ -201,23 +201,23 @@
var listTitle = new List<string>();
listTitle.Add(Language.StringByID(R.MyInternationalizationString.uScence));
listTitle.Add(Language.StringByID(R.MyInternationalizationString.uFunction));
- if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
+ if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
{
//鎴愬憳娌℃湁鑷姩鍖�
listTitle.Add(Language.StringByID(R.MyInternationalizationString.Automation));
}
//璁剧疆鍒濆鍊�
- switchContr.SetDefultIndex(HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex);
+ switchContr.SetDefultIndex(UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex);
//閫夋嫨浜嬩欢
switchContr.SelectTabEvent += (selectIndex) =>
{
- HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = selectIndex;
+ UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = selectIndex;
if (selectIndex == 2)
{
Common.Logic.LogicDviceList.Clear();
if (Common.Logic.LogicDviceList.Count == 0)
{
- Common.Logic.LogicDviceList.AddRange(HdlDeviceCommonLogic.Current.listAllDevice.ToArray());
+ Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray());
}
}
//鍒锋柊bodyView
@@ -238,7 +238,7 @@
{
bool floorVisible = true;
//鍦烘櫙
- if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
+ if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
{
//鍒濆鍖栨埧闂磋彍鍗�
this.InitRoomMenuControl();
@@ -246,7 +246,7 @@
this.btnTopRightAdd.Visible = true;
}
//鍔熻兘
- else if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 1)
+ else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 1)
{
//鍒濆鍖栨埧闂磋彍鍗�
this.InitRoomMenuControl();
@@ -254,7 +254,7 @@
this.btnTopRightAdd.Visible = false;
}
//鑷姩鍖�
- else if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2)
+ else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 2)
{
//鑷姩鍖栧姛鑳戒唬鐮佸叆鍙�
Device.Logic.SkipView.ShowAutotionView(functionSceneAutoBodyView);
@@ -300,7 +300,7 @@
{
HdlRoomLogic.Current.NowCategoryRoom = selectRoom;
//鍦烘櫙
- if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
+ if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 0)
{
//鍦ㄥ闈㈡竻绌�(鐗规晥鐨勯棶棰�)
this.functionSceneBodyView.RemoveAll();
@@ -311,7 +311,7 @@
});
}
//鍔熻兘
- else if (HdlUserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 1)
+ else if (UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex == 1)
{
//鍦ㄥ闈㈡竻绌�(鐗规晥鐨勯棶棰�)
this.functionSceneBodyView.RemoveAll();
@@ -355,14 +355,14 @@
//璁惧鑿滃崟鐨勭櫧鑹茶儗鏅�
var functionBack1 = new FrameLayout();
- functionBack1.X = HdlControlResourse.XXLeft;
+ functionBack1.X = ControlCommonResourse.XXLeft;
functionBack1.Height = Application.GetRealHeight(160);
functionBack1.Width = Application.GetRealWidth(1028);
functionBack1.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
functionSceneBodyView.AddChidren(functionBack1);
functionBack1.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft);
var functionBack2 = new FrameLayout();
- functionBack2.X = HdlControlResourse.XXLeft;
+ functionBack2.X = ControlCommonResourse.XXLeft;
functionBack2.Y = functionBack1.Bottom - Application.GetRealHeight(50);
functionBack2.Height = Application.GetRealHeight(279 - 160 + 50);
functionBack2.Width = Application.GetRealWidth(1028);
@@ -372,14 +372,14 @@
//璁惧鑿滃崟鐨勫乏鍙虫粦鍔ㄧ殑鎺т欢
var HorizontalView = new HorizontalScrolViewLayout();
- HorizontalView.X = HdlControlResourse.XXLeft;
+ HorizontalView.X = Application.GetRealWidth(CommonFormResouce.X_Left);
HorizontalView.Height = Application.GetRealHeight(279);
HorizontalView.Width = Application.GetRealWidth(1028);
functionSceneBodyView.AddChidren(HorizontalView);
//璁惧鐨勮儗鏅鍣�
var frameDeviceBack = new FrameLayout();
- frameDeviceBack.X = HdlControlResourse.XXLeft;
+ frameDeviceBack.X = ControlCommonResourse.XXLeft;
frameDeviceBack.Y = HorizontalView.Bottom + Application.GetRealHeight(35);
frameDeviceBack.BackgroundColor = UserCenterColor.Current.White;
frameDeviceBack.Width = bodyFrameLayout.Width;
@@ -464,12 +464,12 @@
var listDevice = new List<CommonDevice>();
for (int i = 0; i < rowInfo.listDeviceKeys.Count; i++)
{
- var device = HdlDeviceCommonLogic.Current.GetDevice(rowInfo.listDeviceKeys[i]);
+ var device = LocalDevice.Current.GetDevice(rowInfo.listDeviceKeys[i]);
//鑾峰彇璁惧绫诲瀷鐨�
- var deviceEnumInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
+ var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
//鏂伴闈㈡澘涓嬬殑鍥炶矾涓嶆樉绀猴紝锛堝鏂伴銆佹俯/婀垮害浼犳劅鍣ㄥ垯涓嶆樉绀猴級
- if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_FangyueFreshAir)
+ if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.ButtonPanel_FangyueFreshAir)
{
continue;
}
@@ -496,6 +496,11 @@
{
cardContr = new Controls.DeviceCurtainRowControl();
}
+ //鏅捐。鏋� Airer
+ if (device.Type == DeviceType.Airer)
+ {
+ cardContr = new Controls.DeviceAirerRowControl();
+ }
//缁х數鍣�
else if (device.Type == DeviceType.OnOffOutput)
{
@@ -521,6 +526,22 @@
{
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)
{
@@ -530,11 +551,6 @@
else if (device.Type == DeviceType.IASZone)
{
cardContr = new Controls.DeviceSensorRowControl();
- }
- //娓╂箍搴�
- else if (device.Type == DeviceType.TemperatureSensor)
- {
- cardContr = new Controls.DeviceTemperatureRowControl();
}
//闂ㄩ攣
else if (device.Type == DeviceType.DoorLock)
@@ -547,7 +563,7 @@
cardContr = new Controls.DeviceColorTemperatureRowControl();
}
//鏃犳硶璇嗗埆
- else
+ if (cardContr == null)
{
cardContr = new Controls.DeviceRowCommon();
//娌℃湁鐘舵�佸姛鑳�
@@ -558,13 +574,13 @@
listView.AddChidren(cardContr);
cardContr.InitControl(device, HdlRoomLogic.Current.NowCategoryRoom);
//鎺т欢璁板綍鍒扮紦瀛樹腑
- this.dicDeviceRowControl[HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device)] = cardContr;
+ this.dicDeviceRowControl[LocalDevice.Current.GetDeviceMainKeys(device)] = cardContr;
//鍔犵紦瀛�,鐒跺悗鍙戝懡浠�
listContr.Add(cardContr);
//鎺т欢琚Щ闄ょ殑鍥炶皟鍑芥暟
cardContr.RowNeedRemoveEvent += () =>
{
- string myKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(cardContr.device);
+ string myKeys = LocalDevice.Current.GetDeviceMainKeys(cardContr.device);
rowInfo.listDeviceKeys.Remove(myKeys);
this.dicDeviceRowControl.Remove(myKeys);
@@ -582,6 +598,7 @@
}
HdlThreadLogic.Current.RunThread(() =>
{
+ int sendCount = 0;
while (listView.Parent != null)
{
bool hadSend = false;
@@ -597,7 +614,7 @@
//鍙戦�佽幏鍙栫姸鎬佺殑鍛戒护
listContr[i].SendStatuComand();
hadSend = true;
- System.Threading.Thread.Sleep(200);
+ System.Threading.Thread.Sleep(300);
}
}
if (hadSend == false)
@@ -605,7 +622,13 @@
//濡傛灉宸茬粡鍏ㄩ儴鍥炶矾閮芥帴鏀朵簡缃戝叧鍥炲,鍒欎笉鍐嶄簩娆″彂閫�
break;
}
- System.Threading.Thread.Sleep(2000);
+ sendCount++;
+ if (sendCount == 2)
+ {
+ //灏卞彂2娆�
+ break;
+ }
+ System.Threading.Thread.Sleep(5000);
}
}, ShowErrorMode.NO);
@@ -626,7 +649,7 @@
VerticalListRefreshControl listview1 = null;
//鎴愬憳涓撶敤涓嶈兘鍒锋柊鐨勬帶浠�
VerticalListControl listview2 = null;
- if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 1 || HdlUserCenterResourse.ResidenceOption.AuthorityNo == 2)
+ if (UserCenterResourse.UserInfo.AuthorityNo == 1 || UserCenterResourse.UserInfo.AuthorityNo == 2)
{
//涓讳汉锛岀鐞嗗憳涓撶敤鍒锋柊鎺т欢
listview1 = new VerticalListRefreshControl();
@@ -835,11 +858,21 @@
HdlThreadLogic.Current.RunMain(() =>
{
//澶勭悊涓�鑸澶囩殑涓婃姤鏁版嵁
- string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(report);
+ 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)
{
//鍒锋柊鍗$墖淇℃伅
- var locadevice = HdlDeviceCommonLogic.Current.GetDevice(mainKeys);
+ var locadevice = LocalDevice.Current.GetDevice(mainKeys);
//宸茬粡鎺ユ敹鍒扮綉鍏崇殑鍙嶉 2020.05.09:鍒犻櫎Ack涓婚
this.dicDeviceRowControl[mainKeys].SetHadGetResponeResultStatu();
//鍒锋柊鎺т欢
@@ -862,11 +895,11 @@
{
HdlThreadLogic.Current.RunMain(() =>
{
- string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(report);
+ string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report);
if (this.dicDeviceRowControl.ContainsKey(mainKeys) == true)
{
//鍒锋柊鍗$墖鐘舵��
- bool bolOnline = HdlDeviceCommonLogic.Current.CheckDeviceIsOnline(report);
+ bool bolOnline = LocalDevice.Current.CheckDeviceIsOnline(report);
this.dicDeviceRowControl[mainKeys].SetRowOnlineStatu(bolOnline);
return;
}
@@ -890,7 +923,7 @@
HdlThreadLogic.Current.RunMain(() =>
{
//澶勭悊浼犳劅鍣ㄤ笂鎶ユ暟鎹�
- string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(report);
+ string mainKeys = LocalDevice.Current.GetDeviceMainKeys(report);
if (this.dicDeviceRowControl.ContainsKey(mainKeys) == true)
{
//寮�鍚闂儊鐗规晥
@@ -926,7 +959,7 @@
HdlThreadLogic.Current.RunMain(() =>
{
//璁惧鐘舵�佸繀椤诲埛鏂�
- string statuText = HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(contr.device);
+ string statuText = HdlDeviceOtherLogic.Current.GetDeviceStatu(contr.device);
contr.SetDeviceStatuText(statuText);
//浼犳劅鍣ㄥ垏鎹负鐏拌壊鐘舵��
contr.SwitchRowStatuAppeal(false);
@@ -956,7 +989,7 @@
foreach (var device in listDeviceTemp)
{
//鍒ゆ柇璇ヨ澶囪兘鍚︽樉绀哄湪鍒嗙被
- if (HdlDeviceCommonLogic.Current.CanShowInHomeHomeMainPage(device) == false)
+ if (LocalDevice.Current.CanShowInHomeHomeMainPage(device) == false)
{
continue;
}
@@ -964,11 +997,11 @@
}
//鏍规嵁璁惧鎵�灞炵被鍨嬫帓搴�
- listDevice = HdlDeviceCommonLogic.Current.SortDeviceByBelongType(listDevice);
+ listDevice = LocalDevice.Current.SortDeviceByBelongType(listDevice);
var dic = new Dictionary<string, DeviceRowInfo>();
foreach (var device in listDevice)
{
- var typeInfo = HdlDeviceCommonLogic.Current.GetDeviceBelongEnumInfo(device);
+ var typeInfo = LocalDevice.Current.GetDeviceBelongEnumInfo(device);
//鎸夋墍灞濱D鍒嗙粍
if (dic.ContainsKey(typeInfo.BeloneText) == false)
{
@@ -976,12 +1009,12 @@
string path1 = string.Empty;
string path2 = string.Empty;
//鑾峰彇鍥剧墖
- HdlDeviceCommonLogic.Current.GetDeviceFunctionTypeMenuIcon(typeInfo, ref path1, ref path2);
+ 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.BeloneText].listDeviceKeys.Add(HdlDeviceCommonLogic.Current.GetDeviceMainKeys(device));
+ dic[typeInfo.BeloneText].listDeviceKeys.Add(LocalDevice.Current.GetDeviceMainKeys(device));
}
return dic;
}
--
Gitblit v1.8.0