HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-05-06 ae7c46bda98a987d170a9b8419fc014564790359
ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
@@ -8,12 +8,23 @@
{
    public class SoneLogicList : FrameLayout
    {
        /// <summary>
        /// 给Sone门锁徐梅更新界面用的
        /// </summary>
        ///
        public SoneLogicList()
        {
            Tag = "SoneLogic";
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="action">给徐梅刷新界面用的</param>
        /// <param name="bool_If"></param>
        public Action<bool> action;
        public async void Show()
        {
            #region  界面的布局代码
            UserView.HomePage.Instance.ScrollEnabled = false;//锁住左滑
            TopView view = new TopView();
@@ -22,7 +33,13 @@
            view.clickBtn.MouseDownEventHandler += (sender, e) =>
            {
                UserView.HomePage.Instance.ScrollEnabled = true;
                if (action != null)
                {
                    action(Send.CurrentDoorLock.IsDoorLockNormallyMode);
                }
                RemoveFromParent();
            };
            var middle = new FrameLayout
@@ -54,10 +71,11 @@
                SelectedImagePath = "ZigeeLogic/openMode.png",
            };
            fLayout.AddChidren(modeIconBtn);
            var logic = await SkipView.GetLogicIfon();
            if (logic != null)
            {
            if (Send.CurrentDoorLock.IsDoorLockNormallyMode)
            {
                /// 查找是否存在时效性自动化;有的话就返回自动化对象;
                var logic = await SkipView.GetLogicIfon();
                fLayout.Height = Application.GetRealHeight(780);//改变高度
                modeIconBtn.IsSelected = true;//改变图标状态
@@ -82,22 +100,29 @@
                    TextSize = 16,
                };
                openModeFl.AddChidren(closeBtn);
                closeBtn.MouseUpEventHandler += (sender,e) => {
                    var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
                   Language.StringByID(MyInternationalizationString.doyouwanttodelete),
                   Language.StringByID(MyInternationalizationString.confrim));
                    alert.Show();
                    alert.ConfirmClickEvent += () =>
                closeBtn.MouseUpEventHandler += async (sender, e) =>
                    {
                    var result = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock);
                    if (result)
                    {
                        if (logic != null)
                        {
                            ///有可能只有常开模式,没有时效性自动化
                            ///没有判断的话,逻辑会为空,抛出异常;
                        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();
                    };
                    }
                    else
                    {
                        ///提示失败
                    }
                };
                ///显示失效设置时间文本控件
@@ -111,7 +136,11 @@
                    TextColor = ZigbeeColor.Current.LogicTextBlackColor,
                    Text = "时效性常开设置12:20",
                };
                if (logic != null)
                {
                    ///有时效性常开才显示时间条件文本
                openModeFl.AddChidren(timeTextBtn);
                }
                ///时效性常开只有一个条件;
                try
                {
@@ -170,19 +199,53 @@
                };
                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);
                clickBtn.MouseUpEventHandler += async (sender, e) =>
                nextIconBtn.MouseUpEventHandler += (sender, e) =>
                {
                    var d = await SkipView.LockAddModifyLogic(12, Send.CurrentDoorLock);
                     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
                             {
                             }
                         });
                     });
                };
            }