陈嘉乐
2020-04-30 ee888ab45a850245b1e1372375ba9040316086ab
ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
@@ -11,12 +11,28 @@
        /// <summary>
        /// 给Sone门锁徐梅更新界面用的
        /// </summary>
        ///
        public SoneLogicList()
        {
            Tag = "SoneLogic";
        }
        public async void Show(Action action = null, bool bool_If = false)
        /// <summary>
        ///
        /// </summary>
        /// <param name="action">给徐梅刷新界面用的</param>
        /// <param name="bool_If"></param>
        public async void Show(Action action, bool bool_If = false)
        {
            #region  徐梅叫这样做的
            string key = Send.CurrentDoorLock.DeviceAddr + "_" + Send.CurrentDoorLock.DeviceEpoint;
            if (Send.CurrentDoorLock.IsDoorLockNormallyMode.ContainsKey(key))
            {
                if (Send.CurrentDoorLock.IsDoorLockNormallyMode[key] == true)
                {
                    bool_If = true;
                }
            }
            #endregion
            #region  界面的布局代码
            UserView.HomePage.Instance.ScrollEnabled = false;//锁住左滑
            TopView view = new TopView();
@@ -102,23 +118,37 @@
                    alert.ConfirmClickEvent += async () =>
                    {
                        var bool_ = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(new ZigBee.Device.DoorLock { });
                        if (bool_)
                        {
                     Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock, action);
                        }
                        else { }
                        if (logic != null)
                        {
                            ///有可能只有常开模式,没有时效性自动化
                            ///没有判断的话,逻辑会为空,抛出异常;
                            Send.DelLogic(logic.LogicId);
                        }
                        this.RemoveFromParent();
                        var soneLogicList = new SoneLogicList();
                        UserView.HomePage.Instance.AddChidren(soneLogicList);
                        UserView.HomePage.Instance.PageIndex += 1;
                        soneLogicList.Show();
                     Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.LogicAction += (d) => {
                            this.RemoveFromParent();
                            var soneLogicList = new SoneLogicList();
                            UserView.HomePage.Instance.AddChidren(soneLogicList);
                            UserView.HomePage.Instance.PageIndex += 1;
                            soneLogicList.Show(() => { }, false);
                        };
                        /////xm
                        //var result = await SkipView.OpenMode(false, Send.CurrentDoorLock);
                        //if (result)
                        //{
                        //    if (logic != null)
                        //    {
                        //        ///有可能只有常开模式,没有时效性自动化
                        //        ///没有判断的话,逻辑会为空,抛出异常;
                        //        Send.DelLogic(logic.LogicId);
                        //    }
                        //    this.RemoveFromParent();
                        //    var soneLogicList = new SoneLogicList();
                        //    UserView.HomePage.Instance.AddChidren(soneLogicList);
                        //    UserView.HomePage.Instance.PageIndex += 1;
                        //    soneLogicList.Show(()=>{ },false);
                        //}
                        //else {
                        //    ///提示失败
                        //}
                    };
                };
@@ -196,54 +226,66 @@
                };
                modeFl.AddChidren(nextIconBtn);
                var clickBtn = new Button
                {
                    Y = Application.GetRealHeight(478),
                    X = Application.GetRealWidth(58),
                    Height = Application.GetRealHeight(138),
                    Width = Application.GetRealWidth(1022),
                };
                // modeFl.AddChidren(clickBtn);
                nextIconBtn.MouseUpEventHandler += (sender, e) =>
              nextIconBtn.MouseUpEventHandler += (sender, e) =>
               {
                   Logic.LogicView.TipView tipView = new LogicView.TipView();
                   FrameLayout fLayout1 = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
                   this.AddChidren(fLayout1);
                   tipView.ShowTip(fLayout1);
                   //string msg = Language.StringByID(R.MyInternationalizationString.SetDoorLockNomallyOpen).Replace("{0}", "\r\n");
                   //var confirm = Language.StringByID(R.MyInternationalizationString.Confrim);
                   //var alert = new UserCenter.DoorLock.ShowDoorLockMsgControl(UserCenter.DoorLock.ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, confirm);
                   //alert.Show();
                   //alert.ConfirmClickEvent += () =>
                   // {
                   //     string msgTimeInValidSetting = Language.StringByID(R.MyInternationalizationString.DoorLockOpenAllTheTime);
                   //     var timeConfrim = Language.StringByID(R.MyInternationalizationString.Confrim);
                   //     var alertTimeInValidSetting = new UserCenter.DoorLock.ShowDoorLockMsgControl(UserCenter.DoorLock.ShowDoorLockMsgControl.DoorLockMsgType.InValid, msgTimeInValidSetting, timeConfrim);
                   //     alertTimeInValidSetting.Show();
                   //     alertTimeInValidSetting.InvalidTimeAction += async (obj) =>
                   //     {
                   Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidTimeDialog(Send.CurrentDoorLock, action);
                   Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.LogicAction += (d) => {
                       this.RemoveFromParent();
                       var soneLogicList = new SoneLogicList();
                       UserView.HomePage.Instance.AddChidren(soneLogicList);
                       UserView.HomePage.Instance.PageIndex += 1;
                       soneLogicList.Show(() => { }, true);
                   //         var result = await new ZigBee.Device.DoorLock { }.SetNormallyOpenModeFuncAsync(true);
                   //         //var res = await Shared.Phone.Device.Logic.SkipView.LockAddModifyLogic(DoorLockCommonInfo.NormallyOpenModeInvalidTime, doorLock);
                   //     };
                   // };
                   };
                   #region
                   /*
                   LogicView.TipView.ShowConfrimTip(() =>
                   {///再次确认
                       LogicView.TipView.ShowInputTip(true, async (str) =>
                       {///确认发送命令
                           try
                           {
                               ///xm
                               var result = await SkipView.OpenMode(true,Send.CurrentDoorLock);
                               if (!result)
                               {
                                   Application.RunOnMainThread(() =>
                                   {
                                     ///提示失败
                                   });
                                   return;
                               }
                               else
                               {
                                   ///因为有常开模式下才可以创建失效逻辑;
                                   SkipView.GetLogicAll();//删除之前所有失效逻辑
                                   var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//添加一条失效逻辑
                                   if (!addResult)
                                   {
                                       ///提示失败
                                       return;
                                   }
                                   this.RemoveFromParent();
                                   var soneLogicList = new SoneLogicList();
                                   UserView.HomePage.Instance.AddChidren(soneLogicList);
                                   UserView.HomePage.Instance.PageIndex += 1;
                                   soneLogicList.Show(() => { }, true);
                   //   //UserCenter.DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidTimeDialog(new ZigBee.Device.DoorLock { });
                               }
                           }
                           catch
                           {
                   //UserCenter.DoorLock.DoorLockCommonInfo.NomallyOpenModeStartDialog(new ZigBee.Device.DoorLock { }, () =>
                   //{
                   //});
                   // var d = await SkipView.LockAddModifyLogic(12, Send.CurrentDoorLock);
                           }
                       });
                   // var contr = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Tip, "sdgdgdfhfhfhgjggfg");
                   //contr.Show();
                   //contr.ConfirmClickEvent += () =>
                   //  {
                   //  };
                   });
                  */
                   //UserCenter.DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidTimeDialog();
                   #endregion
               };
            }