| | |
| | | Common.Logic.CurrentLogic.LogicIsCustomPushText = 0; |
| | | pushview.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; |
| | | } |
| | | if (!Config.Instance.Home.IsVirtually) |
| | | { |
| | | Send.Zj(LogicView.IfString.Tag, Common.Logic.CurrentLogic); |
| | | |
| | | } |
| | | }; |
| | | |
| | | if (Common.Logic.CurrentLogic.LogicIsCustomPushText == 0) |
| | |
| | | bool succeed = false; |
| | | //判断是新添加逻辑(默认0)还是修改逻辑 |
| | | CommonPage.Loading.Start(); |
| | | |
| | | if (Config.Instance.Home.IsVirtually) |
| | | { |
| | | if (Common.Logic.LogicList.Count == 0) |
| | | { |
| | | CurrentLogic.LogicId = 1; |
| | | Common.Logic.LogicList.Add(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 |
| | | { |
| | | if (CurrentLogic.LogicId == 0) |
| | | { |
| | | //发送添加逻辑命令 |
| | |
| | | //编辑默认成功(不考虑网络情况); |
| | | succeed = true; |
| | | } |
| | | } |
| | | CommonPage.Loading.Hide(); |
| | | |
| | | if (!succeed)//succeed标记是添加成功还是失败 |