HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-05-15 3f87bf0ae7394cdd7d52428f1f6b4361434c7cc4
ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
@@ -64,7 +64,7 @@
            {
                //进来更新一次
                //查找是否存在时效性自动化;有的话就返回自动化对象;
                var logic = await SkipView.GetLogicIfon();
              var  logic = await SkipView.GetLogicIfon(Send.CurrentDoorLock);
                if (logic != null)
                {
                    try
@@ -162,7 +162,10 @@
                actionsInfo.Add("LinkType", 8);
                actionsInfo.Add("DeviceAddr", Send.CurrentDoorLock.DeviceAddr);
                actionsInfo.Add("Epoint", "200");
                actionsInfo.Add("PassData", "055704010113");//默认门锁常关
                actionsInfo.Add("PassData", "055704010113");//默认门锁常关
                Dictionary<string, string> accounts = new Dictionary<string, string>();
                accounts.Add("Option4", Send.CurrentDoorLock.DeviceAddr.ToString());//用于判断识别是哪个门锁;
                accounts.Add("Option2", Send.CurrentDoorLock.DeviceEpoint.ToString());
                //new一个新逻辑对象;
                //新增门锁常开模式自动化入口;
                Common.Logic.CurrentLogic = new Common.Logic();
@@ -170,7 +173,8 @@
                Common.Logic.CurrentLogic.LogicType = 2;//标记逻辑类型
                Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.openmode);
                Common.Logic.CurrentLogic.Conditions.Add(timeConditionsInfo);//添加条件
                Common.Logic.CurrentLogic.Actions.Add(actionsInfo);//添加目标
                Common.Logic.CurrentLogic.Actions.Add(actionsInfo);//添加目标
                Common.Logic.CurrentLogic.Accounts.Add(accounts);
                var oneLogic = new OneLogic();
                UserView.HomePage.Instance.AddChidren(oneLogic);
                UserView.HomePage.Instance.PageIndex += 1;
@@ -264,6 +268,7 @@
                        {
                            if (logicId != 0)
                            {
                                ///有可能只有常开模式,没有时效性自动化
                                Send.DelLogic(logicId);
                            }
@@ -387,43 +392,47 @@
                                 else
                                 {
                                    ///因为有常开模式下才可以创建失效逻辑;
                                    SkipView.GetLogicAll();//删除之前所有失效逻辑
                                    SkipView.GetLogicAll(Send.CurrentDoorLock);//删除之前所有失效逻辑
                                    var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//添加一条失效逻辑
                                    if (addResult == 0)
                                    {
                                     {
                                        ///可欣说如果常开模式开,创建自动化失败,那么将要发一条常开模式关闭命令;
                                        UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock);
                                        ///提示失败
                                        LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.addFailed));
                                        return;
                                    }
                                    logicId = addResult;
                                    timeValue = int.Parse(str);
                                    Send.CurrentDoorLock.IsDoorLockNormallyMode = true;
                                    ModeView();
                                    //添加App开启常开模式的历史记录
                                    UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock, 9001, string.Empty);
                                }
                            }
                            catch
                            {
                                         return;
                                     }
                                     else
                                     {
                                         logicId = addResult;
                                         timeValue = int.Parse(str);
                                         Send.CurrentDoorLock.IsDoorLockNormallyMode = true;
                                         ModeView();
                                         ///添加APP开启常开模式的历史记录
                                         UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock,9001,string.Empty);
                                     }
                            }
                            finally
                            {
                                Application.RunOnMainThread(() =>
                                {
                                    CommonPage.Loading.Hide();
                                });
                            }
                        });
                                 }
                             }
                             catch
                             {
                    });
                             }
                             finally
                             {
                                 Application.RunOnMainThread(() =>
                                 {
                                     CommonPage.Loading.Hide();
                };
                                 });
                             }
                         });
                     });
                 };
            }
            listLogicFl.Y = fLayout.Bottom;
            listLogicFl.X = Application.GetRealWidth(58);
            listLogicFl.Height = Application.GetRealHeight(Method.H - 184) - fLayout.Height;
@@ -454,8 +463,11 @@
                            if (logic.LogicType != 2)
                            {
                                continue;
                            }
                            if (SkipView.ExistLogic(logic,Send.CurrentDoorLock))
                            {
                                Common.Logic.SoneLogicList.Add(logic);
                            }
                            Common.Logic.SoneLogicList.Add(logic);
                        }
                    }
                }