From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3
---
ZigbeeApp/Shared/Phone/Device/Logic/Method.cs | 192 +++++++++++++++++++++++++++++++++--------------
1 files changed, 134 insertions(+), 58 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
index 6fba6f9..34bcb47 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
@@ -21,7 +21,7 @@
/// <param name="device">Device.</param>
public static void RoomNmae(Button button, CommonDevice device)
{
- button.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameByDevice(device);
+ button.Text = HdlRoomLogic.Current.GetRoomNameByDevice(device);
}
/// <summary>
/// 杩斿洖妤煎眰鎵�鏈夌殑鎴块棿鐨勫垪琛�
@@ -32,7 +32,7 @@
public static List<Common.Room> GetRoomList(string type, string floorId = null)
{
var list = new List<Common.Room>();
- var listAllRoom = UserCenter.HdlRoomLogic.Current.GetAllListRooms();
+ var listAllRoom = HdlRoomLogic.Current.GetAllListRooms();
for (int i = 0; i < listAllRoom.Count; i++)
{
if (type == "action_logicscene" || type == "action_lockscene")
@@ -46,7 +46,7 @@
{
///鍖哄垎鍑鸿緭鍏ユ潯浠跺拰杈撳嚭鐩爣璁惧
var listdevicetype = GetDevice(type);
- var listdevice = GetDeviceUIList(listAllRoom[i], listdevicetype);
+ var listdevice = GetDeviceUIList(listAllRoom[i], listdevicetype, type);
if (listdevice.Count == 0)
{
///杩囨护鎺夋病鏈夎澶囩殑鎴块棿
@@ -68,13 +68,14 @@
/// </summary>
/// <param name="room">褰撳墠鎴块棿</param>
/// <param name="deviceTypelist">璁惧绫诲瀷</param>
+ /// /// <param name="type">閫昏緫绫诲瀷</param>
/// <returns></returns>
- public static List<CommonDevice> GetDeviceUIList(Common.Room room, List<DeviceType> deviceTypelist)
+ public static List<CommonDevice> GetDeviceUIList(Common.Room room, List<DeviceType> deviceTypelist,string type)
{
var deviceUIlist = new List<CommonDevice>();
foreach (var deviceKey in room.ListDevice)
{
- var device = LocalDevice.Current.GetDevice(deviceKey);
+ var device = HdlDeviceCommonLogic.Current.GetDevice(deviceKey);
if (device == null)
{
continue;
@@ -83,15 +84,31 @@
{
//杩囨护鎺変笉鏀寔鐨勮澶�
continue;
- }
- if (device.Type == DeviceType.DoorLock)
- {
- var myInfo = LocalDevice.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
- if (myInfo.ConcreteType == DeviceConcreteType.IntelligentLocks_Sone)
- {
- //鏆傛椂涓嶆敮鎸丼-one闂ㄩ攣;
- //杩囨护鎺変笉鏀寔S-one闂ㄩ攣璁惧;
- continue;
+ }
+ if (device.Type == DeviceType.DoorLock)
+ {
+ var myInfo = HdlDeviceCommonLogic.Current.GetMyDeviceEnumInfo(new List<CommonDevice>() { device });
+ if (myInfo.ConcreteType == DeviceConcreteType.IntelligentLocks_Sone)
+ {
+ //鏆傛椂涓嶆敮鎸丼-one闂ㄩ攣;
+ //杩囨护鎺変笉鏀寔S-one闂ㄩ攣璁惧;
+ continue;
+ }
+ }
+ if (type == "condition_mould")
+ {
+ if (device.Type == DeviceType.IASZone)
+ {
+ if (device.IasDeviceType != 13)
+ {//鑷姩鍖栨ā鏉垮彧鏀寔绾㈠浼犳劅鍣�
+ continue;
+ }
+ if (device.ModelIdentifier == "MSPIRB-ZB.10")
+ {
+ //鑷姩鍖栨ā鏉夸笉鏀寔鍏夌収搴�
+ continue;
+ }
+
}
}
deviceUIlist.Add(device);
@@ -261,8 +278,17 @@
{
break;
}
- patm = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png";
- selectedpatm = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png";
+
+ if (device.ModelIdentifier == "MSPIRB-ZB.10")
+ {
+ patm = $"ZigeeLogic/sensor541.png";
+ selectedpatm = $"ZigeeLogic/selectedsensor541.png";
+ }
+ else
+ {
+ patm = $"ZigeeLogic/sensor{iASZonedevice.IasDeviceType}.png";
+ selectedpatm = $"ZigeeLogic/selectedsensor{iASZonedevice.IasDeviceType}.png";
+ }
}
break;
case DeviceType.TemperatureSensor:
@@ -568,7 +594,9 @@
}; break;
case 5:
{
- string len = "", text = "";
+ string len = "";
+ string text = "";
+ string weekStr = Language.StringByID(MyInternationalizationString.week1);
List<int> listvalueInt = new List<int>();
listvalueInt.Clear();
var maxvalue = Convert.ToString(currentLogic.TimeAttribute.WeekDay, 2);
@@ -584,44 +612,36 @@
if (strvalue == "1")
{
listvalueInt.Add(j + 1);
-
-
- if ((j + 1) == 1)
- {
- text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.mon1) + ",";
- //text += Language.StringByID(MyInternationalizationString.mon) + ",";
+ switch ((j + 1)) {
+ case 1: {
+ text += weekStr + Language.StringByID(MyInternationalizationString.mon1) + ",";
+ }
+ break;
+ case 2: {
+ text += weekStr + Language.StringByID(MyInternationalizationString.tue1) + ",";
+ }
+ break;
+ case 3: {
+ text += weekStr + Language.StringByID(MyInternationalizationString.wed1) + ",";
+ }
+ break;
+ case 4: {
+ text += weekStr + Language.StringByID(MyInternationalizationString.thu1) + ",";
+ }
+ break;
+ case 5: {
+ text += weekStr + Language.StringByID(MyInternationalizationString.frl1) + ",";
+ }
+ break;
+ case 6: {
+ text += weekStr + Language.StringByID(MyInternationalizationString.sat1) + ",";
+ }
+ break;
+ case 7: {
+ text += weekStr + Language.StringByID(MyInternationalizationString.sun1) + ",";
+ }
+ break;
}
- else if ((j + 1) == 2)
- {
- text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.tue1) + ",";
- //text += Language.StringByID(MyInternationalizationString.tue) + ",";
- }
- else if ((j + 1) == 3)
- {
- text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.wed1) + ",";
- //text += Language.StringByID(MyInternationalizationString.wed) + ",";
- }
- else if ((j + 1) == 4)
- {
- text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.thu1) + ",";
- //text += Language.StringByID(MyInternationalizationString.thu) + ",";
- }
- else if ((j + 1) == 5)
- {
- text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.frl1) + ",";
- //text += Language.StringByID(MyInternationalizationString.frl) + ",";
- }
- else if ((j + 1) == 6)
- {
- text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sat1) + ",";
- //text += Language.StringByID(MyInternationalizationString.sat) + ",";
- }
- else if ((j + 1) == 7)
- {
- text += Language.StringByID(MyInternationalizationString.week1) + Language.StringByID(MyInternationalizationString.sun1) + ",";
- //text += Language.StringByID(MyInternationalizationString.sun) + ",";
- }
-
}
}
@@ -642,8 +662,7 @@
//{
// btndisplaycycle.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(',');
//}
- button.Text = Language.StringByID(MyInternationalizationString.week1) + text.Replace(Language.StringByID(MyInternationalizationString.week1), "").TrimEnd(',');
- //btndisplaycycle.Text = text.TrimEnd(',');
+ button.Text = weekStr + text.Replace(weekStr, "").TrimEnd(',');
}; break;
}
@@ -745,7 +764,7 @@
if (CurrentLogic.Conditions.Count == 0 || CurrentLogic.Actions.Count == 0)
{
- var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
+ var alert = new ShowMsgControl(ShowMsgType.Normal,
Language.StringByID(MyInternationalizationString.addnull),
Language.StringByID(MyInternationalizationString.confrim));
alert.Show();
@@ -754,7 +773,7 @@
if (string.IsNullOrEmpty(name))
{
- var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
+ var alert = new ShowMsgControl(ShowMsgType.Normal,
Language.StringByID(MyInternationalizationString.PleaseEnterLogicName),
Language.StringByID(MyInternationalizationString.confrim));
alert.Show();
@@ -875,6 +894,60 @@
UserView.HomePage.Instance.RemoveViewByTag("Logic");//绉婚櫎鎵�鏈夋爣璁癓ogic鐣岄潰
if (LogicView.IfString._Logic == if_logic)
{
+
+ //鏌ヨ-褰撳墠閫昏緫-鏄惁娣诲姞鍦扮悊浣嶇疆浣滀负鏉′欢
+ var exist = Common.Logic.CurrentLogic.Conditions.Find((obj) => obj["Type"] == "7");
+ if (exist==null)
+ {
+ bool if_type = false;
+ //鏌ヨ-閫昏緫鍒楄〃-鏄惁娣诲姞杩囧湴鐞嗕綅缃綔涓烘潯浠�
+ for (int a = 0; a < Common.Logic.LogicList.Count; a++)
+ {
+ var logic = Common.Logic.LogicList[a];
+ var exist_logic = logic.Conditions.Find((obj) => obj["Type"] == "7");
+ if (exist_logic != null)
+ {
+ //鏄惁瀛樺湪鍦扮悊浣嶇疆鏉′欢
+ if_type = true;
+ //閫�鍑篺or寰幆
+ break;
+ }
+ }
+ if (if_type)
+ {
+ //鏌ヨ涔嬪墠鐘舵�佹槸鍚﹀凡缁忓紑鍚疓PS鏈嶅姟(浠ユ湰鍦板瓨鍌ㄧ姸鎬佷负涓� 0:娌″紑鍚�; 1锛氬紑鍚�)
+ if (Send.If_Exist == "0")
+ {
+ //寮�鍚疓PS鏈嶅姟
+ Application.StartGPSLocationService();
+ //淇濆瓨GPS鏈嶅姟寮�鍚姸鎬�
+ Send.SaveLocalFile(Config.Instance.HomeId + "_GPS_File", "1");
+ }
+
+ }
+ else
+ {
+ //濡傛灉鎵句笉鍒板湴鐞嗕綅缃綔涓烘潯浠剁殑璇�,鍏抽棴GPS鏈嶅姟(鍑忓皯鑰楃數)
+ if (Send.If_Exist == "1")
+ {
+ //鍏抽棴GPS鏈嶅姟
+ Application.StopGPSLocationService();
+ //淇濆瓨GPS鏈嶅姟鍏抽棴鐘舵��
+ Send.SaveLocalFile(Config.Instance.HomeId + "_GPS_File", "0");
+ }
+ }
+ }
+ else
+ {
+ //鏌ヨ涔嬪墠鐘舵�佹槸鍚﹀凡缁忓紑鍚疓PS鏈嶅姟(浠ユ湰鍦板瓨鍌ㄧ姸鎬佷负涓� 0:娌″紑鍚�; 1锛氬紑鍚�)
+ if (Send.If_Exist == "0")
+ {
+ //寮�鍚疓PS鏈嶅姟
+ Application.StartGPSLocationService();
+ //淇濆瓨GPS鏈嶅姟寮�鍚姸鎬�
+ Send.SaveLocalFile(Config.Instance.HomeId + "_GPS_File", "1");
+ }
+ }
//鍙埛鏂板垎绫�-鑷姩鍖栦笂涓嬫粦鍔╲iew锛�
Phone.Category.CategoryMainForm.instance?.RefreshBodyView();
// Category.Category.instance?.RefreshBodyView();
@@ -918,5 +991,8 @@
/// 鐣岄潰楂樺害
/// </summary>
public static int H = 1922;
+
+
+
}
}
--
Gitblit v1.8.0