陈嘉乐
2020-05-06 6817ec660fcf032ed94a4197b145ad1e96c2aeed
ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
@@ -21,18 +21,10 @@
        /// </summary>
        /// <param name="action">给徐梅刷新界面用的</param>
        /// <param name="bool_If"></param>
        public async void Show(Action action, bool bool_If = false)
        public Action<bool> action;
        public async void Show()
        {
            #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();
@@ -43,7 +35,7 @@
                UserView.HomePage.Instance.ScrollEnabled = true;
                if (action != null)
                {
                    action();
                    action(Send.CurrentDoorLock.IsDoorLockNormallyMode);
                }
                RemoveFromParent();
@@ -80,7 +72,7 @@
            };
            fLayout.AddChidren(modeIconBtn);
            if (bool_If)
            if (Send.CurrentDoorLock.IsDoorLockNormallyMode)
            {
                /// 查找是否存在时效性自动化;有的话就返回自动化对象;
                var logic = await SkipView.GetLogicIfon();
@@ -111,7 +103,7 @@
                closeBtn.MouseUpEventHandler += async (sender, e) =>
                {
                    var result = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock);
                    if (result)
                    if (result)
                    {
                        if (logic != null)
                        {
@@ -119,15 +111,16 @@
                            ///没有判断的话,逻辑会为空,抛出异常;
                            Send.DelLogic(logic.LogicId);
                        }
                        Send.CurrentDoorLock.IsDoorLockNormallyMode = false;
                        this.RemoveFromParent();
                        var soneLogicList = new SoneLogicList();
                        UserView.HomePage.Instance.AddChidren(soneLogicList);
                        UserView.HomePage.Instance.PageIndex += 1;
                        soneLogicList.Show(() => { }, false);
                        soneLogicList.Show();
                    }
                    else
                    {
                        ///提示失败
                        LogicView.TipView.ShowFlashTip("关闭失败");
                    }
                };
@@ -202,7 +195,7 @@
                    Height = Application.GetMinRealAverage(104),
                    X = Application.GetRealWidth(861),
                    Y = Application.GetRealHeight(17),
                    UnSelectedImagePath = "ZigeeLogic/next.png",
                    UnSelectedImagePath = "ZigeeLogic/nextIconSone.png",
                };
                modeFl.AddChidren(nextIconBtn);
@@ -210,7 +203,9 @@
                nextIconBtn.MouseUpEventHandler += (sender, e) =>
                 {
                     LogicView.TipView.ShowConfrimTip(() =>
                     {///再次确认
                       LogicView.TipView.ShowInputTip(true, async (str) =>
                         {///确认发送命令
@@ -220,10 +215,7 @@
                               var result = await UserCenter.DoorLock.DoorLockCommonInfo.SetNormallyOpenModeFuncAsync(Send.CurrentDoorLock);
                                 if (!result)
                                 {
                                     Application.RunOnMainThread(() =>
                                     {
                                       ///提示失败
                                   });
                                     LogicView.TipView.ShowFlashTip("开启失败");
                                     return;
                                 }
                                 else
@@ -233,14 +225,16 @@
                                   var addResult = await SkipView.LockAddModifyLogic(int.Parse(str), Send.CurrentDoorLock);//添加一条失效逻辑
                                   if (!addResult)
                                     {
                                       ///提示失败
                                       return;
                                     }
                                         ///提示失败
                                         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(() => { }, true);
                                     soneLogicList.Show();
                                 }
                             }
@@ -403,14 +397,11 @@
        /// 加载自动化列表
        /// </summary>
        /// <param name="verticalRefresh"></param>
        RowLayout selectedRow = new RowLayout() { Tag = "0" };//记录左滑状态
        int i = 1;
        private void RefreshView(VerticalRefreshLayout verticalRefresh)
        {
            verticalRefresh.RemoveAll();
            for (int i = 0; i < 6; i++)
            {
                Common.Logic.SoneLogicList.Add(new Common.Logic { LogicName = i.ToString() });
            }
            foreach (var logic in Common.Logic.SoneLogicList)
            {
                #region  自动化布局View
@@ -427,17 +418,19 @@
                    LineColor = ZigbeeColor.Current.LogicBackgroundColor,
                    BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
                    SubViewWidth = Application.GetRealWidth(184),//改变编辑控件宽度多少;
                    Tag = i.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;
                };
                i++;
                ///显示逻辑名称的控件
                var nameBtn = new Button
                {