陈嘉乐
2020-07-10 48ba446936b51fffafa7c3600c0dadc6ac0e8c20
ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -1,4 +1,5 @@
using Shared.Common;
using Shared.Phone.UserCenter.SmartSound;
using System;
using System.Collections.Generic;
using System.Text;
@@ -12,7 +13,10 @@
    public class DeviceListMainForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
        /// <summary>
        /// 智能音箱
        /// </summary>
        private MySmartSoundControl smmartSoundView = null;
        /// <summary>
        /// 网关控件
        /// </summary>
@@ -86,6 +90,18 @@
            //清空bodyFrame
            this.ClearBodyFrame();
            smmartSoundView = new MySmartSoundControl();
            bodyFrameLayout.AddChidren(smmartSoundView);
            smmartSoundView.InitControl();
            //当前不是虚拟住宅的话
            if (Config.Instance.Home.IsVirtually == false)
            {
                smmartSoundView.ButtonClickEvent += (sernder, e) =>
                {
                    var form = new SmartSoundListForm();
                    form.AddForm();
                };
            }
            //初始化网关行控件
            GatewayResourse.NowSelectGatewayId = GatewayResourse.AppOldSelectGatewayId;
            var nowGateway = HdlGatewayLogic.Current.GetLocalGateway(GatewayResourse.AppOldSelectGatewayId);
@@ -232,7 +248,7 @@
            //提示新版本
            var btnNew = new InformationTipView(rowMenu.btnIcon);
            btnNew.Visible = false;
            rowMenu.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEventOnly);
            rowMenu.frameTable.AddChidren(btnNew, ChidrenBindMode.BindEvent);
            rowMenu.AddTag("btnNew", btnNew);
            //检测设备是否拥有定位的功能
@@ -317,17 +333,35 @@
            var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
            if (isShow == true)
            {
                //展开模式时,扩大依据为:它有几个子控件
                heightValue = (listDevice.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
                //标题自己就是一个子控件
                if (rowInfo.frameTable.ChildrenCount == 1)
                //获取这一堆设备时属于什么类型的
                var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
                if (deviceEnumInfo.ConcreteType == DeviceConcreteType.ButtonPanel_SimpleMultifunction)
                {
                    //获取这一堆设备时属于什么类型的
                    var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice);
                    foreach (CommonDevice info in listDevice)
                    var listTemp = Common.LocalDevice.Current.GetMutilfunctionPanelByMac(listDevice);
                    //展开模式时,扩大依据为:它有几个子控件
                    heightValue = (listTemp.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
                    //标题自己就是一个子控件
                    if (rowInfo.frameTable.ChildrenCount == 1)
                    {
                        //加载它的列表
                        this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo);
                        foreach (CommonDevice info in listTemp)
                        {
                            //加载它的列表
                            this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo);
                        }
                    }
                }
                else
                {
                    //展开模式时,扩大依据为:它有几个子控件
                    heightValue = (listDevice.Count + 1) * (ControlCommonResourse.ListViewRowHeight + rowInfo.frameTable.rowSpace);
                    //标题自己就是一个子控件
                    if (rowInfo.frameTable.ChildrenCount == 1)
                    {
                        foreach (CommonDevice info in listDevice)
                        {
                            //加载它的列表
                            this.AddDeviceDetailRow(rowInfo.frameTable, info, deviceEnumInfo);
                        }
                    }
                }
            }
@@ -625,7 +659,7 @@
                if (HdlGatewayLogic.Current.GetRealGateway(ref realWay, nowGateway) == true)
                {
                    //重新设置住宅ID(这个应该是不经过APP,直接把网关恢复了出厂设置)
                    if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.getGatewayBaseInfo.HomeId) == true)
                    if (HdlGatewayLogic.Current.HomeIdIsEmpty(realWay.HomeId) == true)
                    {
                        //显示进度条
                        ProgressBar.Show();
@@ -701,13 +735,14 @@
        /// </summary>
        /// <param name="gateWay">网关对象</param>
        /// <param name="online">在线状态变更后的状态</param>
        public override void GatewayOnlinePush(ZbGateway gateWay, bool online)
        /// <param name="hadGwOnline">2020.05.25追加:此住宅是否拥有网关在线</param>
        public override void GatewayOnlinePush(ZbGateway gateWay, bool online, bool hadGwOnline)
        {
            if (this.gatewayViewRow == null)
            {
                return;
            }
            if (HdlGatewayLogic.Current.GetGatewayId(gateWay) == this.gatewayViewRow.zbGatewayId)
            if (gateWay.GwId == this.gatewayViewRow.zbGatewayId)
            {
                Application.RunOnMainThread(() =>
                {
@@ -1126,9 +1161,10 @@
                this.UseClickStatu = false;
                if (i_zbGateway != null)
                {
                    this.zbGatewayId = HdlGatewayLogic.Current.GetGatewayId(i_zbGateway);
                    this.zbGatewayId = i_zbGateway.GwId;
                }
                this.BackgroundColor = UserCenterColor.Current.White;
                this.Y = Application.GetRealHeight(174);
                this.Height = Application.GetRealHeight(173);
            }
@@ -1243,7 +1279,55 @@
                }
            }
        }
        #endregion
        #region ■ 自定义智能音箱控件_____________________
        /// <summary>
        /// 自定义网关控件
        /// </summary>
        private class MySmartSoundControl : FrameRowControl
        {
            /// <summary>
            /// 网关名字控件
            /// </summary>
            private NormalViewControl btnName = null;
            /// <summary>
            /// 自定音箱关控件
            /// </summary>
            public MySmartSoundControl()
            {
                this.UseClickStatu = false;
                this.BackgroundColor = UserCenterColor.Current.White;
                this.Height = Application.GetRealHeight(173);
                //this.InitControl();
            }
            /// <summary>
            /// 初始化控件
            /// </summary>
            public void InitControl()
            {
                //图标
                var btnIcon = this.AddLeftIcon(81);
                btnIcon.UnSelectedImagePath = "SmartSound/SoundIcon.png";
                //显示文本
                btnName = this.AddLeftCaption(string.Empty, 700);
                btnName.Height = Application.GetRealHeight(60);
                btnName.TextSize = 15;
                btnName.Y = Application.GetRealHeight(57);
                btnName.Text = "小度小度";
                this.AddRightArrow();
                this.AddMostRightView("", 300, false).Name = "smartSoundLayout";
                this.AddBottomLine();
            }
        }
        #endregion
    }
}