| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Shared; |
| | | namespace Shared.Phone.Device.Logic |
| | | { |
| | | public class LogicIfon |
| | | { |
| | | #region ----逻辑条件输入---- |
| | | #region ----逻辑条件输入---- |
| | | /// <summary> |
| | | /// 添加设备条件的方法 |
| | | /// </summary> |
| | |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "2") |
| | | { |
| | | |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["Condition_LogicId"] ==logic.LogicId.ToString()) |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["Condition_LogicId"] == logic.LogicId.ToString()) |
| | | { |
| | | Common.Logic.CurrentLogic.Conditions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Conditions.Insert(i, objecttype); |
| | |
| | | { |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Conditions.Count; i++) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == "7") |
| | | if (Common.Logic.CurrentLogic.Conditions[i]["Type"] == objecttype["Type"]) |
| | | { |
| | | |
| | | Common.Logic.CurrentLogic.Conditions.RemoveAt(i); |
| | |
| | | { |
| | | if (Common.Logic.CurrentLogic.Actions[i]["LinkType"].ToString() == "0") |
| | | { |
| | | if (Common.Logic.CurrentLogic.Actions[i]["DeviceAddr"].ToString() ==common.DeviceAddr&& Common.Logic.CurrentLogic.Actions[i]["Epoint"].ToString() ==common.DeviceEpoint.ToString()) |
| | | if (Common.Logic.CurrentLogic.Actions[i]["DeviceAddr"].ToString() == common.DeviceAddr && Common.Logic.CurrentLogic.Actions[i]["Epoint"].ToString() == common.DeviceEpoint.ToString()) |
| | | { |
| | | Common.Logic.CurrentLogic.Actions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Actions.Insert(i, actionsInfo); |
| | |
| | | /// </summary> |
| | | /// <param name="Scene">Common.</param> |
| | | /// <param name="actionsInfo">Objecttype.</param> |
| | | public static void AddSceneactions(Shared.Common.SceneUI Scene,Dictionary<string, object> actionsInfo) |
| | | public static void AddSceneactions(Shared.Common.SceneUI Scene, Dictionary<string, object> actionsInfo) |
| | | { |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Actions.Count; i++) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Actions[i]["LinkType"].ToString() == "2") |
| | | { |
| | | if (Common.Logic.CurrentLogic.Actions[i]["DeviceAddr"].ToString() ==Scene.Id.ToString()) |
| | | if (Common.Logic.CurrentLogic.Actions[i]["DeviceAddr"].ToString() == Scene.Id.ToString()) |
| | | { |
| | | Common.Logic.CurrentLogic.Actions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Actions.Insert(i, actionsInfo); |
| | |
| | | /// </summary> |
| | | /// <param name="objecttype">Objecttype.</param> |
| | | /// <param name="o">O.</param> |
| | | public static void AddLogicactions(Common.Logic logic,Dictionary<string, object> actionsInfo) |
| | | public static void AddLogicactions(Common.Logic logic, Dictionary<string, object> actionsInfo) |
| | | { |
| | | |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Actions.Count; i++) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Actions[i]["LinkType"].ToString() == "4") |
| | | { |
| | | if (Common.Logic.CurrentLogic.Actions[i]["DeviceAddr"].ToString() ==logic.LogicId.ToString()) |
| | | if (Common.Logic.CurrentLogic.Actions[i]["DeviceAddr"].ToString() == logic.LogicId.ToString()) |
| | | { |
| | | Common.Logic.CurrentLogic.Actions.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Actions.Insert(i, actionsInfo); |
| | |
| | | |
| | | } |
| | | #endregion |
| | | #region ----关联app账号---- |
| | | /// <summary> |
| | | /// 关联app账号 |
| | | /// </summary> |
| | | /// <param name="accountsInfo"></param> |
| | | public static void Addaccounts(Dictionary<string, string> accountsInfo) |
| | | { |
| | | for (int i = 0; i < Common.Logic.CurrentLogic.Accounts.Count; i++) |
| | | { |
| | | if (Common.Logic.CurrentLogic.Accounts[i]["Type"] == accountsInfo["Type"]) |
| | | { |
| | | Common.Logic.CurrentLogic.Accounts.RemoveAt(i); |
| | | Common.Logic.CurrentLogic.Accounts.Insert(i, accountsInfo); |
| | | return; |
| | | } |
| | | } |
| | | Common.Logic.CurrentLogic.Accounts.Add(accountsInfo); |
| | | } |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | |
| | | } |