From a4d29f9f72452ccae2f607e6ad31cad493822da4 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期三, 06 五月 2020 11:36:47 +0800
Subject: [PATCH] 2020-05-06-1

---
 ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs |  128 ++++++++++++++++++++++--------------------
 1 files changed, 68 insertions(+), 60 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
index b84b75c..4501171 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/SoneLogicList.cs
@@ -11,12 +11,28 @@
         /// <summary>
         /// 缁橲one闂ㄩ攣寰愭鏇存柊鐣岄潰鐢ㄧ殑
         /// </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  鐣岄潰鐨勫竷灞�浠g爜
             UserView.HomePage.Instance.ScrollEnabled = false;//閿佷綇宸︽粦
             TopView view = new TopView();
@@ -92,22 +108,11 @@
                     TextSize = 16,
                 };
                 openModeFl.AddChidren(closeBtn);
-                closeBtn.MouseUpEventHandler += (sender, e) =>
+                closeBtn.MouseUpEventHandler += async (sender, e) =>
                 {
-
-                    var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Confirm,
-                   Language.StringByID(MyInternationalizationString.doyouwanttodelete),
-                   Language.StringByID(MyInternationalizationString.confrim));
-                    alert.Show();
-                    alert.ConfirmClickEvent += async () =>
+                    var result = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(Send.CurrentDoorLock);
+                    if (result)
                     {
-
-                        var bool_ = await UserCenter.DoorLock.DoorLockCommonInfo.DelNormallyOpenMode(new ZigBee.Device.DoorLock { });
-                        if (bool_)
-                        {
-
-                        }
-                        else { }
                         if (logic != null)
                         {
                             ///鏈夊彲鑳藉彧鏈夊父寮�妯″紡锛屾病鏈夋椂鏁堟�ц嚜鍔ㄥ寲
@@ -118,8 +123,13 @@
                         var soneLogicList = new SoneLogicList();
                         UserView.HomePage.Instance.AddChidren(soneLogicList);
                         UserView.HomePage.Instance.PageIndex += 1;
-                        soneLogicList.Show();
-                    };
+                        soneLogicList.Show(() => { }, false);
+                    }
+                    else
+                    {
+                        ///鎻愮ず澶辫触
+                    }
+
                 };
 
                 ///鏄剧ず澶辨晥璁剧疆鏃堕棿鏂囨湰鎺т欢
@@ -196,55 +206,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);
+
 
                 nextIconBtn.MouseUpEventHandler += (sender, e) =>
-               {
-                   Logic.LogicView.TipView tipView = new LogicView.TipView();
+                 {
+                     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;
+                                     }
+                                     this.RemoveFromParent();
+                                     var soneLogicList = new SoneLogicList();
+                                     UserView.HomePage.Instance.AddChidren(soneLogicList);
+                                     UserView.HomePage.Instance.PageIndex += 1;
+                                     soneLogicList.Show(() => { }, true);
 
-                   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) =>
-                   //     {
+                                 }
+                             }
+                             catch
+                             {
 
-                   //         var result = await new ZigBee.Device.DoorLock { }.SetNormallyOpenModeFuncAsync(true);
-                   //         //var res = await Shared.Phone.Device.Logic.SkipView.LockAddModifyLogic(DoorLockCommonInfo.NormallyOpenModeInvalidTime, doorLock);
-                   //     };
-                   // };
+                             }
+                         });
 
-                   //   //UserCenter.DoorLock.DoorLockCommonInfo.NomallyOpenModeInvalidTimeDialog(new ZigBee.Device.DoorLock { });
+                     });
 
-                   //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

--
Gitblit v1.8.0