From e03ec0580564467bcbd40b6fff2b87a953d383d1 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 28 五月 2020 17:39:49 +0800
Subject: [PATCH] 2020-05-28-2
---
ZigbeeApp/Shared/Phone/Device/Logic/Method.cs | 168 +++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 129 insertions(+), 39 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
old mode 100644
new mode 100755
index 354f6bd..6178384
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Method.cs
@@ -83,6 +83,16 @@
{
//杩囨护鎺変笉鏀寔鐨勮澶�
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;
+ }
}
deviceUIlist.Add(device);
}
@@ -341,7 +351,7 @@
deviceTypeList.Add(DeviceType.Thermostat);
deviceTypeList.Add(DeviceType.AirSwitch);
///闂ㄩ攣鐗规畩
- deviceTypeList.Add(DeviceType.DoorLock);
+ // deviceTypeList.Add(DeviceType.DoorLock);
}
break;
case "condition_mould":
@@ -363,7 +373,7 @@
deviceTypeList.Add(DeviceType.Thermostat);
deviceTypeList.Add(DeviceType.AirSwitch);
///闂ㄩ攣鐗规畩
- deviceTypeList.Add(DeviceType.DoorLock);
+ // deviceTypeList.Add(DeviceType.DoorLock);
}
break;
@@ -692,7 +702,11 @@
Common.Logic.CurrentLogic.LogicIsCustomPushText = 0;
pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
}
- Send.Zj(LogicView.IfString.Tag, Common.Logic.CurrentLogic);
+ if (!Config.Instance.Home.IsVirtually)
+ {
+ Send.Zj(LogicView.IfString.Tag, Common.Logic.CurrentLogic);
+
+ }
};
if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0)
@@ -719,9 +733,16 @@
/// <param name="CurrentLogic">褰撳墠閫昏緫</param>
public async static void SaveLogic(string if_logic, string name, bool tag, Common.Logic CurrentLogic)
{
- //璁板綍閫昏緫绫诲瀷
- //鍙槸瀵硅烦杞晫闈㈡湁鐢紝鍩烘湰娌″暐鐢�
- int Type = CurrentLogic.LogicType;
+
+ if (CurrentLogic.Conditions.Count == 0 || CurrentLogic.Actions.Count == 0)
+ {
+ var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
+ Language.StringByID(MyInternationalizationString.addnull),
+ Language.StringByID(MyInternationalizationString.confrim));
+ alert.Show();
+ return;
+ }
+
if (string.IsNullOrEmpty(name))
{
var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
@@ -742,28 +763,94 @@
bool succeed = false;
//鍒ゆ柇鏄柊娣诲姞閫昏緫(榛樿0)杩樻槸淇敼閫昏緫
CommonPage.Loading.Start();
- if (CurrentLogic.LogicId == 0)
+
+ if (Config.Instance.Home.IsVirtually)
{
- //鍙戦�佹坊鍔犻�昏緫鍛戒护
- var logicifon = await Send.AddModifyLogic(CurrentLogic);
- if (logicifon != null && logicifon.LogicId != 0)
+ if (Common.Logic.LogicList.Count == 0)
{
- succeed = true;
- CurrentLogic.LogicId = logicifon.LogicId;
+ CurrentLogic.LogicId = 1;
Common.Logic.LogicList.Add(CurrentLogic);
- if (tag)
- {
- Send.Zj(tag, CurrentLogic);
- }
}
+
+ if (CurrentLogic.LogicId == 0)
+ {
+ bool d = false;
+ for (int i = 1; i < 50; i++)
+ {
+
+ for (int j = 0; j < Common.Logic.LogicList.Count; j++)
+ {
+ if (i != Common.Logic.LogicList[j].LogicId)
+ {
+ CurrentLogic.LogicId = i;
+ Common.Logic.LogicList.Add(CurrentLogic);
+ d = true;
+ break;
+ }
+ }
+ if (d)
+ {
+ break;
+ }
+ }
+
+ }
+ else
+ {
+ for (int j = 0; j < Common.Logic.LogicList.Count; j++)
+ {
+ if (CurrentLogic.LogicId == Common.Logic.LogicList[j].LogicId)
+ {
+ Common.Logic.LogicList.RemoveAt(j);
+ Common.Logic.LogicList.Insert(j,CurrentLogic);
+ break;
+ }
+ }
+
+ }
+
+ //鑷姩鍖栭�昏緫鍒楄〃
}
else
{
- //鍙戦�佷慨鏀归�昏緫鍛戒护锛�
- //淇敼鍛戒护涓嶉渶瑕佺瓑寰呭洖澶嶏紱
- Send.AddModifyLogic(CurrentLogic);
- //缂栬緫榛樿鎴愬姛锛堜笉鑰冭檻缃戠粶鎯呭喌锛夛紱
- succeed = true;
+ if (CurrentLogic.LogicId == 0)
+ {
+ //鍙戦�佹坊鍔犻�昏緫鍛戒护
+ var logicifon = await Send.AddModifyLogic(CurrentLogic);
+ if (logicifon != null && logicifon.LogicId != 0)
+ {
+ succeed = true;
+ CurrentLogic.LogicId = logicifon.LogicId;
+ if (LogicView.IfString._Logic == if_logic || LogicView.IfString._SoneLogic == if_logic)
+ {
+ //鑷姩鍖栭�昏緫鍒楄〃
+ Common.Logic.LogicList.Add(CurrentLogic);
+ }
+ if (LogicView.IfString._LockLogic == if_logic)
+ {
+ //闂ㄩ攣鑱斿姩浜嬩欢閫昏緫鍒楄〃
+ Common.Logic.LockLogicList.Add(CurrentLogic);
+ }
+ if (LogicView.IfString._SoneLogic == if_logic)
+ {
+ //Sone闂ㄩ攣甯稿紑妯″紡閫昏緫鍒楄〃
+ Common.Logic.SoneLogicList.Add(CurrentLogic);
+
+ }
+ if (tag)
+ {
+ Send.Zj(tag, CurrentLogic);
+ }
+ }
+ }
+ else
+ {
+ //鍙戦�佷慨鏀归�昏緫鍛戒护锛�
+ //淇敼鍛戒护涓嶉渶瑕佺瓑寰呭洖澶嶏紱
+ Send.AddModifyLogic(CurrentLogic);
+ //缂栬緫榛樿鎴愬姛锛堜笉鑰冭檻缃戠粶鎯呭喌锛夛紱
+ succeed = true;
+ }
}
CommonPage.Loading.Hide();
@@ -775,33 +862,33 @@
//TipView("娣诲姞鑷姩鍖栧け璐�");
//return;
}
-
+ UserView.HomePage.Instance.RemoveViewByTag("Logic");//绉婚櫎鎵�鏈夋爣璁癓ogic鐣岄潰
if (LogicView.IfString._Logic == if_logic)
{
- if (Type == 0)
- {
-
- UserView.HomePage.Instance.RemoveViewByTag("Logic");
- //鍙埛鏂板垎绫讳笂涓嬫粦鍔╲iew锛�
- Phone.Category.CategoryMainForm.instance?.RefreshBodyView();
- // Category.Category.instance?.RefreshBodyView();
- }
- else if (Type == 2)
- {
- //鍒锋柊鏁翠釜鍒嗙被锛�
- //闂ㄩ攣甯稿紑妯″紡鐗规畩;
- UserView.UserPage.Instance.ShowCategoryAutoListForm();
-
- }
+ //鍙埛鏂板垎绫�-鑷姩鍖栦笂涓嬫粦鍔╲iew锛�
+ Phone.Category.CategoryMainForm.instance?.RefreshBodyView();
+ // Category.Category.instance?.RefreshBodyView();
}
else if (LogicView.IfString._LockLogic == if_logic)
{
- UserView.HomePage.Instance.RemoveViewByTag("Logic");
+ //璺冲埌闂ㄩ攣鑱斿姩浜嬩欢鍒楄〃鐣岄潰
+ UserView.HomePage.Instance.RemoveViewByTag("LockListView");//绉婚櫎鎵�鏈夋爣璁癓ockListView鐣岄潰
var doorLockLogicList = new DoorLockLogic.LockLogicList();
UserView.HomePage.Instance.AddChidren(doorLockLogicList);
UserView.HomePage.Instance.PageIndex += 1;
doorLockLogicList.Show();
+ }
+ else if (LogicView.IfString._SoneLogic == if_logic)
+ {
+ //璺冲埌Sone闂ㄩ攣鑱斿姩浜嬩欢鍒楄〃鐣岄潰
+ //UserView.HomePage.Instance.RemoveViewByTag("SoneLogic");//绉婚櫎鎵�鏈夋爣璁癓ockListView鐣岄潰
+ //var soneLogicList = new SoneLogicList();
+ //UserView.HomePage.Instance.AddChidren(soneLogicList);
+ //UserView.HomePage.Instance.PageIndex += 1;
+ //soneLogicList.Show();
+
+ SoneLogicList.soneLogicList?.RefreshView();
}
}
@@ -818,6 +905,9 @@
deviceTarget.Show(str1, str2);
}
-
+ /// <summary>
+ /// 鐣岄潰楂樺害
+ /// </summary>
+ public static int H = 1922;
}
}
--
Gitblit v1.8.0