陈嘉乐
2020-09-02 652243206427f35a256400a149a1734085824cb9
ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
old mode 100644 new mode 100755
@@ -17,6 +17,8 @@
        }
        /// 给徐梅刷新界面用的
        public Action<bool> action;
        // 刷新上报界面的Action
        public Action<string, bool> updateCurrentDoorlockActionTemp;
        ///第二块第一级父控件
        FrameLayout fLayout = new FrameLayout();
        ///第三块第一级父控件
@@ -45,7 +47,7 @@
            view.toptitleNameBtn.TextID = MyInternationalizationString.openmode;
            view.clickBtn.MouseDownEventHandler += (sender, e) =>
            {
                UserView.HomePage.Instance.ScrollEnabled = true;
                UserView.HomePage.Instance.ScrollEnabled = true;
                //把静态变量的这个东西置空
                soneLogicList = null;
                this.RemoveFromParent();
@@ -74,7 +76,7 @@
                    try
                    {
                        //进来更新一次值
                        logicId = logic.LogicId;
                        logicId = logic.LogicId;
                        timeValue = int.Parse(logic.Conditions[0]["DoorLockOpenDelayTime"]) / 3600;
                        timeLong = int.Parse(logic.Conditions[0]["TriggerTime"]);
                    }
@@ -167,10 +169,10 @@
                actionsInfo.Add("LinkType", 8);
                actionsInfo.Add("DeviceAddr", Send.CurrentDoorLock.DeviceAddr);
                actionsInfo.Add("Epoint", "200");
                actionsInfo.Add("PassData", "055704010113");//默认门锁常关
                Dictionary<string, string> accounts = new Dictionary<string, string>();
                actionsInfo.Add("PassData", "055704010113");//默认门锁常关
                Dictionary<string, string> accounts = new Dictionary<string, string>();
                accounts.Add("Type", "8");
                accounts.Add("Option4", Send.CurrentDoorLock.DeviceAddr.ToString());//用于判断识别是哪个门锁;
                accounts.Add("Option4", Send.CurrentDoorLock.DeviceAddr.ToString());//用于判断识别是哪个门锁;
                accounts.Add("Option2", Send.CurrentDoorLock.DeviceEpoint.ToString());
                //new一个新逻辑对象;
                //新增门锁常开模式自动化入口;
@@ -179,7 +181,7 @@
                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);
@@ -221,28 +223,29 @@
                catch { }
            };
            //UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction += (DoorlockKey, _bool) =>
            //{
            //    Logic.SkipView.DelAllLogic(DoorlockKey);
            //    var key = Send.CurrentDoorLock.DeviceAddr + Send.CurrentDoorLock.DeviceEpoint;
            //    if (DoorlockKey == key)
            //    {
            //        try
            //        {
            //            Application.RunOnMainThread(() =>
            //            {
            //                Send.CurrentDoorLock.IsDoorLockNormallyMode = _bool;
            //                ModeView();
            //            });
            //        }
            //        catch { }
            //    }
            //};
            updateCurrentDoorlockActionTemp = (DoorlockKey, _bool) =>
            {
                var key = Send.CurrentDoorLock.DeviceAddr;
                if (DoorlockKey == key)
                {
                    try
                    {
                        Application.RunOnMainThread(() =>
                        {
                            Send.CurrentDoorLock.IsDoorLockNormallyMode = _bool;
                            ModeView();
                        });
                    }
                    catch { }
                }
            };
            UserCenter.DoorLock.DoorLockCommonInfo.UpdateCurrentDoorlockAction += updateCurrentDoorlockActionTemp;
        }
      /// <summary>
      /// 常开模式开关切换图标界面
      /// </summary>
      public void ModeView()
        /// <summary>
        /// 常开模式开关切换图标界面
        /// </summary>
        public void ModeView()
        {
            fLayout.RemoveAll();
@@ -283,7 +286,6 @@
                openModeFl.AddChidren(closeBtn);
                closeBtn.MouseUpEventHandler += async (sender, e) =>
                {
                    CommonPage.Loading.Start();
                    try
                    {
@@ -314,7 +316,8 @@
                        });
                    }
                };
                if (logicId != 0)
                {
                    ///显示失效设置时间文本控件
@@ -347,17 +350,16 @@
                        var datetime = GetLocalTime(timeLong);
                        ///有时效性常开才显示时间条件文本
                        year = datetime.Year.ToString();//那一年
                        month = datetime.Month.ToString();//那一月
                        days = int.Parse(datetime.ToString("dd"));//那一天
                        month = datetime.Month.ToString();//那一月
                        days = int.Parse(datetime.ToString("dd"));//那一天
                        hour = int.Parse(datetime.ToString("HH"));//小时
                        minute = datetime.Minute;//分钟
                        timeLong = 0;
                    }
                    else
                    {
                        ///读取系统时间                         year = DateTime.Now.Year.ToString();//那一年
                        ///读取系统时间
                        year = DateTime.Now.Year.ToString();//那一年
                        month = DateTime.Now.Month.ToString();//那一月
                        var d = DateTime.Now.ToString("dd");//那一天
                        var h = int.Parse(DateTime.Now.ToString("HH"));//小时
@@ -422,12 +424,11 @@
                modeFl.AddChidren(clickBtn);
                clickBtn.MouseUpEventHandler += (sender, e) =>
                {
                    LogicView.TipView.ShowConfrimTip(() =>
                    {///再次确认
                        LogicView.TipView.ShowInputTip(true, async (str) =>
                        {///确认发送命令
                            CommonPage.Loading.Start();
                            try
@@ -457,8 +458,8 @@
                                        logicId = addResult;
                                        timeValue = int.Parse(str);
                                        Send.CurrentDoorLock.IsDoorLockNormallyMode = true;
                                        ModeView();
                                        ///添加APP开启常开模式的历史记录
                                        ModeView();
                                        ///添加APP开启常开模式的历史记录
                                        UserCenter.HdlDeviceDoorLockLogic.Current.AddDoorHistoryLog(Send.CurrentDoorLock, 9001, string.Empty);
                                    }
@@ -518,10 +519,10 @@
                            if (logic.LogicType != 2)
                            {
                                continue;
                            }
                            if (SkipView.ExistLogic(logic, Send.CurrentDoorLock))
                            {
                                Common.Logic.SoneLogicList.Add(logic);
                            }
                            if (SkipView.ExistLogic(logic, Send.CurrentDoorLock))
                            {
                                Common.Logic.SoneLogicList.Add(logic);
                            }
                        }
                    }