From 05ce435c3b58e53eeab04c672affdeeab75f3036 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 15 十一月 2019 14:41:39 +0800
Subject: [PATCH] 2019.11.15-1

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs |   94 ++++++++++++++++++++++++++--------------------
 1 files changed, 53 insertions(+), 41 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs
index 7ca2197..11acf4a 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindTargetsPage.cs
@@ -18,14 +18,8 @@
         /// <param name="common">Common.</param>
         public void Changed(CommonDevice common)
         {
-            //if (common.Type != ZigBee.Device.DeviceType.OnOffSwitch)
-            //{
-            //    return;
-            //}
-
             Shared.Application.RunOnMainThread(() =>
             {
-                //var dev = common as Panel;
             });
         }
 
@@ -170,11 +164,11 @@
                 CommonPage.Loading.Start("");
                 #region 鏁版嵁澶勭悊
                 var tempDeata = await currentKey.ReadPanelConfigureInfoAsync();
+
                 if (tempDeata != null && tempDeata.deviceStatusReportData != null)
                 {
                     currentClusterID = tempDeata.deviceStatusReportData.CluterID;
-                    //if (currentClusterID == 6)
-                    //{
+
                     foreach (var attr in tempDeata.deviceStatusReportData.AttriBute)
                     {
                         currentKey.panelMode = attr.AttriButeData;
@@ -183,44 +177,76 @@
 
                         var bindDeviceListTemp = new System.Collections.Generic.List<BindListResponseObj> { };
                         var bindSceneListTemp = new System.Collections.Generic.List<BindListResponseObj> { };
-                        if (getBindList != null)
+                        if (getBindList != null && getBindList.getAllBindResponseData != null)
                         {
-                            if (getBindList.getAllBindResponseData != null)
+                            foreach (var b in getBindList.getAllBindResponseData.BindList)
                             {
-                                foreach (var b in getBindList.getAllBindResponseData.BindList)
+                                if (b.BindCluster == currentClusterID)
                                 {
-                                    if (b.BindCluster == currentClusterID)
+                                    if (b.BindCluster == 6)
                                     {
-                                        if (b.BindCluster == 6)
-                                        {
 
-                                            if (b.BindType == 2)
-                                            {
-                                                bindSceneListTemp.Add(b);
-                                            }
-                                            else
-                                            {
-                                                bindDeviceListTemp.Add(b);
-                                            }
+                                        if (b.BindType == 2)
+                                        {
+                                            bindSceneListTemp.Add(b);
                                         }
                                         else
                                         {
-                                            currentKey.bindList.Add(b);
+                                            bindDeviceListTemp.Add(b);
                                         }
+                                    }
+                                    else
+                                    {
+                                        currentKey.bindList.Add(b);
                                     }
                                 }
                             }
                         }
+                        else
+                        {
+                            var btn = new Button()
+                            {
+                                Gravity = Gravity.Center,
+                            };
+                            this.midFrameLayout.AddChidren(btn);
+                            Application.RunOnMainThread(() =>
+                            {
+                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btn);
+                            });
+                        }
+
                         if (currentKey.panelMode == 1)
                         {
                             currentKey.bindList = bindSceneListTemp;
+                            currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddScene);
                         }
                         else if (currentKey.panelMode == 100 || currentKey.panelMode == 101 || currentKey.panelMode == 102)
                         {
                             currentKey.bindList = bindDeviceListTemp;
+                            currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddSwitch);
+                        }
+                        else if (currentKey.panelMode == 200 || currentKey.panelMode == 201 || currentKey.panelMode == 202 || currentKey.panelMode == 203 || currentKey.panelMode == 204 || currentKey.panelMode == 205)
+                        {
+                            currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddDimmer);
+                        }
+                        else if (currentKey.panelMode == 300 || currentKey.panelMode == 301 || currentKey.panelMode == 302 || currentKey.panelMode == 303 || currentKey.panelMode == 304)
+                        {
+                            currentKey.currentKeySelectModeText = Language.StringByID(R.MyInternationalizationString.AddCurtain);
                         }
                     }
                     #endregion 
+                }
+                else
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        var btn = new Button()
+                        {
+                            Gravity = Gravity.Center,
+                        };
+                        this.midFrameLayout.AddChidren(btn);
+                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btn);
+                    });
                 }
             }
             catch
@@ -297,20 +323,6 @@
                 midVerticalScrolViewLayout.Height = this.midFrameLayout.Height;
                 BackgroundColor = Shared.Common.ZigbeeColor.Current.XMMidFrameLayout;
 
-                //var tempDeata = await currentKey.ReadPanelConfigureInfoAsync();
-                //if (tempDeata != null && tempDeata.deviceStatusReportData != null)
-                //{
-                //    currentClusterID = tempDeata.deviceStatusReportData.CluterID;
-                //    if (currentClusterID == 6)
-                //    {
-                //        foreach (var attr in tempDeata.deviceStatusReportData.AttriBute)
-                //        {
-                //            curModeId = attr.AttriButeData;
-                //            currentKey.panelMode = curModeId;
-                //        }
-                //    }
-                //}
-
                 if (currentKey.panelMode == 1)
                 {
                     topMidVerticalScrolViewLayout.Height = Application.GetRealHeight(0);
@@ -353,7 +365,7 @@
                     {
                         TextColor = Shared.Common.ZigbeeColor.Current.GXCTextWhiteColor,
                         X = btnBindName.Right,
-                        TextID = R.MyInternationalizationString.Delete,
+                        TextID = R.MyInternationalizationString.DelBindDevice,
                         BackgroundColor = Shared.Common.ZigbeeColor.Current.DelRowLayout,
                     };
                     rowLayout.AddRightView(btnDel);
@@ -463,7 +475,7 @@
             var btnDel = new Button()
             {
                 TextColor = Shared.Common.ZigbeeColor.Current.GXCTextWhiteColor,
-                TextID = R.MyInternationalizationString.Delete,
+                TextID = R.MyInternationalizationString.DelBindDevice,
                 BackgroundColor = Shared.Common.ZigbeeColor.Current.DelRowLayout,
             };
             modeRowLayout.AddRightView(btnDel);
@@ -568,8 +580,8 @@
                         RefreshList();
                         //濡傛灉鏄満鏅紝鐢ㄦ埛鍒犻櫎娓呯┖褰撳墠鍒版埧闂村垪琛�
                         currentKey.RoomId = "";
+                        currentKey.ReSave();
                     }
-
                     CommonPage.Loading.Hide();
                 }
 
@@ -679,7 +691,6 @@
                        currentKey.currentKeySelectModeText = btnMethodText.Text;
                        oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    }
-
                    if (currentKey.currentKeySelectModeText == Language.StringByID(R.MyInternationalizationString.AddScene))
                    {
                        if (currentKey.bindList.Count != 0)
@@ -1000,6 +1011,7 @@
                                 RefreshList();
                                 //濡傛灉鏄満鏅紝鐢ㄦ埛鍒犻櫎娓呯┖褰撳墠鍒版埧闂村垪琛�
                                 currentKey.RoomId = "";
+                                currentKey.ReSave();
                                 return 0;
                                 break;
                             case 1:

--
Gitblit v1.8.0