xm
2020-05-08 6bca8fcd37a48808a0b9c9342fc1be0adddfece6
ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
old mode 100755 new mode 100644
@@ -16,11 +16,7 @@
        {
            Tag = "SoneLogic";
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="action">给徐梅刷新界面用的</param>
        /// <param name="bool_If"></param>
        /// 给徐梅刷新界面用的
        public Action<bool> action;
        public async void Show()
        {
@@ -33,13 +29,11 @@
            view.clickBtn.MouseDownEventHandler += (sender, e) =>
            {
                UserView.HomePage.Instance.ScrollEnabled = true;
                RemoveFromParent();
                if (action != null)
                {
                    action(Send.CurrentDoorLock.IsDoorLockNormallyMode);
                }
                RemoveFromParent();
            };
            var middle = new FrameLayout
@@ -67,8 +61,6 @@
                Y = Application.GetRealHeight(92),
                Width = Application.GetMinRealAverage(294),
                Height = Application.GetMinRealAverage(294),
                UnSelectedImagePath = "ZigeeLogic/noMode.png",
                SelectedImagePath = "ZigeeLogic/openMode.png",
            };
            fLayout.AddChidren(modeIconBtn);
@@ -78,7 +70,7 @@
                var logic = await SkipView.GetLogicIfon();
                fLayout.Height = Application.GetRealHeight(780);//改变高度
                modeIconBtn.IsSelected = true;//改变图标状态
                modeIconBtn.UnSelectedImagePath = "ZigeeLogic/openMode.png";//改变图标状态
                ///第二级父控件
                var openModeFl = new FrameLayout
                {
@@ -116,11 +108,12 @@
                        var soneLogicList = new SoneLogicList();
                        UserView.HomePage.Instance.AddChidren(soneLogicList);
                        UserView.HomePage.Instance.PageIndex += 1;
                        soneLogicList.Show();
                        soneLogicList.Show();
                        soneLogicList.action = action;
                    }
                    else
                    {
                        ///提示失败
                        LogicView.TipView.ShowFlashTip("关闭失败");
                    }
                };
@@ -129,8 +122,8 @@
                var timeTextBtn = new Button
                {
                    Y = Application.GetRealHeight(127 + 69),
                    X = Application.GetRealWidth(225),
                    Width = Application.GetRealWidth(634),
                    X = Application.GetRealWidth(125),
                    Width = Application.GetRealWidth(634 + 200),
                    Height = Application.GetRealHeight(60),
                    TextSize = 15,
                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
@@ -152,7 +145,8 @@
                    var timeInt = int.Parse(logic.Conditions[0]["DoorLockOpenDelayTime"]);
                    int dayInt = (h + timeInt) / 24;//算出几天后执行
                    int hour = (h + timeInt) % 24;//算出几天后那个时间执行
                    timeTextBtn.Text = "时效性常开设置" + y + "年" + m + "月" + d + dayInt + "号" + timeInt + "时" + "执行";
                    int days = int.Parse(d) + dayInt;
                    timeTextBtn.Text = "时效性常开设置" + y + "年" + m + "月" + days.ToString() + "号" + hour.ToString() + "时" + "执行";
                }
                catch { }
@@ -160,7 +154,7 @@
            else
            {
                fLayout.Height = Application.GetRealHeight(645);//改变高度
                modeIconBtn.IsSelected = false;//改变图标状态
                modeIconBtn.UnSelectedImagePath = "ZigeeLogic/noMode.png";//改变图标状态
                ///第二级父控件
                var modeFl = new FrameLayout
                {
@@ -195,58 +189,65 @@
                    Height = Application.GetMinRealAverage(104),
                    X = Application.GetRealWidth(861),
                    Y = Application.GetRealHeight(17),
                    UnSelectedImagePath = "ZigeeLogic/next.png",
                    UnSelectedImagePath = "ZigeeLogic/nextIconSone.png",
                };
                modeFl.AddChidren(nextIconBtn);
                nextIconBtn.MouseUpEventHandler += (sender, e) =>
                 {
                     LogicView.TipView.ShowConfrimTip(() =>
                     {///再次确认
                       LogicView.TipView.ShowInputTip(true, async (str) =>
                         {///确认发送命令
                           try
                             {
                               ///xm
                               var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock);
                                 if (!result)
                                 {
                                     Application.RunOnMainThread(() =>
                                     {
                                       ///提示失败
                                   });
                                     return;
                                 }
                                 else
                                 {
                                   ///因为有常开模式下才可以创建失效逻辑;
                                   SkipView.GetLogicAll();//删除之前所有失效逻辑
                                   var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//添加一条失效逻辑
                                   if (!addResult)
                                     {
                                       ///提示失败
                                       return;
                                     }
                                     Send.CurrentDoorLock.IsDoorLockNormallyMode = true;
                                     this.RemoveFromParent();
                                     var soneLogicList = new SoneLogicList();
                                     UserView.HomePage.Instance.AddChidren(soneLogicList);
                                     UserView.HomePage.Instance.PageIndex += 1;
                                     soneLogicList.Show();
                {
                                 }
                             }
                             catch
                             {
                    LogicView.TipView.ShowConfrimTip(() =>
                             }
                         });
                    {///再次确认
                        LogicView.TipView.ShowInputTip(true, async (str) =>
                        {///确认发送命令
                            try
                            {
                                ///xm
                                var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock);
                                if (!result)
                                {
                                    LogicView.TipView.ShowFlashTip("开启失败");
                                    return;
                                }
                                else
                                {
                                    ///因为有常开模式下才可以创建失效逻辑;
                                    SkipView.GetLogicAll();//删除之前所有失效逻辑
                                    var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//添加一条失效逻辑
                                    if (!addResult)
                                    {
                                        ///提示失败
                                        LogicView.TipView.ShowFlashTip("添加失败");
                                        return;
                                    }
                                    Send.CurrentDoorLock.IsDoorLockNormallyMode = true;
                                    this.RemoveFromParent();
                                    var soneLogicList = new SoneLogicList();
                                    UserView.HomePage.Instance.AddChidren(soneLogicList);
                                    UserView.HomePage.Instance.PageIndex += 1;
                                    soneLogicList.Show();
                                    soneLogicList.action = action;
                                    //soneLogicList.action += (c) => {
                                    //    if (action != null)
                                    //    {
                                    //        action(Send.CurrentDoorLock.IsDoorLockNormallyMode);
                                    //    }
                                    //};
                     });
                                }
                            }
                            catch
                            {
                 };
                            }
                        });
                    });
                };
            }
            #endregion
@@ -397,10 +398,11 @@
        /// 加载自动化列表
        /// </summary>
        /// <param name="verticalRefresh"></param>
        RowLayout selectedRow = new RowLayout() { Tag = "0" };//记录左滑状态
        int a = 1;
        private void RefreshView(VerticalRefreshLayout verticalRefresh)
        {
            verticalRefresh.RemoveAll();
            foreach (var logic in Common.Logic.SoneLogicList)
            {
                #region  自动化布局View
@@ -417,17 +419,19 @@
                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                    SubViewWidth = Application.GetRealWidth(184),//改变编辑控件宽度多少;
                    Tag = a.ToString(),
                };
                fLayout.AddChidren(logicRow);
                //左滑菜单事件
                logicRow.OpenMenuAction += () =>
                {
                    //if (selectedRow.Tag.ToString() != logicRowlayout.Tag.ToString())
                    //{   //保留左滑只有一个;
                    //    selectedRow.HideMenu();//
                    //}
                    //selectedRow = logicRowlayout;
                    if (selectedRow.Tag.ToString() != logicRow.Tag.ToString())
                    {   //保留左滑只有一个;
                        selectedRow.HideMenu();//
                    }
                    selectedRow = logicRow;
                };
                a++;
                ///显示逻辑名称的控件
                var nameBtn = new Button
                {