陈嘉乐
2020-05-15 d5b9ff8bf8cc36f5b13c46b66682f5988d3a6f36
ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
@@ -163,6 +163,9 @@
                actionsInfo.Add("DeviceAddr", Send.CurrentDoorLock.DeviceAddr);
                actionsInfo.Add("Epoint", "200");
                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();
@@ -171,6 +174,7 @@
                Common.Logic.CurrentLogic.LogicName = Language.StringByID(MyInternationalizationString.openmode);
                Common.Logic.CurrentLogic.Conditions.Add(timeConditionsInfo);//添加条件
                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;
@@ -371,59 +375,58 @@
                 {
                     LogicView.TipView.ShowConfrimTip(() =>
                     {///再次确认
                        LogicView.TipView.ShowInputTip(true, async (str) =>
                         {///确认发送命令
                            CommonPage.Loading.Start();
                             try
                             {
                                ///xm
                                var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock);
                                 if (!result)
                                 {
                                     LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.openFailed));
                                     return;
                                 }
                                 else
                                 {
                                    ///因为有常开模式下才可以创建失效逻辑;
                                    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;
                                     }
                                     else
                                     {
                                         logicId = addResult;
                                         timeValue = int.Parse(str);
                                         Send.CurrentDoorLock.IsDoorLockNormallyMode = true;
                                         ModeView();
                                         ///添加APP开启常开模式的历史记录
                                         UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock,9001,string.Empty);
                                     }
                         LogicView.TipView.ShowInputTip(true, async (str) =>
                          {///确认发送命令
                              CommonPage.Loading.Start();
                              try
                              {
                                  ///xm
                                  var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock);
                                  if (!result)
                                  {
                                      LogicView.TipView.ShowFlashTip(Language.StringByID(MyInternationalizationString.openFailed));
                                      return;
                                  }
                                  else
                                  {
                                      ///因为有常开模式下才可以创建失效逻辑;
                                      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;
                                      }
                                      else
                                      {
                                          logicId = addResult;
                                          timeValue = int.Parse(str);
                                          Send.CurrentDoorLock.IsDoorLockNormallyMode = true;
                                          ModeView();
                                          ///添加APP开启常开模式的历史记录
                                          UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock, 9001, string.Empty);
                                      }
                                 }
                             }
                             catch
                             {
                                  }
                              }
                              catch
                              {
                             }
                             finally
                             {
                                 Application.RunOnMainThread(() =>
                                 {
                                     CommonPage.Loading.Hide();
                              }
                              finally
                              {
                                  Application.RunOnMainThread(() =>
                                  {
                                      CommonPage.Loading.Hide();
                                 });
                             }
                         });
                                  });
                              }
                          });
                     });
@@ -460,7 +463,10 @@
                            {
                                continue;
                            }
                            Common.Logic.SoneLogicList.Add(logic);
                            if (SkipView.ExistLogic(logic, Send.CurrentDoorLock))
                            {
                                Common.Logic.SoneLogicList.Add(logic);
                            }
                        }
                    }
                }