黄学彪
2019-11-18 88ce6b0697ccf6ce467545bb1125aefdf5b7130b
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
@@ -239,6 +265,7 @@
        /// <param name="key">Key.</param>
        async void RefreshList()
        {
            #region BindEmptyPic UI
            this.midFrameLayout.RemoveAll();
            var entryStatusPic = new Button
@@ -275,6 +302,7 @@
            };
            this.midFrameLayout.AddChidren(midVerticalScrolViewLayout);
            midVerticalScrolViewLayout.RemoveAll();
            #endregion
            if (currentKey.bindList.Count == 0)
            {
@@ -296,20 +324,6 @@
                midVerticalScrolViewLayout.Y = topMidVerticalScrolViewLayout.Bottom;
                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)
                {
@@ -353,14 +367,13 @@
                    {
                        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);
                    #endregion
                    #region 绑定数据处理
                    #region 绑定数据处理
                    bool isExistScene = false;
                    foreach (var sc in currentKey.bindList)
@@ -373,7 +386,7 @@
                    if (isExistScene)
                    {
                        devicePic.UnSelectedImagePath = "Item/Scene.png";
                        devicePic.UnSelectedImagePath = "SceneIcon/4.png";
                        devicePic.Width = Application.GetMinRealAverage(110);
                        if (bindDevice.ESName == "")
@@ -463,7 +476,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 +581,8 @@
                        RefreshList();
                        //如果是场景,用户删除清空当前到房间列表
                        currentKey.RoomId = "";
                        currentKey.ReSave();
                    }
                    CommonPage.Loading.Hide();
                }
@@ -679,7 +692,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 +1012,7 @@
                                RefreshList();
                                //如果是场景,用户删除清空当前到房间列表
                                currentKey.RoomId = "";
                                currentKey.ReSave();
                                return 0;
                                break;
                            case 1: